Skip to content

feat(git-hooks): disclose foreign shared entries before hooks-path - #10116

Merged
melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-7613-40232568576-1
Oct 26, 2026
Merged

melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-7613-40232568576-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #7613

Summary

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

In a plain shared install where core.hooksPath is not yet .githooks, the installer's plan now returns a shared-entries decision before hooks-path. It lists what setting core.hooksPath would also run that the installing plugin did not put there: every <event>.d/ marker other than one of the plugin's own entries naming its script, every *.pre-checks hook, any other dotless hook file that is not the dispatcher, and every tracked file under .githooks/local/. When none of these exist, the plan has no such decision and its output is unchanged. The canonical lib/git-hooks/ copies are regenerated into all ten carrier plugins, each with a patch fragment, and the decision docs and the check-placement convention describe the new decision.

Not verified

  • lib/git-hooks/install.test.sh (the node --test suite) was not run here: this lane offers no wrapper that runs node or test scripts. The new tests were traced by hand and by the review subagent. Left to the PR's CI, which the issue names as the check.
  • The shared-copy sync check (sync-shared-copies.sh --check) and check-changelog-fragments.sh --check as CI runs them are left to the PR's CI. Locally, the copies were regenerated with the sync wrapper and the fragments pass the lane's fragment check.
  • new-changelog-fragment refused to run because HEAD is detached (no branch name to put in the fragment). The ten fragments were written by hand in its format (front matter bump: patch, a ### Added body) under a feat-7613-shared-entries-disclosure-&lt;8 hex&gt; name. check-changelog-fragments va
  • This goes beyond the issue's literal list in two places, both of which disclose more, not less. (1) A &lt;plugin&gt;.* marker is left out only when it is one of the plugin's own entries and names that entry's script; the issue's wording would hide any &lt;plugin&gt;.* marker. (2) Other dotless h
  • This ran on a detached HEAD. Per the runner's instructions, every change is left uncommitted in the working tree and nothing was committed.

Fix

  • lib/git-hooks/install.mjs: new dirNames and sharedEntries helpers. plainDecisions pushes {kind: "shared-entries", files} before hooks-path when there is anything to list. Symlinked <event>.d directories are followed the way the dispatcher's glob follows them, names are compared case-insensitiv
  • lib/git-hooks/install.test.mjs: four new plain-shared tests. (1) A foreign marker, a .pre-checks file, a tracked local/ file, another hook file, a stale <plugin>.* marker and an own dispatcher: checks the exact list and that the decision comes before hooks-path. (2) An empty .githooks, then on
  • lib/git-hooks/git-hook-decisions.md: new row for the shared-entries kind (show the list, run hooks-path only on the user's yes).
  • plugins/guardrails/skills/setup/reference/git-hook-decisions.md: the same row in guardrails' hand-kept decisions table.
  • docs/conventions/check-placement/README.md: the per-clone hooks-path paragraph describes the shared-entries decision.
  • plugins/{typos-format,ruff-format,bash-format,biome-format,go-format,markdown-format,powershell-format,actionlint,guardrails,instruction-placement}/lib/git-hooks/install.mjs: regenerated by sync-shared-copies.
  • plugins/{typos-format,ruff-format,bash-format,biome-format,go-format,markdown-format,powershell-format,actionlint,instruction-placement}/skills/setup/reference/git-hook-decisions.md: regenerated by sync-shared-copies.
  • .changes/<carrier>/feat-7613-shared-entries-disclosure-*.md: one patch fragment (### Added) for each of the ten carrier plugins.

Verification

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

  • scripts/check-changelog-fragments.sh --check: passed

The run reports:

  • .lane/verify/bin/sync-shared-copies: regenerated all 19 registered copies, exit 0.
  • .lane/checks/bin/check-changelog-fragments: all 45 fragments under .changes/ valid.
  • .lane/checks/bin/check-affected: 9 passed, 7 skipped (no changed shell or Python, typos not installed, and the checks that run code from the checked tree), over 34 changed files.
  • .lane/verify/bin/cant-fail-scan --file lib/git-hooks/install.test.mjs --check: PASS, 57 test blocks parsed, no gating findings.
  • Fresh-context review subagent over the whole diff: traced the new tests as passing against the code and confirmed the generated copies match the canonical. It reported symlinked <event>.d directories missed, other committed hook files unlisted, prefix-only own-marker exclusion, case-sensitive
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/40232568576

Left out: the items under Not verified.

Related

#7613

Lane-Activity: work-resolve-issue/resolve-issue

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-security-review: 1 inline finding(s) on c765fb5e0f027670e178440d48dc56c9105a2cd5; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

Comment thread lib/git-hooks/install.mjs Resolved
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed d17867233445d2e332d4da54dfba89f7bbad3bec: 0 finding(s), 0 as inline comments.

Incremental security review of d178672 against c765fb5: no security findings.

critical-findings: 0

What changed. sharedEntries in lib/git-hooks/install.mjs and its ten regenerated carrier copies now closes a gap in the shared-entries disclosure. Before, a marker was treated as the plugin's own when its text matched the expected marker. The script it names was never checked, so a planted script at .githooks/<plugin>/<script> went unlisted. Now an own marker is also listed, together with its script path, unless copyState returns missing or ok for that script.

Why it holds.

  • copyState returns ok only when the stamp is present and the stamp hash equals stampHash(body, lib, assets) recomputed from the files on disk. It must also equal the plugin's current sourceHash. A planted script, a planted check-lib.sh, or a planted asset all change the hash and fall into modified or stale, so they get listed.
  • A forged stamp that is consistent with a planted body reads as stale, which is listed. The new test covers exactly this case.
  • missing stays unlisted because the dispatcher has nothing to run there.
  • Case-variant marker names don't match own.has(rel), so they are listed (fails closed).
  • The result goes through Set and sort, so the extra script path produces no duplicates. The decision still comes before hooks-path and still needs the user's yes.
  • The edit only widens what is disclosed. No new command execution, path construction from untrusted input, or write path was added.

The docs changes are the same decision-row wording, mirrored into the carrier copies. They don't remove any instruction or control.

No plugin manifests or trusted-path files changed in this increment, so there are no manifest <field> lines. The PR context contained no embedded instructions aimed at the reviewer. I did not read the instruction exception register, because the diff removes no standing instruction.

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed d17867233445d2e332d4da54dfba89f7bbad3bec: 1 finding(s), 0 as inline comments.

Incremental review of the change since c765fb5. The code change is correct as far as I traced it. The one finding is documentation drift, and it is minor.

What changed. sharedEntries now also lists this plugin's own marker, plus the script it names, when that script is not the current copy. copyState reports missing or ok for a genuine script. A stale copy is listed on purpose: the code comment says a stamp is not a signature, so a stale copy cannot be told from a forged one. A planted body whose stamp matches that body reads as stale, so it is listed and not skipped. The ok state needs the script hash to equal the hash of the source, so planted check-lib.sh or asset files cannot pass as genuine.

What I checked.

  • copyState, sourceHash and stampHash exist with the signatures used.
  • scriptRel matches the path entryPaths writes (<plugin>/<entry.script>).
  • The new test's expected list is .githooks/demo-checks/word-check.sh plus the marker, sorted. That matches the code, and stampHash is now exported for the test. I did not run the tests.
  • The ten carrier install.mjs copies carry the same patch as the canonical file, as far as the diff shows. I did not run the shared-copy sync check.

Finding (documentation drift). The new wording appears in the canonical lib/git-hooks/git-hook-decisions.md and in nine regenerated carrier copies. Two other places still describe the old rule:

No changed line can carry this finding, so it is here in the summary.

Closing issue #7613. The acceptance criteria are met by the earlier changes, and the new tests cover a foreign marker. This increment only widens the disclosure. The criterion that CI runs install.test.sh and the shared-copy sync check is author-claimed and not verified by me.

Manifest items: no plugin.json or marketplace.json is touched in this increment.

Spend: none beyond ordinary review runs.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 1 of max 4 on d178672.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head d17867233445d2e332d4da54dfba89f7bbad3bec.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head d17867233445d2e332d4da54dfba89f7bbad3bec. The lanes clear this reason on their own; the next scheduled run judges it again.

pr-merge's gate refuses its verifier verdict (verify:unreadable)

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 26, 2026
Merged via the queue into main with commit dab768b Oct 26, 2026
38 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-7613-40232568576-1 branch October 26, 2026 16:47
kyle-sexton added a commit that referenced this pull request Oct 26, 2026
Brings in #10300, #10116 and the #10305 release; merged cleanly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.

git-hooks installer: surface foreign shared entries before hooks-path

1 participant