Repository navigation
fix(githttp): cut the unknown ref policy op that a push refusal quotes - #906
Conversation
The update hook refused a ref policy op that it does not know with `unknown policy op %q for <ref>`, which repeats the op whole on git's stderr, and git shows that line to the pusher. The op is text of the pusher's token and can be as long as an environment entry allows. The ref, commit and merge writes of the API already quote the same op with errtext.Quote (#902). The hook now quotes it with errtext.Quote too: an op over 256 bytes is cut and followed by its length. This is the server's own refusal text, not a pattern that reads git's stderr. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_ Change-Id: I67245cd17be12a5aaad3b4cf130c2f80326f8c8b Signed-off-by: Thomas Kosiewski <tk@coder.com>
hook.go is covered code: evalRefPolicy quotes an unknown op with errtext.Quote. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_ Change-Id: I720e36ba852e4a43db4cc3be6ea393253143f485 Signed-off-by: Thomas Kosiewski <tk@coder.com>
|
@codex review |
|
@codex security review |
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. |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ 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". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Main gained #905 (both sync lanes decide on the egress proxy with viaEgressProxy). The only conflict is the sync commit of the lane-schedule model; the next commit re-records it on the merged tree. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_ Change-Id: I5ea59ebc10ff4e97ca9afa654c28d07ddf66d87d Signed-off-by: Thomas Kosiewski <tk@coder.com>
The merge brought #905's worker.go and worker_push.go fingerprints; TLC passes on the merged tree, so the sync commit moves to it. No fingerprint changes. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_ Change-Id: If8b8572d273d3071d1ccc2f0470d5881b0066b2d Signed-off-by: Thomas Kosiewski <tk@coder.com>
The review of #906 noted that the reservation classifier turns this refusal into a reservation denial; what gives the same refusal is evalRefPolicy with fullEval off, which the classifier runs. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_ Change-Id: I085e995d3a81dad9b7db3c5fddd64c066d7eaa12 Signed-off-by: Thomas Kosiewski <tk@coder.com>
|
@codex review |
|
@codex security review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ 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". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Main gained #906 (the hook quotes an unknown ref policy op with errtext.Quote). The only conflict is the sync commit of the lane-schedule model; the next commit re-records it on the merged tree. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_ Change-Id: Idc3d6c16d4e6288a5a66f32fbe057badec2ba825 Signed-off-by: Thomas Kosiewski <tk@coder.com>
The merges brought #905's and #906's fingerprints; TLC passes on the merged tree, so the sync commit moves to it. No fingerprint changes. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_ Change-Id: I1e93add5a92183dda736b91f90b89090e7e46ff4 Signed-off-by: Thomas Kosiewski <tk@coder.com>
The update hook refused a ref policy op that it does not know with
unknown policy op %q for <ref>, which repeated the op whole on git's stderr, and git shows that line to the pusher. The op is text of the pusher's token, so it can be as long as one environment entry allows (the hook gets the refs claim inOPENSTORAGE_GIT_REFS_POLICY). The API's ref, commit and merge writes already quote the same op witherrtext.Quotesince #902.The hook now quotes it with
errtext.Quotetoo. A short op reads as before; an op over 256 bytes is cut at a character and followed by its length:This is the server's own refusal text, not a pattern that reads git's stderr (AGENTS.md).
Changes
evalRefPolicy(internal/githttp/hook.go): the unknown-op refusal quotes the op witherrtext.Quote. Every path that refuses an unknown op runs this check: the pre-receive policy gate (the line a push with a pack shows), the--atomicdenial and the update hook.internal/errtext/README.mdlists the hook as a caller.hook.gois covered by the lane-schedule model, so its fingerprints are re-recorded.Evidence
TestUnknownPolicyOpRefusalQuotedBounded(internal/githttp) callsevalRefPolicywith a 100,000-byte op,no-flyandno"fly, with full evaluation and the budget-free mode. Each must return a refusal that git shows the pusher (ShownToPusher) with the exact text.hook.go, the long-op case fails; the short cases pass unchanged.go test -race -tags=openstorage_viewcheckof./internal/githttp/...(835 s) and./internal/errtext/...(1 s) passes at e5769b0.Reviews
Round 1 (e5769b0): the Codex review and the Codex security review found nothing. A fresh read-only review: PASS. It pushed with real git and a 60,000-byte op: the pre-receive policy gate printed 684 bytes (60,411 on main), the
--atomicdenial 706 (60,433) and the update hook 586 (60,313), each still a refusal. A short op prints byte for byte as before. No code parses this text. Its mutants (a 4,096-byte cap, noRefuse, quoting in one evaluation mode only, no length suffix) all failed the test. Left open (P3):evalRefPolicywithfullEvaloff that does, and the classifier turns it into a reservation denial. Fixed in round 2.update: parse ops claim %qrepeats the whole ops claim, but no push reaches it: the server writes that claim withjson.Marshal, which always parses back.Round 2 (2e15bab): 71947bc merges main (fix(sync): send an upper-case http(s) scheme through the egress proxy #905); the only conflict was the lane-schedule sync commit, which 7b38d46 re-records on the merged tree. 2e15bab fixes the test comment above. The PR's own diff is otherwise unchanged (
hook.goandinternal/errtextare byte-identical to e5769b0), so the race lanes above still apply. The Codex review and the Codex security review found nothing. A fresh read-only review: PASS. It checked that nothing of fix(sync): send an upper-case http(s) scheme through the egress proxy #905 was lost, and ran the new test and fix(sync): send an upper-case http(s) scheme through the egress proxy #905's tests with-raceon the merged tree.Found by the reviews of #902 (desk follow-up).
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:xhigh