SPB Git

Repository Public

security.md 3.4 KB 34 lines markdown

1# Security23## Threats considered and the answer to each45| Threat | Control |6|---|---|7| The site distributes a tampered or wrong binary | An image is served only if an administrator approved it, its SHA-256 was recomputed by this server and matched the forge's, and (by policy) its notarization was verified with `xcrun stapler` / `spctl` on the Mac that hosts the site. Before each download the file size is compared again with the verified one. |8| A release is replaced on the forge after approval | The next sync sees a different size or checksum and withdraws the release automatically (`asset_changed_upstream`). |9| The download route is abused as a file or repository proxy | The path on disk comes from the database row, never from the request. Fetching at approval time is restricted to `https://git.spboucher.ai/releases/<expected repo>/…`, without redirects. |10| Private repository content leaks | The sync never requests a repository whose visibility is not `public`, and sends no credential at all. Private applications use `pnpm ingest` (shell, on the server) and still need approval. |11| A private TestFlight link is published | Only `https://testflight.apple.com/join/<code>` is accepted; an `internal` state never produces a link; a `public` link is shown only after the server verified it as open. |12| Admin account takeover | No password exists. WebAuthn passkeys with user verification required; enrolment only through a random, hashed, single-use, expiring token issued from the server's shell. |13| Session theft / CSRF | Cookie `HttpOnly; Secure; SameSite=Strict`, host-only. Every write needs the session's CSRF token in a header and a same-origin request. 12 h absolute lifetime, 60 min idle. |14| Brute force | Rate limits per client address on auth, webhook, click and download routes; lock-out after repeated failed sign-ins, derived from the audit trail. |15| Forged or replayed webhook | HMAC-SHA256 over `timestamp.nonce.body`, ±5 min window, each nonce accepted once. Without a configured secret the endpoint answers 404. |16| Malicious upload | Administrators only. Files are decoded and re-encoded by sharp (PNG/JPEG/WebP only, metadata dropped), stored under a content-hash name outside the web root, served with `nosniff` and a sandbox CSP. SVG is refused. |17| XSS / third-party scripts | React escaping everywhere; CSP `default-src 'self'` with no external origin; no analytics, fonts or CDN. |18| Clickjacking, sniffing, downgrade | `frame-ancestors 'none'`, `X-Frame-Options: DENY`, `nosniff`, HSTS. |1920## What is deliberately not claimed2122- `script-src` and `style-src` allow `'unsafe-inline'` (Next.js inline bootstrap). No user-supplied HTML is ever rendered.23- The rate limiter is in memory: it resets when the process restarts.24- The TestFlight check reads Apple's public page; Apple offers no API for it, so an unrecognized page is reported as `unknown` and no button is shown.25- Notarization is checked on the stapled ticket and Gatekeeper assessment of the disk image. It says nothing about what the application does.2627## Secrets2829`.env` on the node (mode 600, generated at first deployment, never in git): site URL, data directory, webhook secret. No Apple credential and no Git token is used by the site. `scripts/secret-scan.sh` runs before each commit.3031## Recovery3233Lost passkey → on the node: `cd ~/apps/orix-spboucher-ai && pnpm enroll --recovery`. The new passkey replaces every earlier one and signs every device out.34
Files main
Menu

Theme