Fix #28038: Reject multiple Authorization headers with 400 Bad Request#8164
Fix #28038: Reject multiple Authorization headers with 400 Bad Request#8164kavix wants to merge 5 commits into
Conversation
|
Warning Review limit reached
More reviews will be available in 23 minutes and 57 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesDuplicate Authorization Header Rejection
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/context/valve/IdentityContextCreatorValve.java`:
- Around line 52-60: The code in IdentityContextCreatorValve detects multiple
Authorization headers and sends a 400 error response via sendError, but this
security-relevant path has no logging. Add a WARN or DEBUG level log message
before the sendError call (which occurs when authHeaderCount > 1) to signal that
multiple Authorization headers were detected. The log message should be generic,
such as "multiple Authorization headers detected", and must not include the
actual header values, exceptions, or stack traces to avoid logging sensitive
information.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 7e39fee8-ef4a-4db5-8303-998b65ee3b5b
📒 Files selected for processing (1)
components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/context/valve/IdentityContextCreatorValve.java
|
Hi @pavinduLakshan, |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/context/valve/IdentityContextCreatorValve.java`:
- Around line 61-64: The early return statement in the multiple Authorization
headers check (when authHeaderCount > 1) bypasses the identity context cleanup
code that should execute on every request path. Move the duplicate header
validation logic inside the try block or restructure the code so that the
identity context cleanup at line 79 (in the finally block) is guaranteed to
execute even when rejecting requests with multiple Authorization headers. This
ensures thread-local identity context is properly cleared regardless of whether
the request is rejected due to duplicate headers or completes normally.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 03b9adb5-ac36-48ec-b3eb-2eae59b3a8e9
📒 Files selected for processing (1)
components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/context/valve/IdentityContextCreatorValve.java
|



This PR fixes wso2/product-is#28038 by rejecting incoming HTTP requests containing more than one Authorization header with a 400 Bad Request response code. This ensures compliance with RFC 9110 §11.6.1 and prevents potential security validation bypasses.