SPB Git

Repository Public

security.md 3.4 KB

# Security

# Threats considered and the answer to each

Threat Control
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.
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).
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.
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.
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.
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.
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.
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.
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.
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.
XSS / third-party scripts React escaping everywhere; CSP default-src 'self' with no external origin; no analytics, fonts or CDN.
Clickjacking, sniffing, downgrade frame-ancestors 'none', X-Frame-Options: DENY, nosniff, HSTS.

# What is deliberately not claimed

  • script-src and style-src allow 'unsafe-inline' (Next.js inline bootstrap). No user-supplied HTML is ever rendered.
  • The rate limiter is in memory: it resets when the process restarts.
  • 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.
  • Notarization is checked on the stapled ticket and Gatekeeper assessment of the disk image. It says nothing about what the application does.

# Secrets

.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.

# Recovery

Lost passkey → on the node: cd ~/apps/orix-spboucher-ai && pnpm enroll --recovery. The new passkey replaces every earlier one and signs every device out.

Files main
Menu

Theme