Skip to content

refactor(fe): one queue for authorization-bearing requests - #4269

Merged
sea-snake merged 1185 commits into
mainfrom
fe/authorization-request-queue
Sep 10, 2026
Merged

refactor(fe): one queue for authorization-bearing requests#4269
sea-snake merged 1185 commits into
mainfrom
fe/authorization-request-queue

Conversation

@sea-snake

@sea-snake sea-snake commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Design: #4224. Overview: #4230. Groundwork for #4273, which is the second caller.

The delegation handler serialises its own requests so that two consent screens cannot race. The session handler coming in #4273 also authorizes, and it has to share that queue rather than keep one of its own — two queues would let one request paint over the other's screen.

Lifts the queue out of the delegation handler into serialize.ts as serializeAuthorizationRequest. No change to what the delegation handler does with it.

No tests: handleDelegationRequest has no unit coverage today, and the extracted function is a move of the existing queue. Its first test arrives with the second caller in #4273.

@sea-snake sea-snake added the feature:revocable-app-sessions Design: revocable app sessions label Aug 22, 2026
@sea-snake
sea-snake marked this pull request as ready for review August 22, 2026 18:16
@sea-snake
sea-snake requested a review from a team as a code owner August 22, 2026 18:16
@zeropath-ai

zeropath-ai Bot commented Aug 22, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 378cf13.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► src/frontend/src/lib/stores/channelHandlers/delegation.ts
      Replace inlined delegation serialization with serializeAuthorizationRequest usage
► src/frontend/src/lib/stores/channelHandlers/serialize.ts
      Add new serialize.ts to serialize authorization-bearing requests one at a time

@sea-snake
sea-snake force-pushed the fe/authorization-request-queue branch from 55d30b3 to 0c845ae Compare August 22, 2026 18:45
@sea-snake
sea-snake force-pushed the fe/authorization-request-queue branch from 0c845ae to df54c97 Compare August 22, 2026 19:07
@sea-snake
sea-snake force-pushed the fe/authorization-request-queue branch from df54c97 to 9d2f6d5 Compare August 22, 2026 19:25
@sea-snake
sea-snake force-pushed the fe/authorization-request-queue branch from 9d2f6d5 to d67df85 Compare August 22, 2026 19:49
@sea-snake
sea-snake removed this pull request from stack #4277 September 9, 2026 20:32
@sea-snake
sea-snake changed the base branch from feat/revoke-sessions-from-settings to main September 9, 2026 20:34
@sea-snake
sea-snake added this pull request to stack #4324 September 9, 2026 20:34
@sea-snake
sea-snake removed this pull request from stack #4324 September 9, 2026 20:35
@sea-snake
sea-snake changed the base branch from main to feat/revoke-sessions-from-settings September 9, 2026 20:35
@sea-snake
sea-snake added this pull request to stack #4323 September 9, 2026 20:38
@sea-snake
sea-snake removed this pull request from stack #4323 September 9, 2026 20:42
@sea-snake
sea-snake added this pull request to stack #4326 September 9, 2026 20:43
Comment thread src/frontend/src/lib/stores/channelHandlers/serialize.ts
sea-snake and others added 10 commits September 10, 2026 12:21
Moving the origin bound to the write path left the reads behind. `read_account`
and `list_accounts` never reach the choke point that mints an application, and
the endpoints above them — `get_default_account`, `get_accounts`,
`mcp_get_accounts` — check nothing themselves, so an over-long origin flowed
through, absence normalised to the derived default, and the canister handed out
a principal for an origin it could never persist.

They answer nothing now instead of trapping: an origin that cannot be stored
has no accounts under it, which is true rather than defensive and holds for
callers not yet written.

Two integration tests also stopped short of what they name. The delegation one
leaned on `verify_delegation`, which builds the message it checks from whatever
the reply carries — drop the targets on both sides and the signature still
verifies — so the scope and permissions are now asserted outright. The
successor-collision one re-signed only one of the two signatures, so the key
proof failed first and `SuccessorAlreadyInUse` was never reached.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LVi99RYo2jyi2kCurgovNJ
`a_refresh_for_a_device_the_anchor_never_registered_still_stamps_the_session`
built its session with `storage_with_session`, which calls `create_session` and
so registers a browser — leaving it a duplicate of the registered-browser
refresh above it, under a name claiming the opposite.

The state it named is unreachable. A browser is given up only at `MAX_BROWSERS`
in `resolve_browser`; the write gate sweeps that browser's sessions in the same
write, and `sync_session_index` takes their index entries with them. The session
is gone too, so a mint stops at `NoSuchSession` in `find_caller_session` long
before the stamp is reached.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LVi99RYo2jyi2kCurgovNJ
An error occurred while trying to automatically change base from feat/revoke-sessions-from-settings to feat/app-revoke-session September 10, 2026 11:49
@sea-snake
sea-snake removed this pull request from stack #4326 September 10, 2026 12:55
@sea-snake
sea-snake changed the base branch from feat/revoke-sessions-from-settings to main September 10, 2026 12:55
@sea-snake
sea-snake added this pull request to stack #4328 September 10, 2026 12:55
@sea-snake sea-snake closed this Sep 10, 2026
@sea-snake sea-snake reopened this Sep 10, 2026
@sea-snake
sea-snake merged commit 2c1126e into main Sep 10, 2026
78 checks passed
@sea-snake
sea-snake deleted the fe/authorization-request-queue branch September 10, 2026 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature:revocable-app-sessions Design: revocable app sessions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants