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
Filter package.json script keys before storing command memories #301
agent:readyHuman-approved for autonomous work by ocsi-fixerreleasedseverity:mediumReal but narrow: robustness, hygiene, or gated behind multiple preconditionsspec:draftArchitect-drafted ticket awaiting human adoption
detectPackageScripts builds npm run ${name} from every notable script key with no character check (src/init/detect.ts:90, verified at sha 7405dc61d919e7eee7033dea6e4324eda58ee669). isNotable passes any key starting with test/lint/build etc. (src/init/detect.ts:36-40), so a package.json key like test && echo SYNTHETIC is stored verbatim as a command memory. detectMakeTargets already restricts targets to [A-Za-z0-9_-]+ (src/init/detect.ts:98), so package.json is the one detector without an input filter. The stored row carries tags init/package.json, so it gets no [via ...] provenance marker (src/inject/format.ts:17) and is injected into every later session, surviving the branch or clone the crafted key came from.
Fix direction
In detectPackageScripts (src/init/detect.ts), skip script keys that do not match /^[A-Za-z0-9_-]+$/ — the same character class detectMakeTargets already enforces. Test coverage in test/init.test.ts (the fixture + direct detectScripts import test already exist there).
Acceptance
RED: on main 7405dc6, a test whose fixture package.json has scripts keys test && echo SYNTHETIC and plain lint, then calls detectScripts(fixture), returns a record whose cmd contains && echo SYNTHETIC — the new assertion that every returned key matches ^[A-Za-z0-9_-]+$ fails.
GREEN: bun test test/init.test.ts passes; detectScripts returns no record whose key fails ^[A-Za-z0-9_-]+$; the existing tests expecting the npm run test / npm run lint rows still pass.
One compatibility point to consider before adopting the draft: /^[A-Za-z0-9_-]+$/ excludes colons and dots as well as shell metacharacters. The current isNotable() prefix check accepts these example script keys, but the proposed filter would silently stop producing their command memories:
test:unit → npm run test:unit
test:e2e → npm run test:e2e
build:prod → npm run build:prod
lint.fix → npm run lint.fix
These names do not need shell operators or whitespace. Is dropping them intentional, or should the safe-name policy preserve punctuation such as : and . while continuing to reject injection-bearing keys such as test && echo SYNTHETIC, test; echo SYNTHETIC, and names containing command substitution or line breaks?
The current positive controls cover only plain test and lint, so they would not catch that compatibility loss. If preserving these names is desired, please include representative colon/dot names alongside the hostile-name regressions in the acceptance criteria. If the narrower naming policy is intentional, documenting the exclusion would make the tradeoff clear. This is a scope clarification for consideration, not a claim on the ticket.
agent:readyHuman-approved for autonomous work by ocsi-fixerreleasedseverity:mediumReal but narrow: robustness, hygiene, or gated behind multiple preconditionsspec:draftArchitect-drafted ticket awaiting human adoption
Activity
WhollyMindless commentedon Nov 5, 2026
One compatibility point to consider before adopting the draft:
/^[A-Za-z0-9_-]+$/excludes colons and dots as well as shell metacharacters. The currentisNotable()prefix check accepts these example script keys, but the proposed filter would silently stop producing their command memories:test:unit→npm run test:unittest:e2e→npm run test:e2ebuild:prod→npm run build:prodlint.fix→npm run lint.fixThese names do not need shell operators or whitespace. Is dropping them intentional, or should the safe-name policy preserve punctuation such as
:and.while continuing to reject injection-bearing keys such astest && echo SYNTHETIC,test; echo SYNTHETIC, and names containing command substitution or line breaks?The current positive controls cover only plain
testandlint, so they would not catch that compatibility loss. If preserving these names is desired, please include representative colon/dot names alongside the hostile-name regressions in the acceptance criteria. If the narrower naming policy is intentional, documenting the exclusion would make the tradeoff clear. This is a scope clarification for consideration, not a claim on the ticket.chore(release): 0.22.1 [skip ci]
abogartz-opencode-self-improvement commentedon Nov 9, 2026
🎉 This issue has been resolved in version 0.22.1 🎉
The release is available on:
Your semantic-release bot 📦🚀