Third audit: security fixes and server-side scalability

Security:
- docx unzip reads each part once (a repeated entry was a zip bomb)
- request files must be named for their type (no PDF named .html)
- team roster hidden when its organization is unpublished
- /people?ids= hides draft organizations, takes 200 ids
- v_events takes the first published host and reads event_hosts
  directly (migration 059, plus an index on person_awards.event_id)
- group accounts refused while access groups are off; group sync
  can't undo a superadmin's disable
- 64 KB body limit on login, feedback and csp-report
- Drive pick-up races no longer 500; random upload boundary

Scalability:
- /events filters by scope, host, status and type on the server;
  Home no longer prefetches every event
- /organizations leaves out bodies and leadership; the map's group
  panel fetches its own
- admin lists page with Show more and a real count
- content request record search and the newsletter's post list
  ask the server

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-10-01 18:29:26 -05:00
parent 0bb4b8685f
commit f99010252f
18 changed files with 229 additions and 96 deletions

View file

@ -26,8 +26,9 @@ import { postsBy } from "./blog.js";
const people = new Hono();
/* How many slugs one request may name. Keeps the URL sane. */
const MAX_IDS = 50;
/* How many slugs one request may name. Keeps the URL sane (a few
KB) while covering any hand-picked list. */
const MAX_IDS = 200;
function shapePerson(row) {
return {
@ -69,9 +70,10 @@ people.get("/teams/:id/people", (c) => {
const team = db
.prepare(
`SELECT id, org_id, name, tagline, color, logo
FROM teams
WHERE id = ? AND is_published = 1`,
`SELECT t.id, t.org_id, t.name, t.tagline, t.color, t.logo
FROM teams t
JOIN organizations o ON o.id = t.org_id AND o.is_published = 1
WHERE t.id = ? AND t.is_published = 1`,
)
.get(id);
@ -125,7 +127,7 @@ people.get("/people", (c) => {
o.id AS primary_org_id,
o.name AS primary_org_name
FROM people p
LEFT JOIN organizations o ON o.id = p.primary_org_id
LEFT JOIN organizations o ON o.id = p.primary_org_id AND o.is_published = 1
WHERE p.id IN (${marks(ids.length)})
AND p.is_published = 1`,
)