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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KgF3Kf47LjPGHKQHszpUAv
This commit is contained in:
parent
91e3e916d8
commit
cd66d61f6f
2 changed files with 2 additions and 2 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue