Repository navigation
🔩 refactor: Share OpenID Issuer Matching and Cache Expiry Helpers - #18434
AtefBellaaj wants to merge 1 commit into
Conversation
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Move isOpenIdIssuerMatch into packages/api so the JWT strategy and the back-channel logout code share one issuer comparison. The single-use cache read now returns the entry with its expiry, and restoreCacheEntry puts an entry back with its remaining TTL. Related to AI-2415.
ce04ffd to
0202a65
Compare
|
/quality check.all |
|
Quality request was not started. Use |
|
/quality check-all |
Quality reportGate: open. The selected checks completed. Scores and risk levels are advisory. Status: completed (success). Actions run, attempt 1.
Change riskTakeaway: Every changed line has a test. Highest CRAP among changed functions:
Refactor hints (highest CRAP first)
CRAP = complexity² × (1 − coverage)³ + complexity Jobs (2)
All data ( The gate opens only when the workflow, source selection, tooling verification, and every report job succeed. A report job fails on a failed test in its workspace's own Jest run, a tool error, a job timeout, or an incomplete mutation report, including a mutation shard that reaches its execution budget. A cancelled workflow keeps the gate closed. Scores are advisory. A change-risk file marked incomplete or unavailable, for example by a failed |
danny-avila
left a comment
There was a problem hiding this comment.
Reviewed as part of the full stack. No issues found here.
Pull Request
Summary
Part 1 of 9 in the OpenID back-channel logout stack. It is based on
dev, and #18435 builds on it.Two small helpers that back-channel logout needs are not reusable today. The OpenID issuer match lives as private code inside
api/strategies/openIdJwtStrategy.js, so the logout receiver cannot use the same rule. The single-use cache read (consumeCacheEntry) returns only the value, so a caller that consumes an entry and then fails cannot put the entry back with its remaining lifetime.This PR moves the issuer match into
packages/api/src/auth/openid.tsasisOpenIdIssuerMatch, and the JWT strategy now calls it.consumeCacheEntrynow returns{ value, expires }, and a newrestoreCacheEntryputs a consumed entry back. The only current caller,exchangeAdminCode, readsconsumed.value. Runtime behavior does not change.How it works
The JWT strategy drops its private copy and delegates to the shared helper. The helper keeps the same rules: an exact match after normalization, or a
{tenantid}template match against one path segment (Microsoft Entra).restoreCacheEntrygives back only the time the entry had left. It does nothing for an entry that already expired, because Keyv reads a TTL of 0 as "never expires".Type of change
Testing
Tested environments/configuration:
No configuration needed. The change has no runtime effect.
Automated tests:
packages/api/src/auth/openid.spec.tsfor exact, normalized and{tenantid}template issuer matches.packages/api/src/cache/consume.spec.tscases for the returned expiry and for restore with a known, unknown and past expiry.api/strategies/openIdJwtStrategy.spec.js.Screenshots / recordings
No user-facing change.
Risk / compatibility
consumeCacheEntrychanges its return type.exchangeAdminCodeis its only caller, and this PR updates it.Checklist