Skip to content

fix(auth): infer RS256 from RSA+sig when JWK alg is missing#65

Open
AdvenRanises wants to merge 1 commit into
EpicGames:mainfrom
AdvenRanises:fix/entra-jwks-alg-inference
Open

fix(auth): infer RS256 from RSA+sig when JWK alg is missing#65
AdvenRanises wants to merge 1 commit into
EpicGames:mainfrom
AdvenRanises:fix/entra-jwks-alg-inference

Conversation

@AdvenRanises

@AdvenRanises AdvenRanises commented Jun 24, 2026

Copy link
Copy Markdown

Fixes #60.

Microsoft Entra ID JWKS endpoints cause the Lore Server to fail on startup with a generic "Internal Error" because Entra omits the optional "alg" field from its JWKS keys. The current implementation incorrectly treats "alg" as required, causing valid JWKS documents to be rejected without any useful error message.

This change falls back to "RS256" for RSA keys when "alg" is missing and replaces the generic "InternalError" with a descriptive "MissingAlgorithm { kid }" error when the algorithm cannot be determined.

Verified with "cargo check -p lore-server --lib". Existing providers continue to work, and Microsoft Entra JWKS endpoints now load successfully.

RFC 7517 defines alg as OPTIONAL. Microsoft Entra omits it from JWKS keys.
This change infers RS256 for RSA keys with use=sig, and replaces the
opaque InternalError with a descriptive MissingAlgorithm error.

Signed-off-by: AdvenRanises <evanderranises@gmail.com>
@AdvenRanises AdvenRanises force-pushed the fix/entra-jwks-alg-inference branch from 43c164a to 2361dc2 Compare June 24, 2026 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Server crashes with opaque Internal Error on startup when [server.auth.jwk].endpoint points at a Microsoft Entra (Azure AD) JWKS

1 participant