fix(auth0-express-api): default scopesInclude match to 'all'#24
Open
frederikprijck wants to merge 1 commit into
Open
fix(auth0-express-api): default scopesInclude match to 'all'#24frederikprijck wants to merge 1 commit into
frederikprijck wants to merge 1 commit into
Conversation
Aligns the default with express-openid-connect's claimIncludes (.every)
and the sibling requiresAuth({ scopes }) check, so listing multiple
scopes requires all of them by default. Opt into OR semantics with
{ match: 'any' }.
SECURITY: SDK-1 — weak-by-default authorization (CWE-285).
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
scopesInclude('read:admin write:admin')previously defaulted tomatch:'any', authorizing a request holding at least one of the listed scopes. A developer listing several scopes most often intends all are required, and the siblingrequiresAuth({ scopes })already uses.every— so the two APIs silently disagreed.Changes
matchchanged from'any'→'all'. Opt into OR semantics with{ match: 'any' }.express-openid-connect'sclaimIncludes(uses.every()) and the siblingrequiresAuth.Breaking change — acceptable in beta. Consumers relying on the old OR default must now pass
{ match: 'any' }.Tests
scopes-include.spec.tsrewritten to assert the new default (a token with only some required scopes is now rejected); explicit{ match: 'any' }opt-in covered. Full auth0-express-api suite: 88/88 pass.