Finish the audit leftovers

- One mediaUrl in media.ts instead of 12 identical aliases and a
  kind map; orgPath builds on hrefs.ts's orgHref
- One Logo component (hides itself or shows a fallback when the file
  is missing) for event cards, org lists and chapter marks
- useHistory is a thin wrapper over useRecord
- adminSchema.ts split into adminSchema/, one file per entity plus
  shared.ts; the registry is unchanged (checked by loading both)
- JS smooth scrolls respect reduced motion (lib/motion.ts)
- Content-Security-Policy in Report-Only, with /api/csp-report logging
  what it would block

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-28 22:49:07 -05:00
parent c74ad746f5
commit e4a9c96f7e
42 changed files with 1968 additions and 2043 deletions

View file

@ -12,9 +12,15 @@ carries Hono's `secureHeaders()` (`server/src/index.js`):
- `Referrer-Policy: strict-origin-when-cross-origin`: kept to the origin,
because YouTube embeds refuse to play without a referrer.
- `Cross-Origin-Opener-Policy` and `Cross-Origin-Resource-Policy: same-origin`
- no HSTS (nginx sends it, below) and no Content-Security-Policy yet
(it needs trying in Report-Only first: pages carry an inline
`window.__NGU_SITE__` script and YouTube, Facebook and Maps iframes).
- no HSTS (nginx sends it, below)
- `Content-Security-Policy-Report-Only`: blocks nothing yet. Browsers
post what it would have blocked to `/api/csp-report`, which logs one
line per report (`journalctl -u ngu-api | grep csp`). The allowed
embed hosts are `EMBEDS` in `server/src/index.js`. After a while of
real use with nothing unexpected in the log, rename
`contentSecurityPolicyReportOnly` to `contentSecurityPolicy` there to
enforce it. A new embed host (a new video site, say) has to be added
to `EMBEDS` first.
The API also refuses a form-style write (`text/plain`, form or
multipart body) sent from another site, including a sibling subdomain