| name | sui-security-guard |
| description | Use when setting up security scanning, detecting leaked secrets/API keys, implementing pre-commit hooks, or running security checklists on SUI projects. Triggers on "security scan", "detect secrets", "pre-commit hook", "security audit setup", "API key leaked", or any defensive security setup task. For offensive/adversarial testing (attack vectors, exploit discovery), use sui-red-team instead. |
| metadata | {"author":"first-mover-tw"} |
SUI Security Guard
Secret detection and pre-commit hooks for SUI projects.
Secret Detection
Scan the project for leaked secrets using grep patterns:
grep -rn 'suiprivkey1[a-zA-Z0-9]\{44\}' --include='*.ts' --include='*.move' --include='*.json' .
grep -rn '\b\(abandon\|ability\|able\|about\|above\)' --include='*.ts' --include='*.env' .
grep -rn 'sk-[a-zA-Z0-9]\{20,\}\|sk-ant-[a-zA-Z0-9-]\{20,\}' .
grep -rn 'AKIA[A-Z0-9]\{16\}' .
git ls-files '*.env' '.env*'
If any matches are found: rotate the key immediately, then use git-filter-repo or BFG Repo-Cleaner to purge from git history.
Pre-commit Hook Setup
Create .git/hooks/pre-commit to block secrets before they enter git:
#!/bin/sh
STAGED=$(git diff --cached --name-only --diff-filter=ACM)
if echo "$STAGED" | xargs grep -l 'suiprivkey1' 2>/dev/null; then
echo "❌ SUI private key detected in staged files. Commit blocked."
exit 1
fi
if echo "$STAGED" | grep -q '\.env$\|\.env\.'; then
echo "❌ .env file staged for commit. Add to .gitignore."
exit 1
fi
if echo "$STAGED" | xargs grep -l 'sk-[a-zA-Z0-9]\{20,\}' 2>/dev/null; then
echo "❌ API key pattern detected. Commit blocked."
exit 1
fi
echo "✅ Security scan passed."
chmod +x .git/hooks/pre-commit
For team-wide enforcement, use a shared hooks directory:
git config core.hooksPath .githooks/
.gitignore Essentials
Ensure these are in .gitignore:
.env
.env.*
!.env.example
*.pem
*.key
Security Checklist
Before deployment, verify:
Integration
- Called by:
sui-full-stack (throughout development)
- For Move contract security analysis, use
sui-red-team
- For code quality / Move best practices, use
move-code-quality
Converted and distributed by TomeVault — claim your Tome and manage your conversions.