Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

fix(rules): cover every githooks(5) hook name in git-hook-installed (#1025)

Rudy Mizrahi Celekli73f9317458fb
diff --git a/rules/source-control/git-hook-installed.rule.yaml b/rules/source-control/git-hook-installed.rule.yaml
index 1a0d70d9..78a8f353 100644
--- a/rules/source-control/git-hook-installed.rule.yaml
+++ b/rules/source-control/git-hook-installed.rule.yaml
@@ -1,5 +1,5 @@
id: git-hook-installed
-version: 2
+version: 3
title: Git hook script installed or modified
description: >
The agent modified a script under .git/hooks/ (pre-commit, post-checkout,
@@ -17,7 +17,7 @@ taxonomy:
match: >
e.event.action in ["file.modified", "file.created", "file.edited"] &&
- e.file.path.matches("(?i)(^|/)\\.git/hooks/(applypatch-msg|pre-applypatch|post-applypatch|pre-commit|pre-merge-commit|prepare-commit-msg|commit-msg|post-commit|pre-rebase|post-checkout|post-merge|pre-push|pre-receive|update|post-receive|post-update|push-to-checkout|pre-auto-gc|post-rewrite|fsmonitor-watchman)$")
+ e.file.path.matches("(?i)(^|/)\\.git/hooks/(applypatch-msg|pre-applypatch|post-applypatch|pre-commit|pre-merge-commit|prepare-commit-msg|commit-msg|post-commit|pre-rebase|post-checkout|post-merge|pre-push|pre-receive|update|post-receive|post-update|push-to-checkout|pre-auto-gc|post-rewrite|fsmonitor-watchman|reference-transaction|post-index-change|sendemail-validate|proc-receive|p4-changelist|p4-prepare-changelist|p4-post-changelist|p4-pre-submit)$")
emit:
reason: "Git hook script installed or modified — runs on the next matching git operation, durable code-execution persistence"
@@ -35,6 +35,18 @@ tests:
- event: { action: file.modified }
file: { path: "/home/dev/repo/.git/hooks/post-checkout" }
session: { id: s1 }
+ - name: reference_transaction_hook
+ verdict: match
+ events:
+ - event: { action: file.modified }
+ file: { path: ".git/hooks/reference-transaction" }
+ session: { id: s1 }
+ - name: post_index_change_hook
+ verdict: match
+ events:
+ - event: { action: file.modified }
+ file: { path: "/home/dev/repo/.git/hooks/post-index-change" }
+ session: { id: s1 }
- name: sample_hook_not_active
verdict: no_match
events: