[PR #7632] [MERGED] feat(device-authorization): add user id checks #7454

Closed
opened 2026-03-13 13:37:05 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7632
Author: @himself65
Created: 1/27/2026
Status: Merged
Merged: 1/27/2026
Merged by: @himself65

Base: canaryHead: himself65/2026/01/27/check


📝 Commits (1)

  • 76c6a7f feat(device-authorization): add user id checks

📊 Changes

2 files changed (+115 additions, -6 deletions)

View changed files

📝 packages/better-auth/src/plugins/device-authorization/device-authorization.test.ts (+67 -2)
📝 packages/better-auth/src/plugins/device-authorization/routes.ts (+48 -4)

📄 Description

Summary by cubic

Enforces user-bound checks in device authorization so only the signed-in user can approve or deny a device code. Adds authentication to deny, tracks userId, prevents re-approval, and expands error responses.

  • New Features

    • Require authentication for deviceDeny; request headers are now mandatory.
    • Validate userId on approve/deny; block actions by a different user.
    • Store userId when approving/denying; prevent re-approval of processed codes.
    • Add error codes: unauthorized and access_denied (approve/deny), device_code_already_processed (approve).
    • Add tests covering auth requirements, userId checks, and re-approval prevention.
  • Migration

    • Clients must send authenticated headers to deviceDeny.
    • Handle new error responses: unauthorized, access_denied, and device_code_already_processed.

Written for commit 76c6a7f036. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/7632 **Author:** [@himself65](https://github.com/himself65) **Created:** 1/27/2026 **Status:** ✅ Merged **Merged:** 1/27/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2026/01/27/check` --- ### 📝 Commits (1) - [`76c6a7f`](https://github.com/better-auth/better-auth/commit/76c6a7f036ea801401a1318fc84f882910aa3460) feat(device-authorization): add user id checks ### 📊 Changes **2 files changed** (+115 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/device-authorization/device-authorization.test.ts` (+67 -2) 📝 `packages/better-auth/src/plugins/device-authorization/routes.ts` (+48 -4) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Enforces user-bound checks in device authorization so only the signed-in user can approve or deny a device code. Adds authentication to deny, tracks userId, prevents re-approval, and expands error responses. - **New Features** - Require authentication for deviceDeny; request headers are now mandatory. - Validate userId on approve/deny; block actions by a different user. - Store userId when approving/denying; prevent re-approval of processed codes. - Add error codes: unauthorized and access_denied (approve/deny), device_code_already_processed (approve). - Add tests covering auth requirements, userId checks, and re-approval prevention. - **Migration** - Clients must send authenticated headers to deviceDeny. - Handle new error responses: unauthorized, access_denied, and device_code_already_processed. <sup>Written for commit 76c6a7f036ea801401a1318fc84f882910aa3460. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 13:37:05 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#7454