Skip to content

fix(githttp): cut the unknown ref policy op that a push refusal quotes - #906

Merged
ThomasK33 merged 5 commits into
mainfrom
hook-unknown-op-quote
Nov 17, 2026
Merged

ThomasK33 merged 5 commits into
mainfrom
hook-unknown-op-quote

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

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 in OPENSTORAGE_GIT_REFS_POLICY). The API's ref, commit and merge writes already quote the same op with errtext.Quote since #902.

The hook now quotes it with errtext.Quote too. A short op reads as before; an op over 256 bytes is cut at a character and followed by its length:

unknown policy op "<<<…" (100000 bytes) for refs/heads/main

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 with errtext.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 --atomic denial and the update hook.
  • internal/errtext/README.md lists the hook as a caller.
  • hook.go is covered by the lane-schedule model, so its fingerprints are re-recorded.

Evidence

  • Test: TestUnknownPolicyOpRefusalQuotedBounded (internal/githttp) calls evalRefPolicy with a 100,000-byte op, no-fly and no"fly, with full evaluation and the budget-free mode. Each must return a refusal that git shows the pusher (ShownToPusher) with the exact text.
  • Red on main: with main's hook.go, the long-op case fails; the short cases pass unchanged.
  • Lanes: go test -race -tags=openstorage_viewcheck of ./internal/githttp/... (835 s) and ./internal/errtext/... (1 s) passes at e5769b0.
  • lint, gofmt, the docs gate and both fingerprint gates pass.

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 --atomic denial 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, no Refuse, quoting in one evaluation mode only, no length suffix) all failed the test. Left open (P3):

    • The test's header comment said the reservation classifier gives the same refusal; it is evalRefPolicy with fullEval off that does, and the classifier turns it into a reservation denial. Fixed in round 2.
    • update: parse ops claim %q repeats the whole ops claim, but no push reaches it: the server writes that claim with json.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.go and internal/errtext are 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 -race on the merged tree.

Found by the reviews of #902 (desk follow-up).


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: xhigh

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>
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T02:51:17.340245Z 2e15bab Manual request
🔒 Security Review ✅ Completed 2026-11-17T02:53:04.167745Z 2e15bab Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: e5769b0fe4

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: e5769b0fe4

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

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>
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 2e15bab7d0

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 2e15bab7d0

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33
ThomasK33 added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 57f04fe Nov 17, 2026
16 checks passed
@ThomasK33
ThomasK33 deleted the hook-unknown-op-quote branch November 17, 2026 03:30
ThomasK33 added a commit that referenced this pull request Nov 17, 2026
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>
ThomasK33 added a commit that referenced this pull request Nov 17, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant