security: add pre-commit hook that rejects staged files containing merge-conflict markers #39

Open
opened 2026-05-27 07:08:08 +00:00 by coilysiren · 0 comments
Owner

Source: background security review on coilysiren/agent-guard during a stash-pop conflict that surfaced raw merge-conflict markers (<<<<<<<, =======, >>>>>>>) inside .claude/lockdown-deny.sh until coily lockdown regenerated the file.

Finding (MEDIUM, Agent/Subprocess Permission Bypass): A conflicted security-config file is risky to commit. Conflict markers are not valid shell, so a script-style file like lockdown-deny.sh would silently break at the next invocation. The current case resolved cleanly because the file is auto-generated, but the class of bug stands.

Suggested fix: Add a pre-commit hook (or extend an existing one in coilysiren/agentic-os/scripts/) that fails on staged files containing conflict markers. One-liner shape:

grep -RnE '^(<<<<<<< |======= |>>>>>>> )' --include='*' <staged-files>

Wire it into the cross-repo pre-commit suite alongside catalog-doc-size, documentation-layout, etc. Catches conflict markers in any tracked file, not just .claude/.

Why agentic-os, not consumer repos: the existing pre-commit suite rolls out from coilysiren/agentic-os to every catalog repo, so the fix lands once and propagates.

**Source:** background security review on coilysiren/agent-guard during a stash-pop conflict that surfaced raw merge-conflict markers (`<<<<<<<`, `=======`, `>>>>>>>`) inside `.claude/lockdown-deny.sh` until coily lockdown regenerated the file. **Finding (MEDIUM, Agent/Subprocess Permission Bypass):** A conflicted security-config file is risky to commit. Conflict markers are not valid shell, so a script-style file like `lockdown-deny.sh` would silently break at the next invocation. The current case resolved cleanly because the file is auto-generated, but the class of bug stands. **Suggested fix:** Add a pre-commit hook (or extend an existing one in `coilysiren/agentic-os/scripts/`) that fails on staged files containing conflict markers. One-liner shape: ``` grep -RnE '^(<<<<<<< |======= |>>>>>>> )' --include='*' <staged-files> ``` Wire it into the cross-repo pre-commit suite alongside `catalog-doc-size`, `documentation-layout`, etc. Catches conflict markers in any tracked file, not just `.claude/`. **Why agentic-os, not consumer repos:** the existing pre-commit suite rolls out from `coilysiren/agentic-os` to every catalog repo, so the fix lands once and propagates.
coilysiren added
P3
and removed
P2
labels 2026-05-31 07:00:06 +00:00
Sign in to join this conversation.
No labels
P0
P1
P2
P3
P4
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
coilyco-flight-deck/agentic-os#39
No description provided.