Skip to content

Commit b8ee404

Browse files
committed
chore: sync hooks and skills from socket-repo-template
1 parent 19a3a1f commit b8ee404

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

.claude/skills/_shared/security-tools.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ No install step needed — available after `pnpm install`.
1111
## Zizmor
1212

1313
Not an npm package. Installed via `pnpm run setup` which downloads the pinned version
14-
from GitHub releases with SHA256 checksum verification (see `bundle-tools.json`).
14+
from GitHub releases with SHA256 checksum verification (see `external-tools.json`).
1515

1616
The binary is cached at `.cache/external-tools/zizmor/{version}-{platform}/zizmor`.
1717

.claude/skills/security-scan/SKILL.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
---
22
name: security-scan
33
description: Runs a multi-tool security scan — AgentShield for Claude config, zizmor for GitHub Actions, and optionally Socket CLI for dependency scanning. Produces an A-F graded security report.
4+
user-invocable: true
45
---
56

67
# Security Scan
78

89
Multi-tool security scanning pipeline for the repository.
910

10-
## Related: check-new-deps Hook
11-
12-
This repo includes a pre-tool hook (`.claude/hooks/check-new-deps/`) that automatically
13-
checks new dependencies against Socket.dev's malware API before Claude adds them.
14-
The hook runs on every Edit/Write to manifest files — see its README for details.
15-
This skill covers broader security scanning; the hook provides real-time dependency protection.
16-
1711
## When to Use
1812

1913
- After modifying `.claude/` config, settings, hooks, or agent definitions

.git-hooks/commit-msg

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ if [ -n "$COMMITTED_FILES" ]; then
2323
if [ -f "$file" ]; then
2424
# Check for Socket API keys (except allowed).
2525
if grep -E 'sktsec_[a-zA-Z0-9_-]+' "$file" 2>/dev/null | grep -v "$ALLOWED_PUBLIC_KEY" | grep -v 'your_api_key_here' | grep -v 'fake-token' | grep -v 'test-token' | grep -v '\.example' | grep -q .; then
26-
echo "${RED}✗ SECURITY: Potential API key detected in commit!${NC}"
26+
printf "${RED}✗ SECURITY: Potential API key detected in commit!${NC}\n"
2727
printf "File: %s\n" "$file"
2828
ERRORS=$((ERRORS + 1))
2929
fi
3030

3131
# Check for .env files.
3232
if echo "$file" | grep -qE '^\.env(\.local)?$'; then
33-
echo "${RED}✗ SECURITY: .env file in commit!${NC}"
33+
printf "${RED}✗ SECURITY: .env file in commit!${NC}\n"
3434
ERRORS=$((ERRORS + 1))
3535
fi
3636
fi
@@ -41,7 +41,12 @@ fi
4141
COMMIT_MSG_FILE="$1"
4242
if [ -f "$COMMIT_MSG_FILE" ]; then
4343
# Create a temporary file to store the cleaned message.
44-
TEMP_FILE=$(mktemp)
44+
TEMP_FILE=$(mktemp) || {
45+
printf "${RED}✗ Failed to create temporary file${NC}\n" >&2
46+
exit 1
47+
}
48+
# Ensure cleanup on exit
49+
trap 'rm -f "$TEMP_FILE"' EXIT
4550
REMOVED_LINES=0
4651

4752
# Read the commit message line by line and filter out AI attribution.
@@ -58,15 +63,15 @@ if [ -f "$COMMIT_MSG_FILE" ]; then
5863
# Replace the original commit message with the cleaned version.
5964
if [ $REMOVED_LINES -gt 0 ]; then
6065
mv "$TEMP_FILE" "$COMMIT_MSG_FILE"
61-
echo "${GREEN}✓ Auto-stripped${NC} $REMOVED_LINES AI attribution line(s) from commit message"
66+
printf "${GREEN}✓ Auto-stripped${NC} $REMOVED_LINES AI attribution line(s) from commit message\n"
6267
else
6368
# No lines were removed, just clean up the temp file.
6469
rm -f "$TEMP_FILE"
6570
fi
6671
fi
6772

6873
if [ $ERRORS -gt 0 ]; then
69-
echo "${RED}✗ Commit blocked by security validation${NC}"
74+
printf "${RED}✗ Commit blocked by security validation${NC}\n"
7075
exit 1
7176
fi
7277

.husky/commit-msg

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
# Run commit message validation and auto-strip AI attribution.
2-
.git-hooks/commit-msg "$1"
2+
if [ -x ".git-hooks/commit-msg" ]; then
3+
.git-hooks/commit-msg "$1"
4+
else
5+
printf "\033[0;31m✗ Error: .git-hooks/commit-msg not found or not executable\033[0m\n" >&2
6+
exit 1
7+
fi

0 commit comments

Comments
 (0)