Repository navigation
Closed
2 / 22 of 2 issues completedClosed
2 / 22 of 2 issues completed
Copy link
Labels
architect:doneAnalyzed: decomposed into draft tickets under this epicbugSomething isn't workingseverity:mediumReal but narrow: robustness, hygiene, or gated behind multiple preconditionsspec:incompleteNot executable: missing repro or no measurable acceptance criterion. Author: add it, or close.store-securityStore boundary: path containment, exposure docs, redaction, trust tiers, durable rejection
Description
This is a possible behavior to investigate, not a confirmed bug. It came out of an AI-assisted local review of cb68647 (v0.15.21). I haven't shown any real-world impact, so please treat it as a lead and defer or close it as you see fit.
What I saw
detectPackageScripts builds npm run ${name} from each notable script key with no character check (src/init/detect.ts:90). Makefile and Justfile targets are limited to [A-Za-z0-9_-]+ (src/init/detect.ts:98).
Using the test harness with memory_init and a script key of test && echo SYNTHETIC:
- Stored row:
... command: run "npm run test && echo SYNTHETIC" from the repo root (package.json).(src/init/run.ts:164) - Marking and screening: the row carries the tags
initandpackage.json, so it gets no[via ...]marker (src/inject/format.ts:17). Init rows aren't passed through the quarantine scan that import uses. - Later sessions: a row like this was still injected after
package.jsonchanged. In a harness run it also appeared after switching away from the branch and in a second clone of the same remote. - Effect on the real command: this depended on the key text. Short keys such as
test && xandtest; xkept the plainnpm run testrow from being written (superseded_overlap).test && echo SYNTHETICdid not. - Recovery: after
memory_forgetremoved these rows, re-running init refused the plain row (previously_rejected), andforcedidn't change that. A viewer un-reject let it through again. - Rendered string: run in a shell with real npm and a harmless marker, the rendered text ran a second command. Quoting the key ran only that script.
What is not established
- The plugin never executes these strings. No model was run, so nothing shows a model acting on them.
- It needs someone to run
memory_initor/repo-initon a checkout containing such a key. It isn't automatic. - The injected block is framed as reference data, not instructions.
- A repo that can edit
package.jsonalready controls its npm scripts andAGENTS.mdon that checkout. The open question is whether keeping the text after leaving that branch matters in practice. - Everything ran on Windows through the test harness with a fake host.
If it's worth changing
Reusing the Makefile character class for script keys, or scanning init rows the way import does, might be enough. That's your call.
Sub-issues
Collapse Sub-issuesSub-issues
Loading 2 sub-issues
Metadata
Metadata
Assignees
Labels
architect:doneAnalyzed: decomposed into draft tickets under this epicbugSomething isn't workingseverity:mediumReal but narrow: robustness, hygiene, or gated behind multiple preconditionsspec:incompleteNot executable: missing repro or no measurable acceptance criterion. Author: add it, or close.store-securityStore boundary: path containment, exposure docs, redaction, trust tiers, durable rejection
Activity
abogartz commentedon Nov 4, 2026
osi-spec-hash: 531145ba4585be8b 2026-11-04T18:37:28Z - acceptance criteria frozen at this text. A later edit to the body changes this hash, and the reviewer will withhold approval until a maintainer replies spec ok.
ocsi-triager commentedon Nov 4, 2026
Not agent-ready: the ticket is an investigation lead with no measurable acceptance criterion — "might be enough. That's your call" leaves a machine unable to tell done from not-done. Either add it or close this.
[-]Possible behavior to investigate: package.json script names stored as command memories without a character check[/-][+]Epic: Screen repo-detected command memories for injection content[/+]ocsi-architect commentedon Nov 4, 2026
Architect verdict: PASS — decomposed into 2 draft tickets.
Verified against main at sha
7405dc61d919e7eee7033dea6e4324eda58ee669(v0.15.33). The lead reproduces from the code: the asymmetry and the unscreened write path are both still present.PROBLEM — A user who runs
memory_initon a checkout with a crafted package.json script key (e.g.test && echo SYNTHETIC) gets a command memory containing shell metacharacters, injected into every later session with no[via ...]marker, surviving the branch and clone the key came from.COST — Two tickets, three files (
src/init/detect.ts,src/init/run.ts,test/init.test.ts), small review cycles. Proportionate: the fix is tiny, reuses existing mechanisms, and closes a gap on the store's trust boundary.COMPLEXITY — Adds no machinery: ticket 1 reuses the
[A-Za-z0-9_-]+class already enforced atsrc/init/detect.ts:98; ticket 2 reusesquarantineCandidatealready called by capture (src/capture/runtime.ts:268) and import (src/portable/import.ts:86). It removes an inconsistency rather than adding a moving part.DOWNSIDE OF AS-IS — The package.json detector keeps storing crafted keys verbatim (
src/init/detect.ts:90, onlyisNotableat :88), and init stays the one capture path with no quarantine screening. Real execution still needs a model to obey the injected block, so the gap is narrow but ongoing hygiene on a documented boundary.Feasibility: REAL (quotes above), DECOMPOSABLE (2 tickets, RED/GREEN each), SIZED (≤3 files each), IN-SCOPE (no workflows/rulesets/secrets), DECIDED (no open design question inside scope — whether init rows should also carry a
[via init]provenance marker is deliberately out of scope; neither ticket depends on it).Children:
detectPackageScripts).quarantineCandidate).Tickets are drafts: label one agent:ready when you want it built.
ocsi-triager commentedon Nov 5, 2026
All 2 sub-issues closed as completed: #301, #302. Closing the epic.
ocsi-triager commentedon Nov 5, 2026
Reopening: closed in error by ocsi-triager. Sub-issues #301 and #302 are both OPEN (completed 0/2), so the close condition was not met. No action needed from maintainers.
abogartz commentedon Nov 9, 2026
Both suggested changes are now implemented, so this is done.
detectPackageScriptsno longer accepts a key with characters outside[A-Za-z0-9_.:-], sotest && echo SYNTHETICnever becomes a memory. The class is the Makefile/Justfile class plus.,:and-, because those are ordinary in npm script names (test:ci,lint:fix,build.win); the deviation is stated in the PR.runInitnow calls the samequarantineCandidatescan auto-capture and import use, on the script rows and on the init stamp, which interpolates the checkout directory's name. A match is stored but taggedquarantine, so it stays out of recall and out of the prompt and shows up in the viewer's quarantined filter.Both close when their PRs merge. What this report established — that a repo-derived row could reach the prompt with no provenance marker and no screening — is the part worth keeping, and it is now covered by a test in each PR.
Two of your "not established" points still stand and are why this stays a hardening change rather than a fix for a live problem: the plugin never executes these strings, and it needs someone to run init on a hostile checkout.