# Made Claude Code check its own code for security holes. What I learned — retained record

> Retained reddit record from reddit:ClaudeCode.

Canonical: https://highsignal.app/data/records/f841cfa85e9c921a

[← sources](https://highsignal.app/data)


source: [reddit](https://highsignal.app/data/reddit) (reddit:ClaudeCode)  published 2026-10-21 04:36 ingested 2026-10-22 02:42

[original source ↗](https://www.reddit.com/r/ClaudeCode/comments/1xbdqtm/made_claude_code_check_its_own_code_for_security/)

## retained text



```
Claude Code writes code that works, but it never asks whether that API route checks who's calling, or whether that Supabase key bypasses RLS. Unless you ask, it doesn't come up.  


So I built a small MCP server that runs security scanners locally (Opengrep, Gitleaks, npm audit, Trivy). After a change I say "scan what you changed" and Claude reads the findings and fixes them in the same session. That's the part that matters. When I had to read a report myself, I mostly didn't bother.

Two things I learned building it with Claude Code:

\- Make it show a failing test before the fix. Every time I skipped that, a bug shipped.

\- Be explicit. "Make it secure" does nothing. "Only the owner can read this row" works every time.

It's called SafeWeave, I'm the author. Happy to share the repo if anyone wants it. How do you all handle security with Claude Code?



Flair: Built with Claude Code
```



document fetched 2026-10-22 00:43 · canonical https://reddit.com/r/ClaudeCode/comments/1xbdqtm/made_claude_code_check_its_own_code_for_security
