Skip to content

test: remove live Google JWKS call from JwtBearerTokenTest#24486

Merged
netroms merged 1 commit into
masterfrom
jwt-test-offline_master
Jul 20, 2026
Merged

test: remove live Google JWKS call from JwtBearerTokenTest#24486
netroms merged 1 commit into
masterfrom
jwt-test-offline_master

Conversation

@netroms

@netroms netroms commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

JwtBearerTokenTest.testExpiredToken cleared the local JwtDecoder and replayed a real (long-expired) Google id_token, forcing JwtDecoders.fromIssuerLocation to perform live OIDC discovery plus a JWKS fetch of https://www.googleapis.com/oauth2/v3/certs on every CI run. Any egress blip failed the build:

JwtBearerTokenTest.testExpiredToken ... com.nimbusds.jose.RemoteKeySourceException:
  I/O error on GET request for "https://www.googleapis.com/oauth2/v3/certs": Connection reset

External requests do not belong in the automated CI build.

What changed (test-only)

  • testExpiredToken now mints a locally-signed token with a fixed past exp and asserts the actual expiry error (Jwt expired at …). Previously the asserted message was a key-not-found error caused by Google having long rotated the 2021 signing key out of its JWKS — token expiry was never actually exercised.
  • New testUnknownSigningKey preserves the original intent (a token signed with a key the server no longer accepts, e.g. ephemeral signing keys after a restart) fully offline: an RS384-signed token against the RS256 local decoder produces the same error message the old test relied on Google's key rotation to trigger.
  • Removed the now-unused Google token, client id, and provider setup.

No production code affected.

Verification

  • Reproduced first: with network egress blocked, the old test fails with the CI error (I/O error on GET request for "https://accounts.google.com/.well-known/openid-configuration").
  • After the change: the full test class passes 7/7 both with egress blocked and with normal network, proving zero external calls remain.

AI Assisted

JwtBearerTokenTest.testExpiredToken cleared the local JwtDecoder and
replayed a real (long-expired) Google id_token, forcing
JwtDecoders.fromIssuerLocation to perform live OIDC discovery and a
JWKS fetch of https://www.googleapis.com/oauth2/v3/certs on every CI
run. Any egress blip failed the build (RemoteKeySourceException).

Rewrite the test to run fully offline using the existing local RSA
fixtures: testExpiredToken now mints a locally-signed token with a
fixed past exp and asserts the actual expiry error, and a new
testUnknownSigningKey preserves the original intent (token signed
with a key/algorithm the server does not accept) by signing with
RS384 against the RS256 decoder, asserting the same error message the
old test relied on Google's key rotation to produce. The unused
Google token, client id and provider setup are removed. Test-only
change; no production code affected.
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.53%. Comparing base (9ad2958) to head (e33d646).
⚠️ Report is 11 commits behind head on master.

Additional details and impacted files
@@              Coverage Diff              @@
##             master   #24486       +/-   ##
=============================================
+ Coverage     30.40%   69.53%   +39.12%     
+ Complexity     1196      728      -468     
=============================================
  Files          3679     3711       +32     
  Lines        142430   143877     +1447     
  Branches      16619    16775      +156     
=============================================
+ Hits          43308   100040    +56732     
+ Misses        94894    36131    -58763     
- Partials       4228     7706     +3478     
Flag Coverage Δ
integration 50.14% <ø> (+19.74%) ⬆️
integration-h2 28.06% <ø> (?)
unit 35.44% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 2211 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c3320e5...e33d646. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@netroms
netroms merged commit 9a14735 into master Jul 20, 2026
25 checks passed
@netroms
netroms deleted the jwt-test-offline_master branch July 20, 2026 13:41
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.

3 participants