feat(core): enforce application access during OIDC flows#8882
Merged
charIeszhao merged 7 commits intoJun 2, 2026
Merged
Conversation
COMPARE TO
|
| Name | Diff |
|---|---|
| packages/core/src/libraries/application-access-control.test.ts | 📈 +380 Bytes |
| packages/core/src/libraries/application-access-control.ts | 📈 +65 Bytes |
| packages/core/src/libraries/session/consent.test.ts | 📈 +1 KB |
| packages/core/src/libraries/session/consent.ts | 📈 +535 Bytes |
| packages/core/src/libraries/session/session-context.test.ts | 📈 +29 Bytes |
| packages/core/src/middleware/koa-app-access-control.test.ts | 📈 +3.88 KB |
| packages/core/src/middleware/koa-app-access-control.ts | 📈 +1.24 KB |
| packages/core/src/middleware/koa-auto-consent.ts | 📈 +196 Bytes |
| packages/core/src/middleware/koa-consent-guard.test.ts | 📈 +395 Bytes |
| packages/core/src/middleware/koa-consent-guard.ts | 📈 +103 Bytes |
| packages/core/src/oidc/application-access-control.ts | 📈 +2.02 KB |
| packages/core/src/oidc/grants/index.ts | 📈 +160 Bytes |
| packages/core/src/oidc/grants/refresh-token.test.ts | 📈 +741 Bytes |
| packages/core/src/oidc/grants/refresh-token.ts | 📈 +334 Bytes |
| packages/core/src/oidc/grants/token-exchange/index.test.ts | 📈 +981 Bytes |
| packages/core/src/oidc/grants/token-exchange/index.ts | 📈 +349 Bytes |
| packages/core/src/oidc/init.test.ts | 📈 +5.46 KB |
| packages/core/src/oidc/init.ts | 📈 +1.15 KB |
| packages/core/src/routes/interaction/consent/index.ts | 📈 +161 Bytes |
| packages/core/src/tenants/Tenant.ts | 📈 +236 Bytes |
| packages/integration-tests/src/api/application.ts | 📈 +310 Bytes |
| packages/integration-tests/src/client/index.ts | 📈 +83 Bytes |
| packages/integration-tests/src/tests/api/application-access-control.test.ts | 📈 +5.39 KB |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enforces application-level access control across several OIDC flow touchpoints (consent handling, loading existing grants, and token issuance via refresh token / token exchange), building on the access evaluator introduced in #8879.
Changes:
- Enforce application access before consent auto-completion and before persisting consent grants.
- Enforce application access when loading an existing authorization grant in OIDC.
- Enforce application access before issuing tokens from refresh-token and token-exchange grants, with new unit tests.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/tenants/Tenant.ts | Adds app-access-control middleware into the experience consent route pipeline. |
| packages/core/src/routes/interaction/consent/index.ts | Passes applicationAccessControl into consent() calls. |
| packages/core/src/oidc/init.ts | Adds loadExistingGrant hook + wires libraries into registerGrants. |
| packages/core/src/oidc/grants/index.ts | Extends registerGrants signature to pass applicationAccessControl into grant handlers. |
| packages/core/src/oidc/grants/refresh-token.ts | Enforces app access before refresh token rotation. |
| packages/core/src/oidc/grants/refresh-token.test.ts | Adds unit coverage for access-denied behavior during refresh. |
| packages/core/src/oidc/grants/token-exchange/index.ts | Enforces app access before token continuation is created. |
| packages/core/src/oidc/grants/token-exchange/index.test.ts | Adds unit coverage for access-denied behavior during token exchange. |
| packages/core/src/middleware/koa-auto-consent.ts | Threads libraries into consent() so consent() can enforce app access. |
| packages/core/src/middleware/koa-app-access-control.ts | New middleware to enforce app access for experience /consent route. |
| packages/core/src/middleware/koa-app-access-control.test.ts | Unit tests for the new middleware. |
| packages/core/src/libraries/session/consent.ts | Adds access enforcement before creating/saving consent grant. |
| packages/core/src/libraries/session/consent.test.ts | Updates tests + adds assertion that access check happens before grant save. |
| packages/core/src/libraries/session/session-context.test.ts | Updates consent() invocation with applicationAccessControl dependency. |
| packages/core/src/libraries/application-access-control.ts | Skips enforcement for built-in applications. |
| packages/core/src/libraries/application-access-control.test.ts | Adds coverage for built-in application bypass. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b7a5ded to
cfc78ca
Compare
Contributor
|
Could also introduce some integration tests |
Base automatically changed from
charles-log-13485-implement-core-access-evaluator
to
master
May 28, 2026 01:31
7ecc0f9 to
580180a
Compare
580180a to
adb92a8
Compare
Member
Author
|
Added integration coverage for app-level access enforcement in the consent step and refresh-token exchange, covering the denied-user path and the OAuth |
adb92a8 to
660cd06
Compare
660cd06 to
c1bbd12
Compare
simeng-li
reviewed
Jun 1, 2026
simeng-li
reviewed
Jun 1, 2026
simeng-li
reviewed
Jun 1, 2026
simeng-li
reviewed
Jun 1, 2026
simeng-li
reviewed
Jun 1, 2026
simeng-li
reviewed
Jun 1, 2026
simeng-li
reviewed
Jun 2, 2026
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
Enforce application-level access control during OIDC authorization and token continuation flows. The PR adds enforcement before consent auto-completion, before consent grant persistence, while loading existing authorization grants, and before issuing new tokens from refresh token or token exchange grants.
Testing
Unit tests
Checklist
.changeset