Skip to content

🔒 oidc: fix scope accumulation in loadExistingGrant - #1988

Open
douglasduteil wants to merge 1 commit into
mainfrom
douglasduteil/oidc-fix-scope-accumulation-in-loadExistingGrant
Open

🔒 oidc: fix scope accumulation in loadExistingGrant#1988
douglasduteil wants to merge 1 commit into
mainfrom
douglasduteil/oidc-fix-scope-accumulation-in-loadExistingGrant

Conversation

@douglasduteil

Copy link
Copy Markdown
Contributor

Problem

addOIDCScope and addOIDCClaims are additive — scopes from prior
authorization requests (e.g. organization, siret) were retained on
the existing grant even when a subsequent request no longer included
them. This caused affiliation data (employer label, SIRET) to leak to
clients that no longer requested the organization scope.

Proposal

Always create a fresh grant so scopes/claims reflect exactly what the
current request asks for. The existing grant is still looked up, but
only to preserve its expiry and keep it aligned with the session TTL.

@rdubigny

Copy link
Copy Markdown
Contributor

@douglasduteil
douglasduteil force-pushed the douglasduteil/oidc-fix-scope-accumulation-in-loadExistingGrant branch from f5a53aa to ee34215 Compare June 11, 2026 14:55
**Problem**

`addOIDCScope` and `addOIDCClaims` are additive — scopes from prior
authorization requests (e.g. `organization`, `siret`) were retained on
the existing grant even when a subsequent request no longer included
them. This caused affiliation data (employer label, SIRET) to leak to
clients that no longer requested the `organization` scope.

**Proposal**

Always create a fresh grant so scopes/claims reflect exactly what the
current request asks for. The existing grant is still looked up, but
only to preserve its expiry and keep it aligned with the session TTL.
@douglasduteil
douglasduteil force-pushed the douglasduteil/oidc-fix-scope-accumulation-in-loadExistingGrant branch from ee34215 to 4e907ef Compare June 17, 2026 08:12
@rdubigny

rdubigny commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

@douglasduteil, I wanted to add tests for scenarios that were used to implement loadExistingGrant, but were not written down as tests at the time.

Scenario 1

The user is not prompted for consent:

  • even if the prompt=consent parameter is sent;
  • in a scenario where SP1 requests some scopes, then SP2 requests some other scopes.

Scenario 2

oidc-provider’s Grant expiration has no influence on oidc-provider’s Session still being active.

This issue is described here: panva/node-oidc-provider#1202

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants