fix: omit client_secret in refresh token grant when client has no secret - #7042
Conversation
|
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: 6 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 10 reviews per hour. 📝 SummarySummary by CodeRabbit
WalkthroughThe refresh-token exchange now sends ChangesOAuth2 refresh-token authentication
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The refresh-token change supports public OAuth clients without changing confidential-client authentication behavior. No unresolved merge-blocking issue is identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
84d8785 to
656694e
Compare
4f60da7 to
24cbc19
Compare
656694e to
a33d882
Compare
a33d882 to
9ca194f
Compare
1b141bd to
83b798d
Compare
9ca194f to
3fcb44b
Compare
The base branch was changed.
|
@coderabbitai full-review |
|
✅ Action performedFull review finished. |
Merge activity
|

Summary
Public OAuth2 clients (e.g. those registered via dynamic registration against servers that only support
token_endpoint_auth_method: none) have no client secret. During token refresh, unconditionally settingclient_secret=in the POST body sends an emptyclient_secret_postauthentication attempt. Strict authorization servers respond withinvalid_client, which causes the token row to be flipped toneeds_reautheven though the refresh token itself is valid.Changes
exchangeRefreshTokennow only includesclient_secretin the token endpoint request when the secret is non-empty, matching the existing behavior ofexchangeCodeForTokensWithPKCE.TestRefresh_ClientSecretOnlySentWhenConfiguredto assert that public clients (nil/empty secret) omit theclient_secretparameter entirely, while confidential clients continue to send their secret.Type of change
Affected areas
How to test
go test ./framework/oauth2/... -run TestRefresh_ClientSecretOnlySentWhenConfigured -vExpected: both sub-tests pass — the public client case confirms
client_secretis absent from the request, and the confidential client case confirms the secret is present with the correct value.Breaking changes
Related issues
Security considerations
This change ensures that no empty
client_secretis leaked in token endpoint requests for public clients. Confidential clients are unaffected and continue to send their secret as before.Checklist
docs/contributing/README.mdand followed the guidelines