Repository navigation
fix(cron): cap trigger script tool access - #104430
Conversation
9e4683e to
2f79127
Compare
|
Codex review: needs maintainer review before merge. Reviewed July 13, 2026, 8:29 PM ET / July 14, 2026, 00:29 UTC. Summary PR surface: Source +73, Tests +115. Total +188 across 15 files. Reproducibility: yes. The supplied current-main production-entry-point run shows a restricted creator's trigger-script systemEvent payload lacks toolsAllow, and the restart proof demonstrates resulting exec and shell exposure. (github.com) Review metrics: 2 noteworthy metrics.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Land the forward cap promptly after owner approval, then provide an operator-visible audit or Doctor flow that identifies cap-less trigger scripts and lets operators approve, restrict, or disable them without silently guessing provenance. Do we have a high-confidence way to reproduce the issue? Yes. The supplied current-main production-entry-point run shows a restricted creator's trigger-script systemEvent payload lacks toolsAllow, and the restart proof demonstrates resulting exec and shell exposure. (github.com) Is this the best way to solve the issue? Unclear as a complete upgrade solution. The branch is the narrowest maintainable forward-path fix, but a cron/security owner must choose how historical cap-less trigger jobs are handled. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0559bc22e0f6. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +73, Tests +115. Total +188 across 15 files. View PR surface stats
Security concerns:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (13 earlier review cycles; latest 8 shown)
|
|
Rank-up addressing the two P1 items plus the requested provider-side reload proof. What changed
Real behavior proofBehavior addressed: After a gateway restart, a trigger-script cron job created by a restricted caller must still be capped to the creator tool surface; before this fix the cap was dropped on SQLite reload and the trigger regained shell/exec/patch. Observed result after fix: After reload the trigger surface is exactly the creator-visible Restart-aware regression (supplemental)
Migration noteNo shipped release ever persisted a @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
b960d13 to
06d066d
Compare
Persist the creator tool cap for any cron job with a trigger script and pass it to the headless trigger runtime. System event and command payloads retain the cap across cron updates.
The creator tool cap is stamped on systemEvent and command payloads whenever a cron job carries a trigger script, but the SQLite codec dropped payload.toolsAllow for those kinds. After a gateway restart the reloaded job carried no cap and the trigger regained the full coding surface. Persist and restore toolsAllow through the existing payload_tools_allow_json column for all payload kinds, and add restart-aware round-trip coverage.
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-run |
|
Merged via squash.
|
* fix(cron): cap trigger script tool access Persist the creator tool cap for any cron job with a trigger script and pass it to the headless trigger runtime. System event and command payloads retain the cap across cron updates. * fix(cron): persist trigger tool cap for systemEvent and command payloads The creator tool cap is stamped on systemEvent and command payloads whenever a cron job carries a trigger script, but the SQLite codec dropped payload.toolsAllow for those kinds. After a gateway restart the reloaded job carried no cap and the trigger regained the full coding surface. Persist and restore toolsAllow through the existing payload_tools_allow_json column for all payload kinds, and add restart-aware round-trip coverage. * ci: re-trigger workflows (transient self-hosted runner flake) * fix(cron): use expectDefined for store test job access * refactor(cron): hoist cron tool types, payload merge, and wire types into companion modules Keeps the oversized cron files at or below their baseline line counts for the changed-file TypeScript LOC ratchet on main. No behavior change. * fix(cron): retain freshly stamped cap markers * test(ci): align compact shard count * fix(cron): make trigger cap updates atomic * fix(cron): preserve explicit cap provenance --------- Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
* fix(cron): cap trigger script tool access Persist the creator tool cap for any cron job with a trigger script and pass it to the headless trigger runtime. System event and command payloads retain the cap across cron updates. * fix(cron): persist trigger tool cap for systemEvent and command payloads The creator tool cap is stamped on systemEvent and command payloads whenever a cron job carries a trigger script, but the SQLite codec dropped payload.toolsAllow for those kinds. After a gateway restart the reloaded job carried no cap and the trigger regained the full coding surface. Persist and restore toolsAllow through the existing payload_tools_allow_json column for all payload kinds, and add restart-aware round-trip coverage. * ci: re-trigger workflows (transient self-hosted runner flake) * fix(cron): use expectDefined for store test job access * refactor(cron): hoist cron tool types, payload merge, and wire types into companion modules Keeps the oversized cron files at or below their baseline line counts for the changed-file TypeScript LOC ratchet on main. No behavior change. * fix(cron): retain freshly stamped cap markers * test(ci): align compact shard count * fix(cron): make trigger cap updates atomic * fix(cron): preserve explicit cap provenance --------- Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Fixes an issue where a restricted agent could create a recurring cron job with a trigger script and a
systemEventpayload, then have that script receive the full coding tool surface. Main-session cron jobs requiresystemEvent, so the common path bypassed the creator's tool policy whenever cron triggers were enabled.Why This Change Was Made
The creator tool cap now applies whenever a cron job has a trigger script, in addition to isolated
agentTurnjobs. The cap is retained on every cron payload shape, survives updates, is persisted through the cron SQLite store so it survives a gateway restart, and is passed to the headless trigger evaluator. This keeps the existing agent-turn behavior while covering main-session system events and command payloads.Distinct from #12736, which concerns global cron deny policy; #97317 and #101349, which concern isolated agent-turn defaults; and #41484, which concerns elevated execution scope.
User Impact
Agents restricted to a small tool set can use cron triggers without acquiring shell, exec, or patch capabilities beyond that set. Existing unrestricted operator-created cron jobs continue to work with their configured policy.
Rebase onto current main
This branch was rebased onto current
main. Three things needed re-expressing against main's current code, none of which change the fix:packages/gateway-protocol/src/schema/cron.tsconflicted becausemainreplacedType.Object({...}, { additionalProperties: false })with theclosedObject()helper. The cap fields were re-expressed in that helper form.mainin chore(ci): enforce changed-file TypeScript LOC ratchet #106387 forbids an already-oversized file from growing.src/cron/service/jobs.ts,src/agents/tools/cron-tool.tsandpackages/gateway-protocol/src/schema/cron.tsare all over the limit, so the cap additions tripped the gate. Cohesive declarations were hoisted into three companion leaf modules, mirroring the existing sibling convention:src/agents/tools/cron-tool.types.ts(type-only),packages/gateway-protocol/src/schema/cron.types.ts(type-only wire types), andsrc/cron/service/payload-merge.ts(the cron payload merge rules the patch touches). All three source files are now back at or below their baseline line counts and the ratchet passes.src/cron/store.test.tsnow uses the repo'sexpectDefinedhelper for indexed job access, which main's tightened unchecked index access requires.Evidence
node scripts/test-projects.mjsand all pass: 145 checks insrc/agents/tools/cron-tool.test.ts, 199 checks acrosssrc/cron/normalize.test.ts,src/cron/store.test.ts,src/cron/service.jobs.test.tsandsrc/cron/trigger-script.test.ts, and 23 checks inpackages/gateway-protocol/src/cron-validators.test.ts. 367 checks total.src/cron/store.test.tsrestart-aware round-trip coverage for thesystemEventandcommandtool caps; both fail on the pre-persistence codec and pass here.node scripts/run-tsgo.mjs -p tsconfig.core.jsonandnode scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.jsonboth pass,node --import tsx scripts/check-ts-max-loc.tspasses, andoxfmt --checkon the changed files is clean.Real behavior proof
Behavior addressed: A cron trigger script created by a restricted caller must not receive tools the caller cannot use; a
systemEventmain-session job with a trigger script previously kept no tool cap.Real environment tested: The production
createCronToolentry point (src/agents/tools/cron-tool.ts) driven viatool.execute("add", ...)on pristine main1708faf85band on PR headc891d9601bafa360c3e8faa0cfb1781a87cece7bwith the identical restricted creator (creatorToolAllowlist: ["read", "cron"]) creating a trigger-scriptsystemEventjob; only the gateway RPC boundary was replaced to capture the params the tool sends.Exact steps or command run after this patch:
PROOF_OUT=/tmp/proof-after.txt node_modules/.bin/tsx cron-trigger-proof.ts(harness invokes the real cron tooladdwithtrigger.script+payload.kind=systemEvent, prints the capturedcron.addpayload)Evidence after fix:
Observed result after fix: The persisted trigger-script job carries
toolsAllow: ["read","cron"], capping the trigger to exactly the creator-visible tools instead of receiving the full coding tool surface.What was not tested: No live gateway tick with a provider-backed trigger evaluation, and the full build was not run.