How to fix: Base64-Encoded Secret Pattern Detected
A Base64-encoded string that decodes to a secret, token, or credential pattern was found in the response. AI-generated code sometimes 'encodes' secrets as Base64 under the mistaken impression that encoding is encryption.
Why it matters
Base64 is not encryption; it is trivially reversible. Anyone who sees the encoded value can decode it in seconds. Encoding secrets provides no security protection and creates a false sense of obscurity.
AI tools sometimes produce patterns like `Buffer.from('username:password').toString('base64')` embedded in source code or API responses, believing this 'secures' the credential. It does not; it only obscures it slightly for a human reader, not for any automated system.
How to fix it
- 1Never store credentials as Base64 in source code or responses.
- 2Use environment variables for all secrets.
- 3Treat Base64 as transparent encoding, not encryption.
- 4Rotate any credentials that were ever exposed as Base64 in source code.
Code examples
Correct: environment variables
// Bad (AI-generated, Base64 is NOT encryption)
const auth = Buffer.from('admin:password123').toString('base64');
// Good
const auth = Buffer.from(`${process.env.API_USER}:${process.env.API_PASS}`).toString('base64');References
Detected automatically by VulnRadar. The check id is vibe-base64-sensitive, stable across every scan so you can filter or diff on it.
More ai code checks
- LowGeneric Error Messages Leak No Context
- MediumTODO/FIXME Security Note in Response
- Higheval() Usage in Page Scripts
- HighSSL Certificate Verification Disabled
- HighMath.random() Used for Security Tokens
- CriticalHardcoded Credential in Authentication Logic
- CriticalJWT 'none' Algorithm Accepted
- CriticalSQL String Concatenation Pattern Detected
Questions
- How severe is Base64-Encoded Secret Pattern Detected?
- VulnRadar rates this high severity in the ai code category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id vibe-base64-sensitive, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Base64-Encoded Secret Pattern Detected map to?
- It maps to CWE-312. In the OWASP Top 10 it falls under A02:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.