CI / CI configuration security checks (push) Successful in 6s
CI / Python tests and compilation (push) Failing after 12s
CI / QMD unit tests (push) Skipped
CI / Capabilities and shell quality (push) Successful in 1m50s
CI / Build and inspect generated packages (push) Skipped
CI / Bash integration and installation guards (push) Skipped
CI / Installed client configuration smoke tests (push) Skipped
CI / PowerShell tests on Ubuntu (push) Failing after 7m24s
2.3 KiB
2.3 KiB
Web and frontend security
Apply these rules when changing browser code, cookies, redirects, or defenses against XSS and CSRF.
- Escape or sanitize untrusted content; never inject untrusted HTML. Bypass framework sanitization (for example Angular
bypassSecurityTrust*or ReactdangerouslySetInnerHTML) only for compile-time constants, developer-controlled values, or the output of a maintained sanitizer, and state the reason in a comment at the call site. - Encode output for its exact context (HTML, attributes, JavaScript, CSS, or URL). Prefer text APIs and framework-safe templates; use a maintained sanitizer only when rich HTML is required.
- Protect state-changing browser requests from CSRF where applicable; validate origin or anti-CSRF tokens and do not treat CORS as authorization.
- Use
HttpOnly,Secure, and appropriateSameSitecookie settings for sensitive sessions; session rotation follows the authentication rule. - Validate redirect targets against an allowlist. Avoid sensitive data in URLs, referrers, browser history, analytics, and error reports.
- Apply a restrictive Content Security Policy and clickjacking protection (
frame-ancestors) where applicable. Do not weaken security headers to accommodate unsafe inline content without a reviewed design. - Treat frontend code, source maps, and browser storage as visible, and never rely on client-side checks for authorization.
- Never place server secrets (API keys, client secrets, signing or encryption keys, connection strings) in frontend code, bundles, public runtime configuration, or browser storage.
- For user sessions in browser apps, prefer
HttpOnlycookies or a backend-for-frontend (BFF) that keeps OAuth tokens on the server. If the browser app must hold tokens, keep access tokens in memory and short-lived, use refresh-token rotation, and never store refresh tokens inlocalStorageorsessionStorage(RFC 10017, OAuth 2.0 for Browser-Based Applications). This is the single rule for browser token handling; language and framework rules defer to it. - Protect state-changing operations against unintended form submissions; require explicit confirmation for high-impact actions.
- Keep dependencies and third-party scripts minimal. Apply integrity and origin controls to externally hosted resources where supported.