Advanced Website & App Security Checklist (20 Checks)
20 advanced website and app security checks with clear explanations and copyable Claude prompts. Free PDF covering authentication, tokens, proxies and more.
Get the PDF
Free. No email or account needed. PDF · 122 KB
The preview only loads when you tap "Read PDF here", which saves mobile data. Download gives you the original PDF file.
Key takeaways
- Review 20 advanced security risks
- Copy prompts for checks relevant to your stack
- Verify fixes and document infrastructure limits
Review 20 advanced security risks in AI-coded websites and apps. This free checklist includes explanations and copyable Claude prompts for authentication, tokens, cryptography, proxies, database views, parsers and WebSockets. Use it alongside the Complete Website & App Security Checklist. Apply checks that match your stack and verify changes with tests; a checklist cannot guarantee security.
How to use this checklist
Download the PDF, review each relevant check, and mark it only after inspecting the implementation and testing it. The prompts below are reference material to adapt to your application. Infrastructure checks may require access to your hosting configuration.
1. Prevent 52-Character Username Truncation
If a database column caps usernames at 50 characters without backend validation, registering "admin" padded with spaces gets trimmed to "admin", letting attackers impersonate accounts.
Claude prompt:
Add strict input validation before database queries to reject usernames longer than 30 characters instead of letting SQL truncate them, and trim whitespace.
2. Block Unicode Homograph Username Cloning
Attackers swap Latin letters like "a" with lookalike Cyrillic "а" to create identical-looking usernames and scam users. Normalize strings and restrict allowed characters.
Claude prompt:
Normalize all usernames using Unicode NFKC normalization and enforce an ASCII-only alphanumeric regex (/^[a-zA-Z0-9_]+$/) during registration.
3. Stop Forged SAML Logins (XML Signature Wrapping)
Apps sometimes verify a valid signature on one part of a SAML XML payload while reading login attributes from an unsigned section injected elsewhere.
Claude prompt:
Audit our SAML authentication handler so user attributes are extracted strictly from the exact signed assertion element verified by the library.
4. Prevent Microsoft OAuth Email Spoofing
Trusting mutable email claims in Microsoft OAuth/OIDC tokens lets organization admins alter emails to hijack accounts. Always link accounts using immutable tenant and object IDs.
Claude prompt:
Update Microsoft OAuth/OIDC login logic to identify and link users using the immutable combination of 'tid' (Tenant ID) and 'oid' (Object ID) instead of 'email'.
5. Block 2FA Brute-Force via GraphQL Aliases
Attackers send 500 aliased verify2FA mutations inside a single HTTP POST request to bypass HTTP-level rate limiters and guess 6-digit codes.
Claude prompt:
Add GraphQL query alias and complexity limits, and enforce a strict per- user failed-attempt lockout directly inside the verify2FA resolver.
6. Prevent 2FA TOTP Code Replay
A 6-digit authenticator code stays valid for 30 seconds. If you do not mark a used code as consumed, an attacker can replay the same code within that window.
Claude prompt:
Store each successfully used TOTP code per user in Redis/cache with a 60-second TTL, and reject any login attempt that reuses a recently consumed code.
7. Fix JWT Public Key Algorithm Confusion
If your server trusts the "alg" header inside a JWT, an attacker can switch RS256 to HS256 and forge valid tokens signed using your public RSA key.
Claude prompt:
Pass an explicit allowed algorithms whitelist (e.g., algorithms: ['RS256']) to jwt.verify() everywhere so tokens cannot be downgraded to HS256.
8. Replace Predictable Math.random() Tokens
Math.random() is not cryptographically secure. Attackers can predict password reset links, invite codes, or session IDs generated with it.
Claude prompt:
Replace every usage of Math.random() used for tokens, OTPs, session IDs, or invite codes with crypto.randomBytes() or crypto.randomUUID().
9. Eliminate Token Timing Attacks
Comparing API keys or webhook secrets with standard "===" returns early on the first mismatched character, leaking secret characters via response timing.
Claude prompt:
Replace standard string equality checks (===) on API keys, webhook signatures, and secret tokens with constant-time crypto.timingSafeEqual().
10. Fix Cookie Padding Oracle Vulnerabilities
Encrypting cookies with AES-CBC without an integrity tag leaks padding error differences, allowing attackers to decrypt and forge session cookies byte-by-byte.
Claude prompt:
Migrate custom AES-CBC cookie or payload encryption to authenticated encryption using AES-256-GCM with unique IVs and authentication tags.
11. Mitigate HTTP/2 Rapid Reset DDoS
Opening and immediately cancelling HTTP/2 streams in rapid loops overwhelms backend workers unless stream concurrency and RST_STREAM rates are capped.
Claude prompt:
Configure strict HTTP/2 stream concurrency limits and RST_STREAM rate- limiting in our server and reverse-proxy configuration.
12. Block HTTP Request Smuggling
Disagreements between a front-end proxy and backend server over Content-Length and Transfer-Encoding headers let attackers smuggle hidden admin requests.
Claude prompt:
Configure our HTTP server and reverse proxy to reject requests containing both Content-Length and Transfer-Encoding headers.
13. Prevent Web Cache Poisoning via Headers
Reflecting unkeyed headers like X-Forwarded-Host inside HTML responses lets attackers poison CDN caches and serve malicious scripts to all visitors.
Claude prompt:
Remove all reflection of unkeyed headers like X-Forwarded-Host in responses, and generate redirect or asset URLs strictly from environment variables.
14. Stop Rate-Limit Bypass via Spoofed IP Headers
Reading client IPs directly from untrusted X-Forwarded-For headers lets attackers send fake IPs on every request to bypass rate limits.
Claude prompt:
Configure trusted proxy hops accurately or read client IPs strictly from verified edge headers like CF-Connecting-IP.
15. Enforce Row-Level Security (RLS) on SQL Views
In PostgreSQL and Supabase, standard Views execute with the view creator's permissions by default, bypassing Row-Level Security policies on underlying tables.
Claude prompt:
Audit all PostgreSQL/Supabase VIEW definitions and recreate them with 'WITH (security_invoker = true)' so they enforce the querying user's RLS policies.
16. Prevent Server Freeze via Regex (ReDoS)
Regular expressions with nested quantifiers suffer catastrophic backtracking on crafted strings, locking the server CPU at 100%.
Claude prompt:
Refactor nested quantifiers into linear-time regex patterns and enforce maximum input string lengths before running regex checks.
17. Block Prototype Pollution to RCE
Recursively merging untrusted JSON containing "proto" or "constructor.prototype" corrupts global JavaScript objects and can lead to remote code execution.
Claude prompt:
Harden all deep-merge and object-assignment utilities by explicitly blocking '__proto__', 'constructor', and 'prototype' keys.
18. Prevent Server-Side Template Injection (SSTI)
Concatenating user input directly into template strings (EJS, Pug, Jinja) instead of passing it as data context allows attackers to execute arbitrary server code.
Claude prompt:
Ensure user input is never concatenated into template strings directly, and is always passed safely through the template data context object.
19. Disable XML External Entities (XXE)
Parsing uploaded XML files with DTD and external entity resolution enabled allows attackers to read local server files like /etc/passwd.
Claude prompt:
Configure all XML parsers in the application to disable DTD processing and external entity resolution completely.
20. Stop Cross-Site WebSocket Hijacking (CSWSH)
If WebSocket handshakes rely solely on browser cookies without verifying the Origin header, malicious sites can open authenticated WebSocket connections as the victim.
Claude prompt:
Validate the Origin header against allowed domains during WebSocket upgrades and require a short-lived one-time authentication ticket.
Final instruction for Claude
Do not just tell me my website or app is secure.
Check every one of these 20 security points carefully across my codebase and show me the exact vulnerabilities you found.
Fix the problems cleanly without breaking existing features or changing how my app works.
Test every fix and verify the security checks again.
If something depends on cloud infrastructure and cannot be verified in code alone, clearly tell me. Do not guess and do not claim my app is 100% secure.