Files
MyAiConfiguration/shared/rules/security/references/auth.md
T
Julian LechnerandClaude Opus 5.5 368cf5ee4a docs(security): add logging and client app rules, close coverage gaps
New focused rules: security logging and audit (events to log, log
injection, what never to log, tamper-evident audit trails) and desktop
and mobile client apps (shipped code is public, platform secret stores,
pinning with rotation, signed updates, WebView limits).

Existing rules gain inbound webhook verification in api, GDPR handling
of personal data in data, container and infrastructure-as-code
hardening in supply-chain, and post-quantum key establishment with
ML-KEM (FIPS 203) in a hybrid construction in crypto. Security testing
of a third-party or public target now needs one confirmation of
ownership or permission. Duplicate authorization bullets in auth and
api are merged, and webhook routing distinguishes inbound from outbound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 10:03:44 +01:00

15 lines
2.1 KiB
Markdown

# Authentication and authorization security
* Use established authentication standards and password hashing; never store plaintext or reversibly encrypted passwords.
* Hash passwords with Argon2id (at least m=19 MiB, t=2, p=1); if unavailable, scrypt (N=2^17, r=8, p=1), bcrypt (cost 10 or higher; inputs beyond 72 bytes are truncated, so reject or pre-handle longer passwords), or PBKDF2-HMAC-SHA256 with at least 600,000 iterations where FIPS compliance requires it (OWASP Password Storage Cheat Sheet). Never create password schemes or reduce work factors merely to improve latency; rehash on login when parameters are raised.
* Enforce authorization server-side, deny by default, and check it on every request and sensitive operation, including background jobs and alternate API paths. Verify resource ownership and tenant boundaries, and do not trust role or identity values supplied by clients.
* Use least-privilege roles, short-lived sessions or tokens, secure renewal and revocation, and invalidate credentials after password, recovery, or privilege changes.
* Validate JWTs as RFC 8725 recommends:
* Fix the accepted algorithms on the server, bind each key to exactly one algorithm, and never take the algorithm from the token header; reject `none`.
* Validate signature, issuer, audience, expiry, and not-before, with bounded clock skew. Use explicit typing (`typ`, for example `at+jwt`) or distinct audiences to prevent substituting one token kind for another, such as an ID token for an access token.
* Resolve the `kid` header only against a trusted key set, and treat it as untrusted input. Never fetch keys from token-supplied `jku`, `x5u`, or `jwk` headers.
* Signed JWT payloads are readable by anyone; keep sensitive data out of them.
* Protect login, recovery, reset, MFA, and privileged actions against brute force, enumeration, replay, CSRF, and privilege escalation.
* Store session identifiers securely; rotate them after authentication or privilege changes and invalidate them on logout or account recovery.
* Test unauthenticated, unauthorized, cross-user, cross-tenant, expired-token, revoked-session, and recovery-flow paths.