From cd66d61f6f83da9c5c3bede1218733dcb2f19a9b Mon Sep 17 00:00:00 2001 From: agent Date: Tue, 6 Oct 2026 12:06:05 +0000 Subject: [PATCH] Public pages: build slug filters with pb.filter The URL slug was interpolated into the filter string, so a crafted URL could rewrite the query (e.g. make any path serve a page). API rules still limited it to published pages, so no drafts leaked. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01KgF3Kf47LjPGHKQHszpUAv --- app-public/src/routes/+page.server.ts | 2 +- app-public/src/routes/[slug]/+page.server.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app-public/src/routes/+page.server.ts b/app-public/src/routes/+page.server.ts index 6153b9d..eb226c7 100644 --- a/app-public/src/routes/+page.server.ts +++ b/app-public/src/routes/+page.server.ts @@ -16,7 +16,7 @@ export const load: PageServerLoad = async ({ locals }) => { try { const page = await locals.pb .collection('pages') - .getFirstListItem(`slug = "${homeSlug}" && published = true`); + .getFirstListItem(locals.pb.filter('slug = {:slug} && published = true', { slug: homeSlug })); let calendarEvents: CalendarEventRecord[] = []; if (hasUpcomingCalendarBlock(page.blocks || [])) { const range = getUpcomingCalendarRange(); diff --git a/app-public/src/routes/[slug]/+page.server.ts b/app-public/src/routes/[slug]/+page.server.ts index 5e88b53..4d6c301 100644 --- a/app-public/src/routes/[slug]/+page.server.ts +++ b/app-public/src/routes/[slug]/+page.server.ts @@ -7,7 +7,7 @@ export const load: PageServerLoad = async ({ params, locals }) => { try { const page = await locals.pb .collection('pages') - .getFirstListItem(`slug = "${params.slug}" && published = true`); + .getFirstListItem(locals.pb.filter('slug = {:slug} && published = true', { slug: params.slug })); let calendarEvents: CalendarEventRecord[] = []; if (hasUpcomingCalendarBlock(page.blocks || [])) { const range = getUpcomingCalendarRange();