Repository navigation
Drop client-supplied x-restate-* headers at the ingress - #4896
tillrohrmann merged 1 commit into
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR prevents clients from spoofing ingress-reserved metadata by stripping any incoming x-restate-* headers before forwarding requests to services, and documents the behavior.
Changes:
- Drop client-supplied
x-restate-*headers in the HTTP ingress handler. - Add a regression test to ensure reserved headers can’t be injected/overridden.
- Add release notes describing the behavioral/security change and migration guidance.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| release-notes/unreleased/4187-ingress-overwrite-x-restate-headers.md | Documents the reserved-header stripping behavior and its user impact. |
| crates/ingress-http/src/handler/tests.rs | Adds regression coverage ensuring x-restate-* isn’t forwarded and ingress sets its own reserved headers. |
| crates/ingress-http/src/handler/service_handler.rs | Implements the actual filtering of x-restate-* headers from incoming requests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I have read the CLA Document and I hereby sign the CLA |
|
@tillrohrmann this is a valid fix, up to you to merge if you wanna push it in 1.7 . Not critical |
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
tillrohrmann
left a comment
There was a problem hiding this comment.
Thanks a lot for creating this PR @pjdurden. The changes look great. I will take care of merging this PR.
| @@ -0,0 +1,29 @@ | |||
| # Release Notes for Issue #4187: Ingress drops client-supplied `x-restate-*` headers | |||
There was a problem hiding this comment.
Could we fold this note into the now existing https://github.com/restatedev/restate/blob/main/release-notes/v1.7.0.md?
There was a problem hiding this comment.
v1.7.0 shipped on Jun 18 without this change, so folding it there would document something that isn't in that release. Left it in unreleased/ to get consolidated into whatever version this lands in, same as the other open notes there.
|
Before merging we need to resolve one open question regarding whether and how these headers are being used by the SaaS offering. |
Sounds good @tillrohrmann . Thanks |
Hi @tillrohrmann, one thing. Did the question about SaaS usage of the x-restate-* headers get resolved? Happy to gate the stripping behind a flag or allowlist if needed. |
|
We didn't resolve it yet on the SaaS side. It shouldn't take super long to fix. Once this happens, I'll merge this PR. Sorry for the delay. |
|
Any movement on the SaaS side? Branch is still clean against main. If it helps unblock, I can put the stripping behind a config flag defaulting to off so SaaS can migrate on its own timeline. |
58c435a to
b6db087
Compare
b6db087 to
0acfd65
Compare
|
Sorry for the slow turnaround @pjdurden. I am looking into including this fix for the upcoming v1.8.0 release. |
pcholakov
left a comment
There was a problem hiding this comment.
This is now safe to merge!
The HTTP ingress forwarded all incoming request headers to the service, including any x-restate-* headers set by the caller. That namespace is reserved for the ingress (e.g. x-restate-ingress-path), so a caller could inject or override reserved metadata. parse_headers now skips any incoming header whose name starts with x-restate-, so only ingress-set values are forwarded. Adds a regression test and a release note. Closes restatedev#4187 Signed-off-by: pjdurden <prajjwalchittori1@gmail.com> Address review: align release-note wording (drops/receives)
0acfd65 to
269f1e7
Compare
Closes #4187.
The HTTP ingress forwarded every incoming request header to the service, including caller-supplied
x-restate-*headers. That namespace is reserved for the ingress (e.g.x-restate-ingress-path), so a caller could inject or override reserved metadata.parse_headersnow drops any incoming header whose name starts withx-restate-, so only ingress-set values are forwarded. (x-restate-limit-keyis unaffected — it's consumed byparse_limit_keybeforeparse_headersruns.)Added a regression test that sends a spoofed
x-restate-ingress-pathplus an arbitraryx-restate-fooheader and asserts they don't reach the service while normal headers still do. It passes with the fix and fails without it. Also added a release note for the behavior change.Verified with
cargo test -p restate-ingress-http,cargo fmt --check, andcargo clippy.