Skip to content

fix(pr-pipeline): refuse git hook and attribute files in fix-ci and address-feedback patches - #12396

Merged
kyle-sexton merged 1 commit into
mainfrom
work-resolve-issue/issue-8283-41465539540-1
Nov 2, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
work-resolve-issue/issue-8283-41465539540-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #8283

Summary

Opened by the work-resolve-issue lane. The run's own summary:

apply-patch now refuses a patch that changes a .gitattributes file at any depth, any path whose first segment is .husky, or the root lefthook.yml, in any case and through any .. segment, a rename onto one included. Only the ci-context row (fix-ci) and the review-threads row (address-feedback) refuse them. This builds the decision recorded on 2026-11-02, which narrowed the owner's 2026-10-19 answer to three paths because .gitmodules is already refused on every row. Following the precedent of skills and skill-md, the three rules are row-only ROW_PATH_RULES entries registered as optional protected-path refusals (gitattributes, husky, lefthook), so protected-paths.mjs, the issue row and issue admission are unchanged. A rename onto one of these paths is refused through the added side of the --no-renames entry list, so rename-into-refused needed no change.

Not verified

  • The apply-patch and resolve-config node test suites (apply-patch.test.mjs, resolve.test.mjs, live-config.test.mjs) could not be run here, because this lane runs no interpreter. The issue names them as passing in CI, so they are left to the PR's CI.
  • Tidy was skipped: every code change is under .github/, a listed shared path, so the change is not tidied.
  • Review finding outside the recorded decision, not acted on: lefthook also reads lefthook-local.yml, .lefthook/ and .lefthook-local/ (the repository's own lefthook.yml comment names them), and variants such as lefthook.yaml. The 2026-11-02 decision names only the root lefthook.yml, so the lefthook ru

Fix

  • .github/scripts/apply-patch/apply-patch.mjs: ROW_PATH_RULES gains gitattributes (last segment .gitattributes), husky (first segment .husky) and lefthook (exactly lefthook.yml at the root), and REFUSALS registers each as an optional protected-path refusal
  • .github/actions/resolve-config/patch-rules.json: the ci-context and review-threads rows list gitattributes, husky and lefthook; the other rows, including issue, are unchanged
  • .github/actions/resolve-config/patch-rules.schema.json: the refuse enum and its description name the three refusals
  • .github/scripts/apply-patch/apply-patch.test.mjs: per-path refusal tests (.gitattributes, sub/dir/.gitattributes, .husky/pre-commit, .HUSKY/x, lefthook.yml) on both rows, asserting the refusal name in the log, the escalation reason and no API call, for a write and for a rename onto each path; path-r
  • docs/conventions/pr-pipeline/README.md: the Patch rules section documents the three refusals on the ci-context and review-threads rows
  • .changes/pr-pipeline/work-resolve-issue-issue-8283-41465539540-1-a9657a5e.md: minor changelog fragment for the pr-pipeline convention

Verification

The runner ran each check from the base copy against fa105db:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • check-changelog-fragments: all 13 fragments under .changes/ valid
  • check-changed-skills: no changed skills, nothing to gate
  • check-affected: 10 passed, 5 skipped (shellcheck, ruff, typos not installed, validate-plugins, changed-skills) over 6 changed files; the rest are CI-only
  • fresh-context review subagent over the whole diff: traced each new and updated test through push() and the helpers and found no correctness bugs and no other test or code that enumerates REFUSALS or the schema enum and needs the new names; its one formatting note (an over-long joined line in the REA
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/41465539540

Left out: the items under Not verified.

Related

#8283

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

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

Security review: PR #12396 (head fa105db)

No security issues found.

This PR adds three new refusals to apply-patch, so it narrows a control rather than widening one. It makes no trust-control widening. Nothing in it changes who is trusted, what a token can do, what untrusted text reaches a lane, or what a merge hold stops.

Trusted-path files I read in full:

  • .github/scripts/apply-patch/apply-patch.mjs
    • It adds three entries to ROW_PATH_RULES: gitattributes, husky and lefthook.
    • It registers each one in REFUSALS as an optional protected-path refusal, the same way the existing skills and skill-md refusals work.
    • The rules use segments() (protected-paths.mjs#L7-L15). That function lower-cases the path and resolves .. segments, so matching ignores case and follows ... I confirmed this in the code, not just from the PR text.
    • No existing rule is removed or loosened.
  • .github/actions/resolve-config/patch-rules.json
    • Only the ci-context and review-threads refuse lists change, and each change only adds names.
    • The issue, default, docs and merge-base rows are untouched.
    • This file decides which paths a lane may patch. It does not affect what the token broker mints, so it is not part of the signer control.
  • .github/actions/resolve-config/patch-rules.schema.json: the schema's list of allowed refusal names and its description gain the three new names. Nothing else changes.

Other changed files: the test file, the README and the changelog fragment carry no security surface.

  • One test assertion now compares the default row against only the non-optional refusals of ci-context. That tracks the new optional names and weakens no runtime control.

Out of scope (not a finding): the PR text notes that lefthook also reads lefthook-local.yml, .lefthook/ and .lefthook-local/, and lefthook.yaml too. These paths stay unrefused. That leaves the base behaviour as it was rather than opening anything new, and the owner's recorded decision names only the root lefthook.yml.

Embedded text: none of the PR context tells this lane to pass the PR, skip a check, drop a finding or post somewhere else.

The PR touches no plugin manifests.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

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

Code review: PR #12396, refuse git hook and attribute files in fix-ci and address-feedback patches

No findings. I read every hunk of all 6 changed files.

Correctness, checked against the code

  • Matching. segments() lowercases each path and resolves .. before the rules run (protected-paths.mjs#L7). So the new rules (s.at(-1) === ".gitattributes", s[0] === ".husky", s.length === 1 && s[0] === "lefthook.yml") match in any case and through .., the same way skill-md already does.
  • Renames. push() checks every entry from diff-tree --no-renames against the row's full refuse list (apply-patch.mjs#L1029-L1040). A rename onto a hook path therefore shows up as an added entry and gets refused, even though rename-into-refused doesn't read row-only rules. The PR says this, and the code agrees.
  • Escalation. Refusals run before the allow predicates. Under review-threads, the hook path's out-of-scope check never runs, so the test's single expected log line refused (<name>): <path> and its empty api.calls hold.
  • Default-row test. The new default-row assertion filters the optional names out of the ci-context list. What remains is in the same order as the default row's 8 refusals, so the deepEqual holds.
  • Rows. patch-rules.json adds the three names only to the ci-context and review-threads rows. The issue row and protected-paths.mjs are unchanged.

Acceptance criteria from #8283

  • A ROW_PATH_RULES rule and an optional protected-path refusal for each of the three paths: met.
  • The schema enum and description name the three refusals, and the ci-context and review-threads rows list them: met. I did not run checkPatchRules.
  • One refusal test per path, on both rows, with a rename onto each path also refused: met. The tests are the HOOK_PATHS × HOOK_ROWS loop in apply-patch.test.mjs.
  • A control test for docs/husky.md, docs/lefthook.md and sub/lefthook.yml, and for the issue row refusing none of the paths: met.
  • protected-paths.mjs and the issue row unchanged: met.
  • The test suites pass in CI: not verified. This lane cannot run code, and the PR author also says they did not run the suites. CI has to confirm this.

Notes, not counted as findings

  • The PR body notes that lefthook also reads lefthook-local.yml, .lefthook/, .lefthook-local/ and lefthook.yaml. The 2026-11-02 decision on fix(pr-pipeline): decide whether apply-ci-fix also refuses git hook and attribute files (hardening deferred) #8283 covers only the root lefthook.yml, so leaving the others out follows the recorded scope. Whether to widen it is for the security lane or the owner.
  • bump: minor in the changelog fragment fits a tightening of the pr-pipeline convention.
  • The PR context and the prior-findings file contain no embedded instructions. There are no prior findings, and this is round 1 of 3.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit ffb7169 Nov 2, 2026
48 checks passed
@kyle-sexton
kyle-sexton deleted the work-resolve-issue/issue-8283-41465539540-1 branch November 2, 2026 15:29
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