---
globs:
  - "src/**/*.ts"
  - "*.json"
---

# Security Baseline

- **Input validation:** All user input validated with Zod schemas
- **Path validation:** Prevent directory traversal — resolve and check `startsWith(base)`
- **Secrets:** Never hardcode — use environment variables only
- **Command injection:** Never pass user input to shell strings — use array args: `execa('git', ['checkout', branch])`
- **File permissions:** `0o644` default, `0o600` for sensitive files, respect user umask
- **No `eval()`** or dynamic imports from untrusted sources
- **Events are append-only** — never modify, write as read-only (`0o444`)
- **Validate STATE.json** against schema on every read
- **Error messages:** Don't leak file paths or sensitive info
- **Dependencies:** `npm audit` in CI, commit `package-lock.json`, use `npm ci`
