Skip to content

test(oidc): publish a real signing alg in the test JWKS - #4986

Open
rasty94 wants to merge 1 commit into
dexidp:masterfrom
rasty94:fix/oidc-test-jwks-alg
Open

test(oidc): publish a real signing alg in the test JWKS#4986
rasty94 wants to merge 1 commit into
dexidp:masterfrom
rasty94:fix/oidc-test-jwks-alg

Conversation

@rasty94

@rasty94 rasty94 commented Aug 26, 2026

Copy link
Copy Markdown

What

The OIDC connector's test key set publishes "RSA" as both alg and kty:

jwk := jose.JSONWebKey{
    Key:       key,
    KeyID:     "keyId",
    Algorithm: "RSA",
}
...
"alg": jwk.Algorithm,
"kty": jwk.Algorithm,

RSA is a key type, not a signing algorithm, and newToken signs with jose.RS256, so the advertised alg is simply wrong.

Why it matters now

go-oidc tolerated the mismatch until v3.20.0, which ignores JWKs with unknown signing algorithms rather than failing. A key advertising alg: "RSA" is no longer an error — it is silently skipped, which leaves the verifier with no usable key at all:

--- FAIL: TestHandleCallback/simpleCase
    oidc_test.go:580: handle callback failed oidc: failed to verify ID Token: failed to verify signature: failed to verify id token signature
--- FAIL: TestRefresh
--- FAIL: TestTokenIdentity

Reproduced on current master with go get github.com/coreos/go-oidc/v3@v3.20.0. This will land the moment the go-oidc bump does.

The change

Publish RS256 as the algorithm and RSA as the key type. Test-only, no production code touched.

Verified passing on both go-oidc v3.19.0 (current pin) and v3.20.0.

The test key set published "RSA" as both "alg" and "kty". "RSA" is a key
type, not a signing algorithm, and the tokens are signed with RS256, so the
"alg" was simply wrong.

It went unnoticed because go-oidc used to ignore the mismatch. Since v3.20.0
it skips keys whose "alg" it does not recognise instead of failing the whole
key set (coreos/go-oidc#491), which leaves the verifier with no usable key and
fails every test that verifies an ID token:

    failed to verify signature: failed to verify id token signature

Publishing RS256 as the algorithm and RSA as the key type fixes the fixture
and passes on both v3.19.0 and v3.20.0.
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.

1 participant