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:
parent
0bb4b8685f
commit
f99010252f
18 changed files with 229 additions and 96 deletions
50
server/src/migrations/059_events_view.sql
Normal file
50
server/src/migrations/059_events_view.sql
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
-- ═══════════════════════════════════════════════════════════════
|
||||
-- 059 EVENTS VIEW: FIRST PUBLISHED HOST, READ DIRECTLY
|
||||
--
|
||||
-- v_events took its host (name, logo, color) from the first row of
|
||||
-- v_event_hosts, published or not, so a draft partner hosting a
|
||||
-- published event showed in its page's structured data and preview
|
||||
-- image. It now takes the first published host, as loadHosts does.
|
||||
--
|
||||
-- It also joins event_hosts, organizations and people itself:
|
||||
-- through the v_event_hosts view, SQLite built every host of every
|
||||
-- event for each lookup, even one event's page. Same columns.
|
||||
--
|
||||
-- person_awards gets the index its event_id lookups (an event's
|
||||
-- awards, and the SET NULL when an event is deleted) were missing.
|
||||
-- ═══════════════════════════════════════════════════════════════
|
||||
|
||||
DROP VIEW v_events;
|
||||
|
||||
CREATE VIEW v_events AS
|
||||
SELECT
|
||||
e.*,
|
||||
CASE WHEN eh.id IS NULL THEN NULL
|
||||
WHEN eh.person_id IS NULL THEN 'organization' ELSE 'person' END
|
||||
AS host_kind,
|
||||
COALESCE(eh.org_id, eh.person_id) AS host_id,
|
||||
COALESCE(o.name, p.display_name) AS host_name,
|
||||
o.kind AS host_org_kind,
|
||||
COALESCE(e.org_logo, o.logo) AS effective_org_logo,
|
||||
COALESCE(e.color, o.color) AS effective_color,
|
||||
COALESCE(
|
||||
e.status,
|
||||
CASE WHEN e.ends_on IS NOT NULL AND e.ends_on < date('now')
|
||||
THEN 'past' ELSE 'upcoming' END
|
||||
) AS effective_status
|
||||
FROM events e
|
||||
LEFT JOIN event_hosts eh
|
||||
ON eh.id = (
|
||||
SELECT x.id
|
||||
FROM event_hosts x
|
||||
LEFT JOIN organizations xo ON xo.id = x.org_id
|
||||
LEFT JOIN people xp ON xp.id = x.person_id
|
||||
WHERE x.event_id = e.id
|
||||
AND COALESCE(xo.is_published, xp.is_published) = 1
|
||||
ORDER BY x.sort_order, x.id
|
||||
LIMIT 1
|
||||
)
|
||||
LEFT JOIN organizations o ON o.id = eh.org_id
|
||||
LEFT JOIN people p ON p.id = eh.person_id;
|
||||
|
||||
CREATE INDEX person_awards_event_idx ON person_awards (event_id);
|
||||
Loading…
Add table
Add a link
Reference in a new issue