Security
Note for AI agents: This page is baseline guidance, not an exact prescription. Read it, tell your owner what applies to their project, and get their approval before you change anything. Your project's own rules take precedence. If something important for this project is missing here, suggest it to your owner.
For agents
- Security rules grow with the project class: S is basics, M adds accounts and keys, L adds admin panels, uploads and many users, XL adds leak detection.
- Most serious findings in practice: missing server-side permission checks, secrets in code, and unchecked uploads.
- Always report findings to the owner before fixing; do not change security behavior silently.
Which class?
This topic has items from class S. The blocks below are cumulative: read up to your own class.
- S: 6 items
- M: 10 items
- L: 12 items
- XL: 1 items
Audit checklist
Every project
- HTTPS everywhere
- What: The site or API is served only over HTTPS, and HTTP redirects to it.
- How to check: Request the
http://address and confirm a redirect; check for a Strict-Transport-Security header; check for mixed content. - Evidence: Response headers of the first request; browser console without mixed-content warnings.
- No secrets in code, chat, commits or logs
- What: Passwords, keys and tokens live in environment variables or a secret manager;
.envis ignored by git; the repository has only.env.example. - How to check: Check
.gitignorefor.env; run a secret scanner (for example gitleaks) over the full history; search for key-like strings. - Evidence:
.gitignoreline, scanner report with zero findings,.env.examplepath.
- What: Passwords, keys and tokens live in environment variables or a secret manager;
- Third-party scripts are pinned and integrity-checked
- What: External scripts, if any, are loaded with a fixed version and a Subresource Integrity hash.
- How to check: Search templates for
<script src="http; check forintegrity=attributes and version numbers in the URL. - Evidence: List of external scripts with version and integrity values, or “none”.
- Forms have spam and bot protection and a retention rule
- What: Contact or sign-up forms are protected against spam and bots, and the page states how long submitted data is kept (or no data is stored).
- How to check: Find the form handler; look for a challenge, honeypot or rate limit; find the retention statement.
- Evidence: Handler code or service setting; retention text.
- Security headers and safe defaults are on
- What: Services start with secure defaults: HTTPS only, restrictive CORS, security headers, no debug mode in production, directory listing off.
- How to check: Start the production build and read response headers, error pages and settings for debug flags.
- Evidence: Header output; production settings file.
- Injection is prevented by construction
- What: Database queries are parameterized, output is encoded for its context (HTML, URL, shell), and no user input becomes a command or file path unchecked.
- How to check: Search for string-built SQL,
innerHTML, shell calls and file path joins with user input. - Evidence: Search results; injection test cases.
+ If it has users, personal data or API keys (M)
- Authentication uses a mature library or service
- What: Login is built with a well-known library or hosted service; no home-made cryptography; passwords are hashed with a current algorithm.
- How to check: Find the login code; check the password hashing function (for example Argon2id, scrypt, bcrypt); search for hand-written crypto.
- Evidence: Library name and version; hashing configuration.
- Sessions expire and can be revoked
- What: Sessions have a lifetime, can be ended by the user and by the server, and are invalidated after a password change.
- How to check: Read the session configuration; test: sign in on two devices, change the password, see if the other session ends.
- Evidence: Configuration lines; test result.
- All input is validated on the server with a schema
- What: Every request body, query and parameter is checked on the server against a schema; the client check is only a convenience.
- How to check: For each endpoint find the schema or validator; send invalid, oversized and unexpected fields and see the response.
- Evidence: Validator files per endpoint; test cases for invalid input.
- Permissions are checked on the server
- What: Every action checks who the user is and what they may do on the server; a hidden button is not security.
- How to check: Call each protected endpoint without a session and with the wrong user; read the permission checks in the handlers.
- Evidence: Test names for unauthenticated and wrong-user requests; code lines of the checks.
- External API keys stay on the server
- What: Third-party API keys (including LLM keys) are kept on the server and never shipped to the browser or app.
- How to check: Search the client bundle and app package for key-like strings; check that client calls go to your own server.
- Evidence: Search result with zero keys in the client build.
- Logs contain no personal data or secrets
- What: Logs do not record passwords, tokens, keys or personal data; if needed they are masked.
- How to check: Read the logging setup; trigger a login and a form and inspect the log lines; search for e-mail and token patterns.
- Evidence: Sample log lines after a test run showing masking.
- Sign-up is hardened
- What: Disposable e-mail blocking, one account per inbox (ignoring
+tagand Gmail dots), e-mail verification, notification and undo on e-mail change, leaked-password check, per-account attempt limits, bot protection, and a session list with remote sign-out. - How to check: Walk through registration, e-mail change and password reset; read the limits in code; try the same inbox with a
+tag. - Evidence: Test names or screenshots for each item; limit values.
- What: Disposable e-mail blocking, one account per inbox (ignoring
- Known vulnerable dependencies are tracked
- What: Dependencies are scanned for known vulnerabilities on a schedule and before release, and findings are triaged by severity.
- How to check: Run the ecosystem audit command (for example
npm audit,pip-audit,govulncheck) and read the CI scan step. - Evidence: Latest scan output; triage notes.
- There is a way to react to a leak or breach
- What: A short written note says who is told, which keys are rotated and how users are informed if something leaks.
- How to check: Find the note and check that key rotation is possible without long downtime.
- Evidence: Incident note; rotation test.
- Secret scanning runs before push and in CI
- What: A scanner (for example gitleaks or secretlint) runs before code is pushed and in CI.
- How to check: Find the hook or CI step that runs the scanner.
- Evidence: Hook file or CI step; latest clean run.
+ If it has an admin panel, file uploads, many users or a store app (L)
Items for class L: see Security: classes L–XL checklist.
+ If it targets millions of users (XL)
Items for class XL: see Security: classes L–XL checklist.
Common mistakes
- Secrets in commits, chat messages or logs; a pasted key must be treated as leaked and replaced.
- Permission checks only in the interface.
- Trusting client-side validation.
- One shared admin account without two-step verification.
- Rate limits keyed only by IP in front of mobile carriers.
- Checking a balance, then writing it, instead of a conditional update.
- Cross-origin settings allowing every origin.
- Security headers never set because the site is ‘only static’.
Sources
- OWASP Top 10 — OWASP
- Application Security Verification Standard (ASVS) — OWASP
- OWASP API Security Top 10 – 2023 — OWASP
- Web Security Testing Guide — OWASP
- Authentication Cheat Sheet — OWASP Cheat Sheet Series
- Session Management Cheat Sheet — OWASP Cheat Sheet Series
- Password Storage Cheat Sheet — OWASP Cheat Sheet Series
- Input Validation Cheat Sheet — OWASP Cheat Sheet Series
- Cross Site Scripting Prevention Cheat Sheet — OWASP Cheat Sheet Series
- SQL Injection Prevention Cheat Sheet — OWASP Cheat Sheet Series
- Cross-Site Request Forgery Prevention Cheat Sheet — OWASP Cheat Sheet Series
- Insecure Direct Object Reference Prevention Cheat Sheet — OWASP Cheat Sheet Series
- Secrets Management Cheat Sheet — OWASP Cheat Sheet Series
- Logging Cheat Sheet — OWASP Cheat Sheet Series
- HTTP Headers Cheat Sheet — OWASP Cheat Sheet Series
- Content Security Policy Cheat Sheet — OWASP Cheat Sheet Series
- SP 800-63B: Digital Identity Guidelines (Authentication) — NIST
- SP 800-218: SSDF Version 1.1 — NIST
- Content Security Policy (CSP) — MDN Web Docs
- Strict-Transport-Security header — MDN Web Docs
- Pro Build Guide v1.2: compiled team practices — Pro Build Guide