Skip to content

fix(pr-pipeline): refuse every lefthook config and script path in fix-ci and address-feedback patches - #12729

Merged
kyle-sexton merged 2 commits into
mainfrom
fix/8283-lefthook-refusal
Nov 3, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
fix/8283-lefthook-refusal

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #8283

Summary

The lefthook refusal on the ci-context and review-threads patch rows matched only a root lefthook.yml. A fix-ci or address-feedback patch could still change which git hooks run through any other file lefthook reads, such as lefthook-local.yml or .lefthook/. This covers the rest, per the recorded decision.

Fix

  • The lefthook rule in apply-patch.mjs now also refuses lefthook, .lefthook, lefthook-local and .lefthook-local at the root and lefthook and lefthook-local under a root .config/, each with .yml, .yaml, .toml, .json or .jsonc, plus any path whose first segment is .lefthook or .lefthook-local. Same case and .. handling as before, through segments.
  • The schema description and the pipeline README state the new set. patch-rules.json and protected-paths.mjs are unchanged, since those two rows already name lefthook.

Verification

  • node --test .github/scripts/apply-patch/apply-patch.test.mjs: 353 pass, 0 fail on this head, run by the orchestrator. The worker's run before the rule change had 125 failures, all new tests.
  • Resolve-config suite: 877 pass, 0 fail, per the worker's run on the merged head; it includes the checkPatchRules tests.
  • The new tests are 31 paths on both rows for a write and a rename, an all-rows check that only those two rows refuse, and nine look-alikes refused on no row. No existing test's expectation changed: the existing loop gained the new paths as its input.
  • Left out: a live lane run with a real patch, which CI's review and test lanes do not exercise either.

Related

  • #12396: the first three refusals, whose body recorded this gap.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VQb9Q2e8NLMQ1mwcztzP39

kyle-sexton and others added 2 commits November 3, 2026 00:33
…-ci and address-feedback patches

The lefthook refusal on the ci-context and review-threads rows matched only
the root lefthook.yml, so a patch could still change a hook through any other
file lefthook reads. It now also matches, in any case and through any ..
segment: lefthook, .lefthook, lefthook-local and .lefthook-local at the root
and lefthook and lefthook-local under a root .config/, each with .yml, .yaml,
.toml, .json or .jsonc, and any path whose first segment is .lefthook or
.lefthook-local. The issue row and protected-paths.mjs are unchanged.

Refs: #8283

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VQb9Q2e8NLMQ1mwcztzP39
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 3, 2026 05:39
@chatgpt-codex-connector

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

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T05:41:24.079432Z 60d5d19 Draft marked ready
ℹ️ 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.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

claude-review reviewed 60d5d19c8971ddc78979ba6ae7439e1d89d56342: read 5 of 5 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no findings

What changed. On the ci-context and review-threads rows, the lefthook refusal used to cover only the root lefthook.yml. It now also refuses:

  • the root lefthook / .lefthook / lefthook-local / .lefthook-local with .yml, .yaml, .toml, .json or .jsonc;
  • .config/lefthook.* and .config/lefthook-local.* with the same extensions;
  • any path whose first segment is .lefthook or .lefthook-local.

The schema description, the pipeline README and a changelog fragment are updated to match.

Correctness. I read the new rule at apply-patch.mjs#L97-L111 alongside segments in protected-paths.mjs#L7-L17:

  • segments lowercases the path and resolves .. and ., so the rule's lowercase comparisons match in any case and through any .. segment, as the issue requires.
  • The checks only accept a segment count of 1 at the root and exactly 2 under .config. So nested look-alikes such as sub/.config/lefthook.yml and .config/sub/lefthook.yml are not refused, as intended.
  • The first-segment checks for .lefthook and .lefthook-local compare the whole segment. So .lefthook-notes does not match.

Closing issue #8283 (the 2026-11-03 decision's criteria).

  • Rule refuses every listed path, in any case and through any .. segment: met. Covered by LEFTHOOK_PATHS plus case and .. variants in the all-rows test, and by the write and rename loops on both rows.
  • Only ci-context and review-threads refuse the added paths: met. patch-rules.json is unchanged and already names lefthook on those two rows. The all-rows test checks that every other row returns no refusal.
  • Schema description and README describe the same paths: met. Their wording matches the rule.
  • checkPatchRules accepts the file: only the schema's description string changed; the enum and structure did not. The author says the resolve-config suite passes; I did not run it.

The earlier decision's criteria (.gitattributes, .husky, root lefthook.yml, controls on the issue row) were built in #12396, and this PR leaves them in place.

Verification. The test counts in the PR body (353 apply-patch, 877 resolve-config) come from the author and I have not verified them. This lane has no shell, so I ran nothing.

Embedded text. I found no instructions to the lane in the PR context or the prior-findings file.

No plugin manifest changed. There is nothing in a hold class: the change only adds refusals and has no billing effect.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 60d5d19c8971ddc78979ba6ae7439e1d89d56342: read 5 of 5 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #12729 (head 60d5d19)

I found no security issues.

What changed. The lefthook path refusal on the ci-context and review-threads patch rows in .github/scripts/apply-patch/apply-patch.mjs (a trusted path) used to match only a root lefthook.yml. It now also refuses:

  • at the root, lefthook, .lefthook, lefthook-local and .lefthook-local with .yml, .yaml, .toml, .json or .jsonc;
  • under a root .config/, lefthook and lefthook-local with the same five extensions;
  • any path whose first segment is .lefthook or .lefthook-local.

The schema description, the pipeline README, a change note and the tests were updated to match.

Trust-control check. This rule decides which paths a fix-ci or address-feedback patch may write. I read the whole change and the code it depends on:

  • Narrows only. The new predicate is an OR that includes the old condition (lefthook.yml is in LEFTHOOK_ROOT_CONFIGS), so every path refused before is still refused. A refusal can only block more patches, never fewer.
  • Case and .. handling hold. segments() at protected-paths.mjs#L7-L17 lowercases the path, drops "" and . segments, and resolves .. before matching. The new sets hold lowercase names only, so mixed-case and .. variants still match. The new tests cover several of those variants.
  • Other rows unchanged. The rule is still optional and applies only to rows that name lefthook. patch-rules.json and protected-paths.mjs are not changed. rename-into-refused still does not read row rules, which is how it worked before this PR.

The other three files (schema description, README, change note) are documentation only and gate nothing. No plugin manifest is touched. No instruction surface is deleted or softened.

Prior findings. None: 0 earlier rounds, cap 3, not past the cap.

Embedded text. The PR context contains no instructions aimed at this review lane.

critical-findings: 0

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit 54f1af6 Nov 3, 2026
94 of 109 checks passed
@kyle-sexton
kyle-sexton deleted the fix/8283-lefthook-refusal branch November 3, 2026 06:38
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.

fix(pr-pipeline): decide whether apply-ci-fix also refuses git hook and attribute files (hardening deferred)

1 participant