Legacy motif share query returns soft-deleted entries #93
Labels
No labels
bug
duplicate
enhancement
future
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
rbrooks/TeaLeaves#93
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: Low · Confidence: High · Effort: XS · Category: security
Evidence
api/src/routes/share.ts:65-80- legacymotif_collaboratorsbranch selects entries withWHERE e.user_id = $2and nodeleted_at IS NULL.api/src/routes/share.ts:138(project-share path) andapi/src/routes/public.ts:428(public detail) filter correctly.Problem
The legacy share-token entry query omits the soft-delete filter every other read path applies.
Impact
A holder of a legacy (UUID) motif share link sees entries that were trashed but still linked to the motif. Bounded by possession of the unguessable token.
Fix
Add
AND e.deleted_at IS NULLto the legacy entries (and connections) query.Acceptance criteria
Filed from the 2026-07-15 codebase audit. Full report:
docs/.internal/report-2026-07-15.md(gitignored).Fixed in
763aa0b(v7.2.0 wave 1).Added
AND e.deleted_at IS NULLto the legacy entries query inshare.ts, matching the project-share path.Broader than filed — the motif itself leaked too. The legacy
motif_collaboratorslookup joinedmotifs mwithout checkingm.deleted_at, so a trashed motif was still served in full (title, description, and its entries) to a legacy token holder. The new path guards this (p.deleted_at IS NULL/m.deleted_at IS NULL); the legacy one didn't. AddedAND m.deleted_at IS NULLthere as well.On the connections query: no filter needed.
connectionshas nodeleted_atcolumn (soft-delete exists only onprojects,motifs,entriesper migration 026), and the query is already scoped byentryIds— which now excludes trashed entries, so connections touching them drop out transitively.Acceptance criteria:
CI run 191 green.