Release v0.27.0: security hardening (audit 0026)
Remediates the rfc-app application + deploy-config findings from the Session 0026 security audit. Cut as the "v0.25.0-security-hardening" branch (from v0.24.0); reversioned to 0.27.0 on rebase onto main since v0.26.0 (#28) shipped while this was in flight. - C1 (Critical): single sanitizeHtml.js chokepoint (DOMPurify) for every marked→innerHTML / dangerouslySetInnerHTML sink (MarkdownPreview, ProposalView x2, Editor); rel=noopener hook on target=_blank links. - H1: per-account OTC-verify lockout (migration 023, auto-applied) + per-IP throttle via new ratelimit.py; wired on otc verify/request + passcode check/verify. - M1: device_trust.lookup() single indexed-row read — cookie value is now "<row_id>.<raw_token>"; bcrypt-checks one row, not a global table scan. (Behavior change: existing device-trust cookies re-prompt once.) - M2: HTTP security headers (CSP/HSTS/XFO/XCTO/Referrer-Policy) at nginx. - M4: session cookie Secure-by-default (SESSION_COOKIE_SECURE opt-out). - M5: bounce webhook fails CLOSED (503) when secret unset, instead of open; RFC_APP_INSECURE_BOUNCE_WEBHOOK=1 dev opt-in. - L2/L3: per-IP cooldown + check-endpoint throttle. - L4: systemd sandbox knobs. L8/I1: nginx server_tokens off + TLS1.0/1.1 out. VERSION + frontend/package.json → 0.27.0; CHANGELOG documents the upgrade steps (incl. the out-of-band nginx + systemd apply, which the flotilla deploy gesture does not perform). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,68 @@ skip versions are the composition of each intervening adjacent
|
||||
release's steps in order — no A-to-B path is pre-computed beyond
|
||||
that.
|
||||
|
||||
## 0.27.0 — 2026-05-28
|
||||
|
||||
**Minor — security-hardening release (Session-0026 audit remediation).
|
||||
One auto-applied migration (023); one behavior change that re-prompts
|
||||
device-trust; deployments MUST re-apply the nginx + systemd files.**
|
||||
This is the work cut as the "v0.25.0 security-hardening" branch; it
|
||||
reversioned to 0.27.0 because v0.26.0 (#28) took the next slot while it
|
||||
was in flight. Shipped from driver session 0030.0.
|
||||
|
||||
- **C1 (Critical) — stored-XSS closed.** Every markdown→HTML sink now
|
||||
routes through one chokepoint, `frontend/src/lib/sanitizeHtml.js`
|
||||
(DOMPurify), before any `innerHTML` / `dangerouslySetInnerHTML` write:
|
||||
`MarkdownPreview`, both `ProposalView` sinks (entry body +
|
||||
`proposed_use_case`), and `Editor`. A hook adds
|
||||
`rel="noopener noreferrer"` to `target=_blank` links. `marked` no
|
||||
longer passes raw HTML / `javascript:` URIs to the DOM, so a
|
||||
contributor can no longer plant a payload that runs in an admin/owner
|
||||
session during review.
|
||||
- **H1 — OTC verify is rate-limited.** New `backend/app/ratelimit.py`
|
||||
(per-IP token buckets) gates `/auth/otc/verify`, `/auth/otc/request`,
|
||||
and the passcode check/verify paths; a per-account OTC-verify lockout
|
||||
(migration `023_otc_verify_lockout.sql`) mirrors the passcode lockout.
|
||||
- **M1 — device-trust lookup no longer table-scans.** The device-trust
|
||||
cookie value is now `"<row_id>.<raw_token>"`; `device_trust.lookup`
|
||||
reads the one indexed row and bcrypt-checks only it, instead of
|
||||
bcrypt-checking every row in the table on each unauthenticated
|
||||
`/auth/device-trust/start`.
|
||||
- **M2 — HTTP security headers** (CSP, HSTS, X-Frame-Options,
|
||||
X-Content-Type-Options, Referrer-Policy) added to the nginx server
|
||||
block. **L8/I1**: `server_tokens off` + legacy TLS1.0/1.1 removed.
|
||||
- **M4 — session cookie `Secure` by default** (`SESSION_COOKIE_SECURE`,
|
||||
defaults on; a dev box on plain http sets it `false`).
|
||||
- **M5 — bounce webhook fails closed.** An unset
|
||||
`WEBHOOK_EMAIL_BOUNCE_SECRET` now **disables** `/api/webhooks/email-bounce`
|
||||
(503) instead of leaving it open; a dev opts back in with
|
||||
`RFC_APP_INSECURE_BOUNCE_WEBHOOK=1`.
|
||||
- **L2/L3** per-IP cooldown + check-endpoint throttle. **L4** systemd
|
||||
sandbox knobs (`CapabilityBoundingSet=`, `ProtectKernel*`,
|
||||
`RestrictAddressFamilies`, `SystemCallFilter`, …).
|
||||
|
||||
Upgrade steps:
|
||||
|
||||
1. **Migration** — none manual; `023_otc_verify_lockout.sql` auto-applies
|
||||
at startup via `db.run_migrations`.
|
||||
2. **Device trust (MUST expect re-prompt)** — the cookie format changed,
|
||||
so existing "trusted device" cookies no longer match; affected users
|
||||
are re-prompted for device verification once. No data migration; old
|
||||
rows are simply never matched and age out.
|
||||
3. **nginx + systemd (MUST apply out-of-band)** — the deploy gesture does
|
||||
**not** install `deploy/nginx/ohm.wiggleverse.org.conf` or
|
||||
`deploy/systemd/rfc-app.service`. After deploying the code, copy both
|
||||
to their system locations, then `nginx -t && systemctl reload nginx`
|
||||
and `systemctl daemon-reload && systemctl restart <unit>`. (M2 headers
|
||||
and L4 sandboxing do not take effect until this is done.)
|
||||
4. **Bounce webhook (SHOULD)** — bind `WEBHOOK_EMAIL_BOUNCE_SECRET` (or
|
||||
set `RFC_APP_INSECURE_BOUNCE_WEBHOOK=1` for dev). Unset → the endpoint
|
||||
returns 503 (closed). No legitimate bounce source is wired today, so
|
||||
503 is the safe default.
|
||||
5. **Session cookie (SHOULD, dev only)** — a deployment served over plain
|
||||
http MUST set `SESSION_COOKIE_SECURE=false` or the session cookie
|
||||
won't be sent. Production over HTTPS leaves it unset (Secure on).
|
||||
|
||||
## 0.26.0 — 2026-05-28
|
||||
|
||||
**Minor — no schema migration, no new secret, no config, no upgrade
|
||||
|
||||
Reference in New Issue
Block a user