Repository navigation
fix(ema): allow a public resource-AS client in leg 3 - #2736
Merged
Merged
Conversation
mintEmaResourceTokens refused to run without a resource-AS client secret, although redeemIdJagForAccessToken already redeems a public client with token_endpoint_auth_method "none". Drop the secret guard and keep the clientId check, so a resource AS that registers public clients works with EMA. The Resource AS Client Secret field now says it may stay empty for a public client. Tests cover the secretless leg-3 request (client_id in the body, no client_secret, no Authorization header), and the tests that used an empty secret to force a mint failure now use an empty clientId. Closes #2725 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: cliffhall <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix reuses existing public-client support, preserves client-ID validation, and includes relevant regression coverage with no identified blockers.
No open issues 🎉
What changed in this PR
Enables public resource-AS clients in EMA by allowing leg 3 to proceed without a client secret, addressing #2725.
Changes:
- Removes the secret requirement while retaining client-ID validation.
- Clarifies that public clients can leave the secret field empty.
- Adds regression coverage for public-client requests and resource fallback behavior.
| File | Description |
|---|---|
| core/auth/ema/emaFlow.ts | Removes the client-secret guard. |
| clients/web/src/test/core/auth/ema/emaFlow.test.ts | Covers public-client redemption and resource fallback. |
| clients/web/src/components/groups/ServerSettingsForm/ServerSettingsForm.tsx | Adds public-client guidance to the secret field. |
| clients/web/src/components/groups/ServerSettingsForm/ServerSettingsForm.test.tsx | Checks that the new hint appears once. |
Review effort: Balanced
Member
Author
|
Copilot review loop closed: round 1 came back clean (no inline comments, "No open issues", nothing in a Suppressed comments block), so no further rounds were requested. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2725
Problem
mintEmaResourceTokens(core/auth/ema/emaFlow.ts) threw before leg 2 unlessresourceClientSecretwas non-empty. ButredeemIdJagForAccessToken, which runs leg 3, already redeems a public client: it sendstoken_endpoint_auth_method: "none"and noclient_secretwhen no secret is given. So a resource AS that registers clients as public (for example one that forcesnoneat DCR) couldn't be used with EMA. The error also pointed users at xaa.dev.Change
core/auth/ema/emaFlow.ts: removed the secret guard and kept theresourceClientIdcheck. An empty secret now goes down the existingnonepath.token_endpoint_auth_method "none"). The Client ID field's description is unchanged.Tests
client_idin the body, noclient_secret, and noAuthorizationheader.clientIderror instead. Two other tests used an empty secret only to make the mint fail; they now use an emptyclientId.resourceUrl, leg 2 sends the PRMresourceand leg 3 sends none. This branch was never covered. Deleting the guard took a covered branch out ofemaFlow.ts, which dropped the file to 88.88% branch coverage. With this test it is at 94.44%.npm run local:gatepasses.Screenshots
Server Settings → OAuth Settings, with Enterprise-managed authorization turned on (1280×900).
🤖 Generated with Claude Code