fix: reject unauthorized token scope#1769
Open
LeonRuggiero wants to merge 7 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Why
Account and project values can come from URL parameters or persisted browser selection. Combining a project supplied by the URL with an account supplied only by localStorage can create an invalid cross-account scope. Project-only URLs now remain project-only, allowing STS to resolve the authorized owning account without inheriting unrelated browser state.
When STS rejects an inconsistent or inaccessible scope, token acquisition remains strict: the rejected request is attempted once and remains visible to the user. The shared session package removes only the rejected browser state so a reload or other explicit retry can recover without clearing all site data or silently entering a personal/default organization.
For a rejected account/project pair, the account is retained and only the project is removed. For a rejected account-only request, the account and its associated project entry are removed.
Test Plan
pnpm --filter @vertesia/ui test -- src/session/auth/composable.test.ts(39 files, 447 tests)pnpm --filter @vertesia/ui lintpnpm --filter @vertesia/ui typecheck:testpnpm --filter @vertesia/ui build@dglabs/composable-uibuild (14 tasks)