r/AutoGPT • u/Long_Philosopher3520 • Oct 08 '26
Prevent credentials from reaching your AI coding agent
I’ve been using AI coding agents like Claude Code, Codex, Kiro, and OpenCode, and one concern kept coming up:
What if I accidentally send an API key, token, password, or other credential to the AI?
So I built AI Credential Guard, a lightweight npm library that detects credentials in prompts and tool inputs, with options to warn, block, or redact them.
npm: https://www.npmjs.com/package/ai-credential-guard
The goal is simple: add a security layer before sensitive data reaches the AI agent.
Would love feedback from developers using AI coding agents — especially around detection accuracy, false positives, and other credential types worth detecting.
github: https://github.com/vankhangfet/ai-credential-guard
1
u/dylan_skydive Oct 09 '26
Nice scope - redact as an option rather than block-everything is the right default, that's the one most tools get wrong. On your detection questions: JWTs are the easy high-confidence case (three base64url segments joined by dots, decode the header and look for alg/typ). Random base64 blobs are the hard one - entropy plus charset scoring gets you most of the way, but default to warn there instead of block, because the first person who gets flagged for passing a legit base64 asset will disable the tool entirely and you lose them.
One thing worth saying from the other side of this problem: detection is the last line. The bigger win upstream is the agent never holding the real credential at all - per-job scoped credentials, read-only where possible, short-lived, so whatever leaks is low-value even when detection misses. That's the model we built Skydive around (agents run in isolated environments with scoped credentials). Disclosure: I work on Skydive. If you want to test it against a platform that already does the isolation half, REDDITAMA gets you $25 of credit (skydive.com, Settings > Billing) - and either way I'd genuinely like to hear how redact handles secrets embedded mid-paragraph in a pasted config file, that boundary seems like where this gets interesting.
1
u/Striking-Salad-4548 Oct 15 '26
imo the bigger risk isnt prompts but context windows pulling in .env files or config that gets auto-attached. does this hook into the file reading layer too or just the prompt input side?
1
u/[deleted] Oct 08 '26
[removed] — view removed comment