Skip to content

[WRONG BRANCH] fix(server): strip passthrough redirect Location to prevent credential replay - #33

Draft
luvs01 wants to merge 1 commit into
mainfrom
codex/propose-fix-for-passthrough-redirect-vulnerability
Draft

[WRONG BRANCH] fix(server): strip passthrough redirect Location to prevent credential replay#33
luvs01 wants to merge 1 commit into
mainfrom
codex/propose-fix-for-passthrough-redirect-vulnerability

Conversation

@luvs01

@luvs01 luvs01 commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Forward-mode passthrough relayed upstream 3xx responses with their Location header, which can cause clients that follow redirects to replay request bodies and custom admission headers (including X-OpenCodex-API-Key) to attacker-controlled hosts. This is a high-severity data-plane credential exposure.

Description

  • Drop Location from the passthrough header sanitizer by adding it to the DROP set in src/server/relay.ts so relayed responses never expose upstream redirect targets.
  • Remove location from the compact passthrough allowlist in src/server/responses/compact.ts so buffered/compact responses also do not expose upstream Location.
  • Update src/server/responses/core.ts to clarify the manual-redirect behavior and to use the sanitizer that no longer exposes Location.
  • Add focused regression tests: adjust the passthrough 307 test in tests/server-auth.test.ts to assert the Location is stripped, and add a compact-path test in tests/errors-adapter-failure.test.ts asserting compact responses do not expose Location.

Testing

  • Ran targeted tests: node_modules/.bin/bun test tests/server-auth.test.ts -t "passthrough pool send strips a 307" and node_modules/.bin/bun test tests/errors-adapter-failure.test.ts, both passed.
  • Ran typecheck: node_modules/.bin/bun run typecheck, which passed.
  • Ran privacy scan: node_modules/.bin/bun run privacy:scan, which passed.
  • Ran the full test script in this environment; the broad integration suite encountered unrelated environment-dependent failures (external package registry HTTP 403 and Docker/root-specific assertions), so the full-suite run is inconclusive in this environment but the focused regression tests and static checks above passed.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@luvs01, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 11 seconds

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

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, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: cde85861-b25f-4eb0-8915-4cf5598ac0aa

📥 Commits

Reviewing files that changed from the base of the PR and between 2468502 and bcb55d3.

📒 Files selected for processing (5)
  • src/server/relay.ts
  • src/server/responses/compact.ts
  • src/server/responses/core.ts
  • tests/errors-adapter-failure.test.ts
  • tests/server-auth.test.ts

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot changed the title fix(server): strip passthrough redirect Location to prevent credential replay [WRONG BRANCH] fix(server): strip passthrough redirect Location to prevent credential replay Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

⏳ DRAFT

  • wrong target branch (main); retarget to dev.

What to do

  • Retarget this PR to dev — all contributions go to dev.

Its title has been prefixed with [WRONG BRANCH].
This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.

@github-actions
github-actions Bot marked this pull request as draft August 7, 2026 06:28
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aardvark bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant