You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
projector: GET /items and /comments accept an uncapped refs list that bypasses the pagination limits #10595
GET /items?refs= and GET /comments?refs= split the query param into an unbounded array and hand it straight to the store, where it becomes one SQL placeholder per ref. Both routes are unauthenticated reads, and the refs path bypasses the limit pagination cap that the same routes enforce on their list path. Additionally, the by-refs items query has no row LIMIT at all.
Evidence (origin/main ec68de7f)
pm-stack/projector/src/server.ts:292-309 — GET /items: no auth gate (first bearerAuthorized in the file is at :336 for POST /links), no count cap on refs:
pm-stack/projector/src/server.ts:312-325 — GET /comments: same uncapped split, passed to store.getComments(db, refs, { limit }).
pm-stack/projector/src/store.ts:247-254 — getItems builds IN (?, ?, ...) with one placeholder per ref and has no LIMIT clause:
export async function getItems(db: Client, refs: string[]): Promise<ItemRow[]> {
if (refs.length === 0) return [];
const placeholders = refs.map(() => "?").join(",");
const r = await db.execute({
sql: `SELECT * FROM pmp_items WHERE ref IN (${placeholders}) ORDER BY updated_at DESC`,
args: refs,
});
pm-stack/projector/src/store.ts:427-441 — getComments caps returned rows via LIMIT ? but still builds an unbounded placeholder list.
The sibling read routes cap page size (MAX_ITEMS_LIMIT = MAX_COMMENTS_LIMIT = 1000, server.ts:78-81, enforced by parseLimit), so a caller paging normally can never pull more than 1000 rows — but the refs path on the same endpoints has no equivalent bound.
Why it matters
An unauthenticated caller can request an arbitrarily large ref list (hundreds of short refs fit in a normal URL) and force a giant IN query returning up to one full row per ref on /items with no row cap — response bloat and DB load on the shared projector store. At very high counts it also risks hitting the SQLite host-variable limit, which would surface through the unguarded-store-call path already tracked in #10540 as an unstructured 500.
Suggested fix shape
Cap the refs array length on both routes (e.g. reuse MAX_ITEMS_LIMIT/MAX_COMMENTS_LIMIT or a dedicated MAX_REFS), returning 400 { error } over the cap.
Add a row LIMIT to getItems-by-refs consistent with the list path.
Activity
developing-today commentedon Nov 16, 2026
CODE-3846
projector: bound refs list and page GET /links (#10595, #10601) (#10602)