Skip to content

fix(fetchkit): re-sign bot-auth headers on redirect hops#123

Merged
chaliy merged 2 commits into
mainfrom
2026-05-17-fix-bot-auth-signature-replay-vulnerability
May 17, 2026
Merged

fix(fetchkit): re-sign bot-auth headers on redirect hops#123
chaliy merged 2 commits into
mainfrom
2026-05-17-fix-bot-auth-signature-replay-vulnerability

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented May 17, 2026

Motivation

  • Prevent replay/leakage of bot-auth Signature/Signature-Input headers that were generated once for the initial authority and forwarded unchanged to subsequent redirect hops, which can expose replayable credentials to cross-host redirects.

Description

  • Stop precomputing and attaching bot-auth headers before manual redirect handling in fetch() and fetch_to_file() by removing the one-time apply_bot_auth_if_enabled(...) calls there.
  • Recompute and apply bot-auth headers per hop inside send_request_following_redirects() by calling apply_bot_auth_if_enabled(headers.clone(), options, &current_url) before building the reqwest client for each request.
  • Preserve non-bot-auth behavior and keep changes feature-gated so behavior is unchanged when the bot-auth feature is disabled.

Testing

  • Ran cargo test -p fetchkit --features bot-auth and all crate tests passed, including bot_auth unit tests and fetchers::default tests that assert headers are sent (10 tests ran and passed).
  • Ran cargo fmt --all with no formatting issues.

Codex Task

@chaliy chaliy merged commit 23b9e43 into main May 17, 2026
11 checks passed
@chaliy chaliy deleted the 2026-05-17-fix-bot-auth-signature-replay-vulnerability branch May 17, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant