Skip to content

Harden OpenID key handling - #32

Merged
ievgeniiskliarenko merged 3 commits into
masterfrom
jwt/openid-hardening
Oct 2, 2026
Merged

ievgeniiskliarenko merged 3 commits into
masterfrom
jwt/openid-hardening

Conversation

@ievgeniiskliarenko

@ievgeniiskliarenko ievgeniiskliarenko commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor
  • Reject JWTs whose algorithm differs from the signing key.
  • Refetch OpenID keys only for an unknown key id, not on every failed verification.
  • Optional $minLoadInterval on OpenIdCachingKeyStore throttles issuer calls and keeps the cached keys when the issuer is down. Default 0 keeps the current behaviour.

@ievgeniiskliarenko ievgeniiskliarenko changed the title Jwt/openid hardening Harden OpenID key handling Oct 1, 2026
@ievgeniiskliarenko
ievgeniiskliarenko requested a balanced review from Copilot October 1, 2026 20:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The throttle is non-atomic and does not safely handle cache-write failures, allowing issuer call bursts or temporary key-loading outages.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Hardens OpenID JWT verification and adds optional issuer-load throttling.

Changes:

  • Enforces JWT/key algorithm matching.
  • Refreshes keys only for unknown key IDs.
  • Adds configurable key-load throttling and related tests.
File Description
tests/​JWT/​Algorithms/​OpenIdCachingTest.php Tests selective refresh behavior.
tests/​JWT/​Algorithms/​JWKSTest.php Tests key and algorithm rejection.
tests/​JWK/​Store/​OpenIdCachingKeyStoreTest.php Tests caching and throttling.
src/​JWT/​VerificationFailed.php Adds unknown-key failure code.
src/​JWT/​Algorithms/​OpenIdCaching.php Restricts refresh retries.
src/​JWT/​Algorithms/​JWKS.php Enforces key algorithm and classifies missing keys.
src/​JWK/​Store/​OpenIdCachingKeyStore.php Implements minimum load intervals.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread vicephp/Virtue-JWT/src/JWK/Store/OpenIdCachingKeyStore.php
@ievgeniiskliarenko
ievgeniiskliarenko marked this pull request as ready for review October 1, 2026 21:07
@ievgeniiskliarenko
ievgeniiskliarenko merged commit 0960ba0 into master Oct 2, 2026
3 checks passed
@ievgeniiskliarenko
ievgeniiskliarenko deleted the jwt/openid-hardening branch October 2, 2026 05:57
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.

4 participants