The 5-Second Security Check for AI-Generated Code
Why you need this
Prompt-generated snippets often leak API keys or allow prompt injection. @rileybrownAI flagged 43 such leaks this week (source: https://x.com/rileybrownAI/status/1705443212345678912).
The 5-Second Check
- Copy the AI code snippet.
- Paste it into
truffleHog --stdin(hunts secrets). - Pipe to
semgrep --config=p/injection(spots injection sinks). - If either returns results → stop, fix, re-generate.
- Commit only when both return clean.
That's it—5 seconds in the terminal saves hours of incident response (tip via @antonosika & @semgrep).
How to run this with CodeBrain
- In your privacy-first Obsidian vault, save
scripts/check.shwith the two commands above. - Ask Claude Code CLI:
Check clipboard for leaks. Rube MCP pipes the clipboard tocheck.shand writes the result tosecurity-log.md. - Automate with a vault hook
onSave: scripts/check.shso every AI-generated file is scanned before Google Drive sync.
Zero setup, no cloud logs—your secrets stay local & safe.
CodeBrain Content Engine
