Skip to content

fix(oidc-proxy): validate exp independently of MAX_TOKEN_AGE_SECONDS (#8832)#8904

Open
bzqzheng wants to merge 1 commit intoaaif-goose:mainfrom
bzqzheng:fix/oidc-proxy-exp-bypass
Open

fix(oidc-proxy): validate exp independently of MAX_TOKEN_AGE_SECONDS (#8832)#8904
bzqzheng wants to merge 1 commit intoaaif-goose:mainfrom
bzqzheng:fix/oidc-proxy-exp-bypass

Conversation

@bzqzheng
Copy link
Copy Markdown
Contributor

Problem

When MAX_TOKEN_AGE_SECONDS is configured, the exp validation in oidc-proxy/src/index.js lives inside an else if branch that is only reached when MAX_TOKEN_AGE_SECONDS is not set. As a result, a validly-signed but expired token is accepted as long as it is within the max-age window.

Fix

Split the two checks into independent if statements so both must pass:

  • Token must not exceed MAX_TOKEN_AGE_SECONDS (when configured)
  • Token must not be past its exp claim

Test

Updated the existing test that inadvertently documented the bypass behavior. The test now correctly asserts that an expired token is rejected (401 "Token expired") even when it falls within MAX_TOKEN_AGE_SECONDS.

All 8 unit tests pass:

npm test
 ✓ test/index.test.js (8 tests) 70ms

Checklist

  • Fix implemented
  • Unit test updated to cover the bypass case
  • DCO sign-off on commit

Fixes #8832

When MAX_TOKEN_AGE_SECONDS was configured, the exp check was inside an
else-if branch and was never evaluated. This allowed validly-signed but
expired tokens to be accepted as long as they were within the max-age
window.

Split the two checks into independent if statements so both must pass.

Fixes aaif-goose#8832

Signed-off-by: Bright Zheng <bzqzheng@gmail.com>
@bzqzheng bzqzheng marked this pull request as ready for review April 29, 2026 16:24
Bojun-Vvibe added a commit to Bojun-Vvibe/oss-contributions that referenced this pull request Apr 29, 2026
- aaif-goose/goose#8916 fix(bedrock): cache trailing message for stable prefix across agent turns (merge-as-is)
- aaif-goose/goose#8904 fix(oidc-proxy): validate exp independently of MAX_TOKEN_AGE_SECONDS (merge-as-is — security fix with test inversion in same commit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Security] High: OIDC proxy MAX_TOKEN_AGE_SECONDS bypasses exp check (expired token replay)

1 participant