Cron lifecycle guard: reject dangerous commands at job creation #778
Notifications
Due Date
No due date set.
Depends on
Reference: sam/archie#778
Reference in new issue
Block a user
Slice 4 of the cron/scheduling epic (archie-core-1786637496320-249-be6d9a20). The epic's third acceptance criterion verbatim: 'Dangerous commands are rejected at creation time.'
Guards both runners from the previous slice: ChatCourier (whose body could include shell-shaped payloads) and WorkflowTask (whose shell-step is a documented footgun). Rejection happens at job creation, not at tick time, so a refused job is visible in the store with a refusal reason and never reaches the ticker engine.
Acceptance criteria
archiedrestart,systemctl,launchctl,pkill,mkfs,dd,shutdown,reboot.Close reason
Landed in
0a3ecf26. scheduling.RefuseDangerousJob (internal/domain/scheduling/guard.go) refuses a job whose Payload.Text names any of archied restart, systemctl, launchctl, pkill, mkfs, dd, shutdown, reboot, matched whole-word and case-insensitively. validateSchedules, the one validator every creation path reaches (dashboard/control-plane replace of the schedules document, config seed and ValidateStored), calls it first, so a refusal is a 400 carrying the reason - 'control-plane validation: scheduling: payload names a dangerous command: job "nightly" payload names "dd"' - which SchedulesPage.vue shows in its role=alert paragraph. Nothing is written to the store: Decode fails before PutResource. Criterion 3 is met by the single validator rather than by two call sites: the CLI creation path the epic's slices 3 and 6 assumed was never built (no CLI command references schedules; ReplaceSchedules has exactly one caller, the runner's MarkRun), so there is no second surface to call it from. The over-broad 'dd' is matched as a word, so 'added' and 'middleware' are accepted while 'sudo dd if=...' is refused. Test: internal/domain/scheduling/guard_test.go, table-driven, three accepted payloads and eight refusals. task check green on the committed tree. Follow-up filed: archie-core-3k3c (the validator parity fixture has no Go side).Imported from beads
archie-core-1786637496320-249-be6d9a20.4· GitHub #677 · type feature · priority P2 · created 2026-08-27 · closed 2026-10-08