API Security Checklist: Base64, JWT and Hashing Done Right
Base64 is not encryption, JWT payloads are readable, and MD5 is not a password hash. A practical checklist for getting the basics right.
Most API breaches do not come from exotic cryptography. They come from three misunderstandings that refuse to die: that Base64 hides data, that a JWT is encrypted, and that a fast hash is a password hash.
Here is a checklist you can run against any API in an afternoon.
1. Base64 is encoding, not encryption
Base64 turns bytes into printable characters. Anyone can decode it in one line:
atob('c2VjcmV0') // "secret"
Rule: never put secrets, tokens or personal data in Base64 and call it protected. Use it for transport of binary data, not for confidentiality. Decode suspicious payloads with the Base64 Encoder / Decoder.
2. A JWT is signed, not encrypted
The header and payload of a JWT are Base64URL-encoded JSON. Anyone holding the token can read the claims. The signature only proves the token was issued by someone with the key.
Rule: never store secrets, passwords or sensitive personal data in JWT claims. Inspect tokens with the JWT Decoder before shipping.
3. Validate JWTs properly
- Verify the signature with the correct algorithm — reject
alg: none. - Check
exp,nbfandiat. - Validate
issandaud. - Keep clock skew small (a minute or two at most).
- Never trust a claim just because it is present.
4. Hash passwords with a slow algorithm
| Algorithm | Use for passwords? |
|---|---|
| MD5 / SHA-1 | No — fast and broken |
| SHA-256 (plain) | No — fast, brute-forceable |
| bcrypt / scrypt | Yes |
| Argon2id | Yes — preferred where available |
Use a per-user salt (built into bcrypt/Argon2) and a sensible work factor. Rehash on login when you raise it. The Hash Generator is for checksums and quick digests — not for passwords.
5. Keep secrets out of the client
- No API keys in frontend bundles.
- No service-role database credentials in a browser.
- Rotate anything that has ever been committed.
- Use short-lived tokens for third-party services.
6. Lock down the response surface
- Return only the fields the client needs.
- Never echo stack traces in production.
- Use consistent error shapes that do not leak whether an email exists.
- Rate-limit authentication and password reset endpoints.
7. Set the headers
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
Content-Security-Policy: default-src 'self'
Referrer-Policy: strict-origin-when-cross-origin
8. Validate input at the boundary
Schema validation at the edge (zod, pydantic, JSON Schema) prevents a whole class of injection and type-confusion bugs. Reject unknown fields by default.
Security is mostly a series of small, boring decisions made consistently. The exotic attacks are rare; the basics are not.
Quick audit checklist
- No secrets in Base64 or JWT payloads.
- JWT signature, issuer and expiry all verified.
- Passwords hashed with bcrypt/Argon2id.
- No credentials in client bundles.
- Rate limits on auth endpoints.
- Security headers present.
- Input validated and unknown fields rejected.
Run this list against every new endpoint. It takes minutes and catches the mistakes that show up in breach reports.
Practical write-ups on AI tooling and developer utilities from the team behind DevToolAI. Every guide is tested against the tools we ship.