Skip to content

Git hook directory access

A tool call refers to a path under .git/hooks.

Git hooks can execute code during repository operations. A malicious hook can run repeatedly with the developer permissions.

An agent adds a hook that copies credentials whenever a commit is made.

This is a fictional example, not an event from a customer.

The rule matches recognized path references containing .git/hooks. It does not require a write or inspect whether a hook is enabled and executable.

Rule IDEvent categoryTierBase severity
RULE_PERSISTENCE_GIT_HOOKSpersistenceCommunityHIGH

Base severity is the rule default. A finding involving content saved for later execution may have a lower severity. Your loaded rule version and event details determine the finding you see.

Review changed hook content and repository hook settings. Verify that each executable hook belongs to an approved workflow.

Reading hook samples, installing an approved formatter, or maintaining legitimate hooks can match.

Hooks in custom core.hooksPath locations, framework-specific hook folders, or edits hidden inside a subprocess can be missed.

The finding establishes a path reference. It does not show that Git subsequently ran a hook.

A finding describes a pattern in captured activity. Review the original call, its result, and the task context before concluding that harm occurred. Absence of a finding does not establish that an operation is safe.

Browse this category. Find a rule by ID.