Skip to content

Commit 0fb9c63

Browse files
committed
fix(pre-push): redirect stdin from /dev/null for pre-check commands
agentshield and zizmor inherit stdin from the git pre-push hook, which is a pipe carrying ref data. If either tool reads from stdin, it consumes the ref data, causing the while-read loop to iterate zero times and silently bypassing all commit-level security checks.
1 parent 2f8e599 commit 0fb9c63

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

.git-hooks/pre-push

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ TOTAL_ERRORS=0
2727
# ============================================================================
2828
if command -v agentshield >/dev/null 2>&1 || [ -x "$(pnpm bin 2>/dev/null)/agentshield" ]; then
2929
AGENTSHIELD="$(command -v agentshield 2>/dev/null || echo "$(pnpm bin)/agentshield")"
30-
if ! "$AGENTSHIELD" scan --quiet 2>/dev/null; then
30+
if ! "$AGENTSHIELD" scan --quiet 2>/dev/null </dev/null; then
3131
printf "${RED}✗ AgentShield: security issues found in Claude config${NC}\n"
3232
printf "Run 'pnpm exec agentshield scan' for details\n"
3333
TOTAL_ERRORS=$((TOTAL_ERRORS + 1))
@@ -44,7 +44,7 @@ elif [ -x "$HOME/.socket/zizmor/bin/zizmor" ]; then
4444
ZIZMOR="$HOME/.socket/zizmor/bin/zizmor"
4545
fi
4646
if [ -n "$ZIZMOR" ] && [ -d ".github/" ]; then
47-
if ! "$ZIZMOR" .github/ 2>/dev/null; then
47+
if ! "$ZIZMOR" .github/ 2>/dev/null </dev/null; then
4848
printf "${RED}✗ Zizmor: workflow security issues found${NC}\n"
4949
printf "Run 'zizmor .github/' for details\n"
5050
TOTAL_ERRORS=$((TOTAL_ERRORS + 1))

0 commit comments

Comments
 (0)