Skip to content

feat: add RedirectPlan for validating and following redirects - #13901

Merged
algebraic-dev merged 41 commits into
masterfrom
sofia/async-http-redirect-plan
Jul 23, 2026
Merged

feat: add RedirectPlan for validating and following redirects#13901
algebraic-dev merged 41 commits into
masterfrom
sofia/async-http-redirect-plan

Conversation

@algebraic-dev

Copy link
Copy Markdown
Member

This PR adds a RedirectPlan type that uses the RFC9110 logic to validate redirect responses and automatically redirect.

@algebraic-dev algebraic-dev self-assigned this May 30, 2026
@algebraic-dev
algebraic-dev requested a review from TwoFX as a code owner May 30, 2026 13:11
@algebraic-dev
algebraic-dev changed the base branch from master to sofia/async-http-replayable-body May 30, 2026 13:12
@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label May 30, 2026
@mathlib-lean-pr-testing

mathlib-lean-pr-testing Bot commented May 30, 2026

Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase b5f7399bf19d623b3a5171732f1b3e617cfac38f --onto c47a0c7cf035381a2bcdd4cdf2442782eb4a5214. You can force Mathlib CI using the force-mathlib-ci label. (2026-05-30 14:01:45)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase b5f7399bf19d623b3a5171732f1b3e617cfac38f --onto 9e0092d0f0ef62de06235b67023f4b6621151116. You can force Mathlib CI using the force-mathlib-ci label. (2026-06-05 16:34:51)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase ab122a187d64224faf53004c9631f664b852bb96 --onto 659e8bb858995b0a1ada239c5b3819c8f8f2772f. You can force Mathlib CI using the force-mathlib-ci label. (2026-06-15 17:17:45)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase ab122a187d64224faf53004c9631f664b852bb96 --onto 4792cd22887c8b529a351f6563b693426ff2a8f8. You can force Mathlib CI using the force-mathlib-ci label. (2026-06-18 13:41:11)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase ab122a187d64224faf53004c9631f664b852bb96 --onto ab9722836dea9e2f5ca3157f14cc1460454b3a67. You can force Mathlib CI using the force-mathlib-ci label. (2026-06-23 12:55:46)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase ab122a187d64224faf53004c9631f664b852bb96 --onto 0758b1d2e33c65ccea578abb0c668aab1f811608. You can force Mathlib CI using the force-mathlib-ci label. (2026-06-25 14:28:40)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase d5790c1f088236fe67b52500ff87bce2c848b0bb --onto 3259610687883ec1ea48c481aba2469f2f83facf. You can force Mathlib CI using the force-mathlib-ci label. (2026-07-21 21:20:50)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 943e616509e287b7055c0571e11dba6cbb8c9b3b --onto 3259610687883ec1ea48c481aba2469f2f83facf. You can force Mathlib CI using the force-mathlib-ci label. (2026-07-22 00:47:09)

@leanprover-bot

leanprover-bot commented May 30, 2026

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase b5f7399bf19d623b3a5171732f1b3e617cfac38f --onto 803553a556fd82fa1060efb0c43eda542130cb16. You can force reference manual CI using the force-manual-ci label. (2026-05-30 14:01:46)
  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase ab122a187d64224faf53004c9631f664b852bb96 --onto 803553a556fd82fa1060efb0c43eda542130cb16. You can force reference manual CI using the force-manual-ci label. (2026-06-15 17:17:46)
  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase ab122a187d64224faf53004c9631f664b852bb96 --onto 2e72131c7f007ab9d2538b676106c5141b24ba22. You can force reference manual CI using the force-manual-ci label. (2026-06-25 14:28:42)
  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase d5790c1f088236fe67b52500ff87bce2c848b0bb --onto 49ff95727f98d43984726b26742d17a1ceea9dd5. You can force reference manual CI using the force-manual-ci label. (2026-07-21 21:20:52)
  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 943e616509e287b7055c0571e11dba6cbb8c9b3b --onto 49ff95727f98d43984726b26742d17a1ceea9dd5. You can force reference manual CI using the force-manual-ci label. (2026-07-22 00:47:10)

Comment thread src/Std/Http/Protocol/H1/Redirect.lean Outdated
@algebraic-dev
algebraic-dev force-pushed the sofia/async-http-redirect-plan branch from dbd4cc6 to ee33e6e Compare June 5, 2026 13:52
@algebraic-dev
algebraic-dev force-pushed the sofia/async-http-redirect-plan branch from ee33e6e to 03468f6 Compare June 5, 2026 14:00
@algebraic-dev
algebraic-dev force-pushed the sofia/async-http-redirect-plan branch from a42f923 to f8ecc1c Compare June 5, 2026 14:37
Comment on lines +366 to +370
let scrubbed := RedirectPlan.scrubHeaders request.headers isCrossOrigin methodChanged
let newHeaders :=
if isCrossOrigin then
RedirectPlan.rewriteHostHeader scrubbed newOrigin
else scrubbed

@ecyrbe ecyrbe Jun 14, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really great. It's usually one of the big security issues when issuing redirections.
This is so important for security that i wonder if some proof of adherance to spec could be added just for this ?

@algebraic-dev algebraic-dev removed the changes-stage0 Contains stage0 changes, merge manually using rebase label Jun 15, 2026
Comment thread src/Std/Http/Internal/IndexMultiMap.lean Outdated
Comment thread src/Std/Http/Protocol/H1/Redirect.lean Outdated
Comment thread src/Std/Http/Protocol/H1/Redirect.lean Outdated
Comment thread src/Std/Http/Protocol/H1/Redirect.lean Outdated
Comment thread src/Std/Http/Protocol/H1/Redirect.lean Outdated
Comment thread src/Std/Http/Protocol/H1/Redirect.lean Outdated
@algebraic-dev
algebraic-dev changed the base branch from sofia/async-http-replayable-body to master July 22, 2026 00:20
@algebraic-dev
algebraic-dev added this pull request to the merge queue Jul 23, 2026
Merged via the queue into master with commit 202c791 Jul 23, 2026
17 checks passed
robsimmons pushed a commit that referenced this pull request Jul 29, 2026
This PR adds a `RedirectPlan` type that uses the RFC9110 logic to
validate redirect responses and automatically redirect.

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-library Library toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants