# AGENTS.md: Security baseline

Apply these to every change, in any language.

## Secrets
- Never hard-code or print keys, tokens, or passwords. Read them from env/secret manager. Add new names to `.env.example` with fake values.
- If you find a committed secret, stop and report it; don't just delete the line (it's in git history and must be rotated).

## Input and output
- Validate all external input (body, query, headers, files, webhooks) with a schema at the boundary.
- SQL only via parameterized queries/ORM. Shell commands only via argument arrays, never string concatenation with user input.
- Encode output for its context; don't bypass the framework's escaping (`dangerouslySetInnerHTML`, `|safe`, `v-html`, `html_safe`) with user data.
- Uploads: check type and size, store outside the web root with random names.
- Fetching user-supplied URLs needs an allowlist (SSRF).

## Access control
- Check authorization on the server for every request and every object (`resource.owner_id == user.id`), not just in the UI.
- Deny by default; new routes require auth unless explicitly public.
- Webhooks verify signatures; sessions/cookies use `HttpOnly`, `Secure`, `SameSite`.

## Dependencies
- Add packages only when necessary; check they're maintained and correctly named (typosquatting). Run the ecosystem audit (`npm audit`, `pip-audit`, `cargo audit`, `govulncheck`).

## Logging
- Log security events (login, permission denied) without tokens, passwords or full PII.

## Report
End with a short "Security notes" section listing anything risky you noticed but didn't change.
