Adds four hermetic checks to scripts/test-export.mjs that read package.json with
node:fs (no npm shell-out): scripts.export exists and is non-empty; it invokes
bin/opencode-teamwork.mjs with the export subcommand; the aggregate test script
includes test:export; and it still runs the five pre-existing suites in order
with test:export last. No existing check is modified.
- 6c: root with nonzero tokens + second child session on the same taskId;
asserts the SUMMED bucket so last-writer-wins/absolute writes fail.
- seedSessionDb: probe node:sqlite / sqlite3 CLI once; if neither exists,
print '⊘ skipped attribution DB tests: no node:sqlite and no sqlite3 CLI'
and skip 6a-6d. Seeding errors with a backend present still propagate.
Audited by clean-context subagents across three rounds; every finding fixed and
re-verified.
- F1 path traversal: sessionId allowlist + lexical & realpath containment;
refuse a symlinked run root, symlinked run dir, and any symlinked run file
(lstat-based, dangling-safe)
- F2 command injection: no shell interpolation of session ids — server-derived
$SESSION_ID, quoted; lint scans agent files AND command templates (incl.
backslash line-continuations)
- F3 read-only guardrail: per-agent deny list (real permission actions),
fail-closed when the permission API is unavailable
- F4 stored prompt injection: sanitised run-state injection (phase allowlist,
validated dir name, no raw newlines/paths)
- F5 installer is non-destructive by default (refresh opt-in via --refresh)
- F6 refuse symlinked/JSONC configs; string-aware comment/trailing-comma strip
- F8 create-only reference copy on plugin load
- add team/security-auditor agent + docs/GUARDRAILS.md + guardrail lint rules
- scripts/lint-prompts.mjs: guards canonical artifact root, topology enum
(parsed from docs/ARTIFACTS.md), no duplicated/self-referential blocks, no
stale references, no 'effect: ask' in parallel agents, $ARGUMENTS usage
- .github/workflows/lint-prompts.yml runs it on agent/doc changes
- package.json: lint:prompts script