K
Knacode Engineering Team
October 2025 ยท 11 min read

Authentication & Authorisation

โœ“ Passwords hashed with bcrypt (cost factor โ‰ฅ12) or Argon2, never stored in plain text or reversible encryption. โœ“ JWT tokens have expiry set; refresh token rotation implemented. โœ“ Password reset tokens are single-use and expire within 1 hour. โœ“ Rate limiting on all auth endpoints (login, register, password reset). โœ“ Account lockout after N failed attempts with exponential backoff. โœ“ All API endpoints verify authorisation โ€” not just authentication. โœ“ Role-based access control tested with negative test cases (users cannot access resources they don't own). โœ“ Admin routes protected by IP allowlist or separate auth layer.

Input Validation & Injection

โœ“ All database queries use parameterised statements or ORM โ€” zero string concatenation in SQL. โœ“ User input sanitised before rendering in HTML (XSS prevention). โœ“ Content-Security-Policy header configured and tested. โœ“ File upload validation: type checking by content (not extension), size limits, storage outside web root. โœ“ XML/JSON parsing libraries protected against XXE attacks. โœ“ Server-Side Request Forgery (SSRF) protection on any endpoint that makes outbound HTTP requests.

Secrets & Configuration

โœ“ No secrets in source code, ever. Verified with git-secrets or similar pre-commit hook. โœ“ All secrets stored in environment variables or secrets manager (AWS Secrets Manager, HashiCorp Vault). โœ“ Production secrets rotated from development secrets โ€” different database passwords, API keys, JWT secrets. โœ“ .env files in .gitignore and verified absent from git history. โœ“ Third-party API keys have minimum required permissions.

Transport Security

โœ“ HTTPS enforced everywhere; HTTP redirects to HTTPS. โœ“ HSTS header set with includeSubDomains and preload. โœ“ TLS 1.2 minimum; TLS 1.3 preferred. โœ“ Certificates auto-renewed. โœ“ Sensitive data encrypted in transit between internal services (not just external). โœ“ Database connections use TLS.

Infrastructure Hardening

โœ“ Principle of least privilege on all IAM roles and policies. โœ“ Security groups configured to allow only required ports and sources. โœ“ S3 buckets: public access blocked unless explicitly required; bucket policies audited. โœ“ Database not publicly accessible; accessible only from application subnet. โœ“ Logging enabled: CloudTrail, VPC Flow Logs, application logs to immutable storage. โœ“ Unused ports, services, and packages removed from server images.

Dependencies & Supply Chain

โœ“ npm audit / pip audit / bundle audit run; critical and high vulnerabilities resolved. โœ“ Dependency versions pinned (package-lock.json / requirements.txt committed). โœ“ Automated vulnerability scanning in CI pipeline (Dependabot or Snyk). โœ“ Docker base images from official/verified sources, regularly updated. โœ“ Software Bill of Materials (SBOM) generated for regulated industries.

Want a security audit of your product?

Tell us about your project and we'll respond within 24 hours with a clear, honest plan.

More from our blog