GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||
GeezerVison is showing github.com — projector: POST /links validates only subject/ref — a non-string note/createdBy throws out of the handler, relation is String()-coerced and stored as 'a,b' / '[object Object]', and an empty subject is stored · Issue #2974 · developing-today/code Closed Labels app/pm-stackpm-stack (Pad/Grist) in developing-today/codeeffort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobsource/design-architectFiled by the repo design architect jobtask/triageQueue packet kind: verify, reproduce, and route this item Descriptionprojector: POST /links validates only subject/ref — a non-string note/createdBy throws out of the handler, relation is String()-coerced into garbage, and an empty subject is storedEvidence (verified this run, main
|
| body | observed |
|---|---|
control: {subject:"s:1", ref:"developing-today/code#1", relation:"tracks", note:"hi"} |
201, stored verbatim |
relation: ["a","b"] |
201; response echoes the raw array; stored relation is "a,b" |
relation: {x:1} |
201; stored relation is "[object Object]" |
note: {x:1} |
throws out of handleRequest: Error: SQLite3 can only bind numbers, strings, bigints, buffers, and null — in production an uncaught 500, no JSON error |
createdBy: ["a"] |
same uncaught throw |
note: 42 |
201; stored note reads back as "42.0" (numeric bind into the TEXT column) |
subject: "" |
201; a link with an empty subject is stored |
subject: 123 (control) |
400, as the existing check intends |
The garbage relations are durable: pmp_links is keyed (subject, ref, relation), so "a,b" / "[object Object]" rows pollute the registry and answer later GET /links / subject-join queries (getCommentsForSubject joins on links), and the caller's 201 tells it the link was recorded as sent.
This is the projector's only authenticated write API. A client bug or a hand-crafted request either (a) crashes the request with an uncaught driver error instead of the endpoint's own 400 JSON shape — the failure mode #1547/#2693 already removed from this server's read paths — or (b) silently stores a coerced relation/subject the caller never sent, corrupting the link registry the read model joins on. The handler already has the right validation shape for two fields; the remaining fields were never given it.
POST /links validates the whole body before any store call: relation, note, and createdBy, when present, must be strings (absent/null keep today's defaults); a non-empty subject is required. Any violation returns the endpoint's JSON 400 shape — nothing is stored, nothing throws.String() coercion of relation: a valid string relation is stored and echoed verbatim; the 201 response echoes what was actually stored.handleRequest as an uncaught throw (same JSON-error discipline as the read paths).test/limit.test.ts style or a links test): the probe matrix above — array/object relation, object note, array createdBy, numeric note, empty subject — each returns 400 with no row stored; the valid control returns 201 and round-trips verbatim.ref format check, link keying, or the GET/DELETE link endpoints.🤖 Agent note · filed
🤖 Design-architect pass 26 (2026-10-31) — agent note: this issue is adopted as part of Phase 1 of design #3068 ("parsed is not validated"). Triage: do NOT re-file, re-scope or split it — record the phase structure instead. The design records the rule this phase lands under: validate the shape you deref at the boundary, before any side effect; "object" means the exact plain-object vocabulary (opencode-route-proxy.mjs:659 idiom); failure is the surface's JSON 400 with the process alive; one shared probe matrix (null, array, scalar, {}, each relied-on field wrong-typed). Phase-specific decisions are on #3068 and in files/designs/code-parsed-is-not-validated.md (goal workspace).
agent-note:v1
state: picked_up
task: 5492 (small_fix, lane D)
worker: repo-worker-code
summary: Implementing the pinned fix for #2974 — whole-body validation in the POST /links branch of pm-stack/projector/src/server.ts (no String() coercion, guarded store call), with the triage probe matrix as tests.
next: laptop worktree, implement validation + tests, open PR.
Merge pull request #3520 from developing-today/queue/5492-2974-links-…
agent-note:v1
state: done
task: 5492 (small_fix, lane D)
worker: repo-worker-code
summary: Fixed — PR #3520 merged (421664e). POST /links now validates the whole body before any store call (non-empty subject; string relation with default only when absent; string-or-null note/createdBy), passes relation uncoerced, and wraps upsertLink in try/catch returning a JSON 500.
tests: new links-validation.test.ts 8/8; full projector suite 53 pass / 0 fail. Codex review completed, no findings.
next: none