Public: anyone can read this; the crew can change it.
Issue search never shows a sealed security report to a reader who may not see it #15060
Check · Review · Land · Live done — Landed and live in production.
searchIssuesVisibleTo (src/core/issues.ts) now applies the same sealed rule as mayView/canSeeSealed. A plain reader gets no sealed report, while a writer, crew member or the reporter still finds it. Closes #15041.
shipped production is serving it deploy 9504585
searchIssuesVisibleTo (src/core/issues.ts) now applies the same sealed rule as mayView/canSeeSealed. A plain reader gets no sealed report, while a writer, crew member or the reporter still finds it. Closes #15041.
Confirming the finding: the leak itself was already closed on main by 29cc84e46 (#15006). That fix added issue.sealed = 0, which hides sealed rows from everyone, including writers who may see them. So the second half of "done when" (a writer still finds it) was not met, and this change fixes that.
What changed: the function takes two new options, the same way searchLocalIssues in src/core/search.ts already does:
sealedOk: the repos wherecanSeeSealedholds for the viewer.sealedBy: the viewer's own id, so a reporter can follow their own report.
The caller states the scope, normally derived from sealedScope. If it names neither option, nothing sealed is shown. A signed-out viewer never sees a sealed row, and a sealedBy that isn't the viewer's id is ignored. I passed the scope in rather than importing sealed.ts into issues.ts, because that import would create a load-time cycle (sealed.ts → repos.ts → issues.ts).
What to look at:
- Test: a new case in
test/scale.test.tssearches with the scopesealedScopegives each user. A reader who can't write the repo finds only the report they filed. The writer finds both reports. Signed out, nothing comes back even when the caller passes a scope. Someone else's id assealedByopens nothing. The writer and reporter checks fail without this change. - Reachability: no code in
src/callssearchIssuesVisibleTo; only tests do. The live/searchgoes throughsearchLocalIssues, which already applied this rule (src/actions/search.ts:175-181). So this change makes a function nobody calls correct, rather than changing anything a person can reach. I did not delete it or rewire/searchonto it; that is a separate decision.
Checks: bun scripts/gate.ts --fix changed nothing, and bun x tsc --noEmit is clean. bun scripts/fast.ts named 3352 test files (over its 5-minute budget), so instead I ran test/scale.test.ts, test/issues.test.ts, test/sealed-issues.test.ts and every test/search*.test.ts: 142 pass across 20 files.
How to try it: bun test test/scale.test.ts
🤖 Generated with Claude Code
Approved. The sealed filter now follows the caller-supplied scope. Signed-out viewers get nothing sealed, a foreign sealedBy opens nothing, and the test covers reader, reporter and writer. No page or terminal surface changes, so the preview has nothing to show. Next: (1) searchIssuesVisibleTo has no caller in src/, so either wire /search onto it or delete it and its tests; leaving a correct but unreachable function is dead code. (2) sealedBy must equal viewer.id or it is ignored, so a boolean such as ownSealed would make that misuse impossible. Also bound the sealedOk list so the IN clause cannot grow without limit.
searchIssuesVisibleTo(src/core/issues.ts) now applies the same sealed rule asmayView/canSeeSealed. A plain reader gets no sealed report, while a writer, crew member or the reporter still finds it. Closes #15041.Confirming the finding: the leak itself was already closed on main by 29cc84e46 (#15006). That fix added
issue.sealed = 0, which hides sealed rows from everyone, including writers who may see them. So the second half of "done when" (a writer still finds it) was not met, and this change fixes that.What changed: the function takes two new options, the same way
searchLocalIssuesinsrc/core/search.tsalready does:sealedOk: the repos wherecanSeeSealedholds for the viewer.sealedBy: the viewer's own id, so a reporter can follow their own report.The caller states the scope, normally derived from
sealedScope. If it names neither option, nothing sealed is shown. A signed-out viewer never sees a sealed row, and asealedBythat isn't the viewer's id is ignored. I passed the scope in rather than importingsealed.tsintoissues.ts, because that import would create a load-time cycle (sealed.ts→repos.ts→issues.ts).What to look at:
test/scale.test.tssearches with the scopesealedScopegives each user. A reader who can't write the repo finds only the report they filed. The writer finds both reports. Signed out, nothing comes back even when the caller passes a scope. Someone else's id assealedByopens nothing. The writer and reporter checks fail without this change.src/callssearchIssuesVisibleTo; only tests do. The live/searchgoes throughsearchLocalIssues, which already applied this rule (src/actions/search.ts:175-181). So this change makes a function nobody calls correct, rather than changing anything a person can reach. I did not delete it or rewire/searchonto it; that is a separate decision.Checks:
bun scripts/gate.ts --fixchanged nothing, andbun x tsc --noEmitis clean.bun scripts/fast.tsnamed 3352 test files (over its 5-minute budget), so instead I rantest/scale.test.ts,test/issues.test.ts,test/sealed-issues.test.tsand everytest/search*.test.ts: 142 pass across 20 files.How to try it:
bun test test/scale.test.ts🤖 Generated with Claude Code
Closes #15041