feat: adopt wata device-code transport for cli auth - #750
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c872eacf4b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
# Conflicts: # pnpm-lock.yaml # ref-impls/cli-auth/cli.ts # ref-impls/cli-auth/package.json # ref-impls/cli-auth/src/App.tsx # ref-impls/cli-auth/worker/approve.ts # ref-impls/cli-auth/worker/deps.ts # ref-impls/cli-auth/worker/index.ts # src/cli/Provider.localnet.test.ts # src/cli/adapter.ts # src/server/CliAuth.test-d.ts # src/server/CliAuth.test.ts # src/server/CliAuth.ts # src/server/internal/handlers/codeAuth.ts
|
Merged |
commit: |
|
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 420553c843
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dc76f4f464
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!prompt.verificationUriFull) | ||
| process.stdout.write(`Enter code ${prompt.userCode} at ${prompt.verificationUri}\n`) |
There was a problem hiding this comment.
Format the raw code in the fallback prompt
When the CLI uses the new Handler.deviceCode host, whose registration response intentionally exposes the raw eight-character protocol value, and verificationUriFull is absent, this renders ABCDEFGH instead of the required human-facing ABCD-EFGH. Apply hyphen formatting only to the text written to stdout while preserving the raw value in the protocol request.
AGENTS.md reference: AGENTS.md:L55-L58
Useful? React with 👍 / 👎.
| const validation = await validate?.({ | ||
| record, | ||
| request: pending, | ||
| result: submittedResult, | ||
| userCode, | ||
| }) | ||
| if (validation) return validation |
There was a problem hiding this comment.
Require validation before approving submitted results
When a host uses the documented Handler.deviceCode configuration without the optional validate callback, POST /verify accepts a browser-supplied RPC result and marks the device code approved without authenticating the submitter or verifying that the result is valid for the pending request. Since Handler.from also enables wildcard CORS by default, anyone who obtains the displayed user code can submit a fabricated connect or signing result; make validation mandatory or provide a safe authentication and method-validation default before calling actions.approve.
Useful? React with 👍 / 👎.
| results: z.optional( | ||
| z.array(z.object({ id: z.union([z.string(), z.number()]), result: z.unknown() })), | ||
| ), |
There was a problem hiding this comment.
Relay RPC errors from the approval page
When executing an approved wallet request fails for a reason other than explicit denial, the approval page has no valid response shape it can submit: every entry is required to contain result, and an RPC error entry fails this schema. The verify request therefore returns 400 while the device record remains pending, so the client eventually reports a timeout instead of the actual wallet error; accept result-or-error envelopes and call event.reject for submitted errors.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cc9af34ab7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if ('result' in response) { | ||
| const validation = await validate({ | ||
| record, |
There was a problem hiding this comment.
Run approval policy for error and denial responses
When the host relies on the required validate callback to protect POST /auth/device/verify, an approval containing an RPC error bypasses it because validation runs only for entries with result; the earlier action === 'deny' branch bypasses it as well. With the default wildcard CORS behavior, anyone who obtains a pending user code can therefore settle the request as rejected without satisfying the host's authentication or method policy. Although validate is now required, this new conditional is fresh evidence that non-success settlements remain unvalidated; invoke a policy/authentication hook before both actions.approve and actions.deny, expanding its input to support error envelopes.
Useful? React with 👍 / 👎.
Rewrites
accounts/clionto the Wata device-code transport (RFC 8628 with PKCE), adds anaccounts/deviceCodeadapter with atempoWalletpreset, and removesCliAuthandHandler.codeAuthfromaccounts/server, aligning CLI auth with the wallet's other uRPC transports.Wallet counterpart: https://github.com/tempoxyz/wallet/pull/651