Security Audit Kit
A 7-step workflow to harden your application's security posture
This workflow is for developers and sysadmins who want to audit and improve the security of a web application or server environment. Follow the steps in order to cover credential hygiene, data protection, and HTTP security headers. By the end, you will have addressed the most common attack vectors — weak passwords, plaintext storage, unencrypted data, and misconfigured browser policies.
Generate Strong Credentials
Weak passwords are the leading cause of security breaches. Generate cryptographically random passwords for all service accounts, API keys, and admin credentials.
Test Existing Passwords
Before trusting an existing password, evaluate it against entropy calculations and common pattern detection. Anything below 70 bits of entropy should be replaced.
Hash Passwords for Storage
Never store plaintext passwords. Bcrypt adds an automatic salt and is deliberately slow — each hash takes milliseconds for you but makes brute-force attacks prohibitively expensive.
Hash Data for Integrity
Verify file integrity, create checksums for deployments, or generate deterministic identifiers. SHA-256 is the standard for checksums in security contexts.
Encrypt Sensitive Data
For data that needs to be recovered later (unlike hashes), AES-256 is the industry standard. Use it for encrypting tokens, config values, or any data stored outside your application.
Write Content Security Policy
CSP headers prevent XSS attacks by controlling what resources browsers can load. A well-configured CSP is one of the most effective defenses against script injection.
Configure CORS Headers
Misconfigured CORS is a common API vulnerability. Generate precise headers to allow only intended origins — a wildcard (*) on a credentialed endpoint is a critical security flaw.
Pro Tips
- Rotate credentials after every audit. Even a strong password becomes a liability if it has been in use for a year or more without rotation.
- Use a cost factor of 12 or higher for bcrypt in production. On modern hardware, cost 10 can be cracked faster than you expect as computing power grows.
- Test your CSP in report-only mode first (Content-Security-Policy-Report-Only) before enforcing it — a misconfigured policy can break your entire application.