security · git:20260926.b417e97 · 2026-09-26 · sha256 a872ce1aefa56602

security git:20260926.b417e97A

Immutable. This exact content never changes and is served at /api/v1/blob/a872ce1aefa56602.

---
description: Security rules. Validate inputs, no leaks, no wildcard CORS.
globs: ["*.php","*.ts","*.tsx","*.js","*.jsx","*.py","*.go","*.rs"]
alwaysApply: true
---

[FILE] security.mdc
[OBJ] Security constraints.
[RULES]
1. [REQ] `[SEC-01]` Zero-trust validation. FormRequest/DTO for inputs.
2. [REQ] `[SEC-02]` Parameterized queries. No raw SQL interpolation.
3. [REQ] `[SEC-03]` Whitelist `$fillable`. No `$guarded = []`.
4. [REQ] `[SEC-04]` No PII/credentials in logs/commits.
5. [REQ] `[SEC-05]` Enforce RBAC (Filament Shield / policy gates).
6. [REQ] `[SEC-06]` Sanitize HTML outputs (DOMPurify).
7. [REQ] `[SEC-07]` Explicit DTO projections for client.
8. [REQ] `[SEC-08]` Encrypt at rest; private signed URLs.
9. [REQ] `[SEC-09]` API throttling & rate-limiting.
10. [REQ] `[SEC-10]` JWT in HttpOnly cookies. Regenerate session on login.
11. [PROHIBIT] No CORS wildcard `*`. No plaintext passwords. No internal traces in API.
12. [REQ] `[SEC-12]` Audit against OWASP Top 10 **2025** (A01 access-control incl. SSRF/BOLA/BFLA, A03 supply-chain, A10 exceptional-conditions). Full vuln matrix: `tech-stack/appsec-hardening.md`.
13. [REQ] `[SEC-13]` Fail-closed defaults — errors deny, never `except: allow`. CSRF token or Origin check on state changes.
14. [REQ] `[SEC-14]` Desktop/local-UI: secrets in OS keyring (never QSettings/plaintext); local servers bind 127.0.0.1 + session token; updaters signed + verified; URL schemes/deep-links = untrusted input.