Repository navigation
Conversation
A POST body that carries a result past encoding/json's depth cap was written unfiltered. Reject it instead, answering with the request id, as the GET stream does. Also filter a result split across lone CR line breaks, and share the no-shape decision between the POST path and the GET stream so the two cannot drift apart.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 34ec327bd7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| if id == (jsonrpc2.ID{}) { | ||
| id = topLevelID(rawResponse) | ||
| } | ||
| return rfw.writeErrorResponse(id, |
There was a problem hiding this comment.
Reset upstream headers before writing this error
When a filtered POST has an unrecognized media type and an undecodable body naming result, this call writes a replacement JSON-RPC error without clearing the backend’s Content-Length or changing its Content-Type. With a real reverse-proxied response, the stale length can truncate the shorter 500 body, and a type such as text/plain leaves the JSON-RPC error mislabeled. Clear the stale entity headers and set Content-Type: application/json before writing the replacement.
Useful? React with 👍 / 👎.
| case noShapeFilterSSE: | ||
| rfw.ResponseWriter.Header().Del("Content-Length") | ||
| return rfw.processSSEResponse(rawResponse) | ||
| case noShapeReject: |
There was a problem hiding this comment.
Document the changed malformed-response behavior
For a filtered request with an unrecognized media type, an undecodable body naming result now returns an HTTP 500 JSON-RPC error instead of passing the body through. docs/authz.md does not describe this client-visible behavior; please document the before-and-after behavior in the subsystem page.
AGENTS.md reference: AGENTS.md:L91-L91
Useful? React with 👍 / 👎.
Summary
Why: A POST response with a result nested past encoding/json's depth cap was sent to the client unfiltered. A result split across lone CR line breaks could also get past the filter, because a spec client reads those breaks differently.
What: Such bodies are now answered with a JSON-RPC error that carries the request id, as the GET stream does. Events with a lone CR that could carry a result fail closed. The no-shape decision is shared between the POST path and the GET stream.
Type of change
Bug fix
Does this introduce a user-facing change?
Before: a POST response carrying a result past the depth cap passed through unfiltered.
After: it is answered with a JSON-RPC error that carries the request id.
Before: an event with a lone CR could hide a list from the filter.
After: that event is answered with an error.
Test plan
go test -race ./pkg/authz/ ./pkg/transport/proxy/httpsse/ passes locally
Full task test on CI (pending; the laptop cannot run it)