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
Commit 3f26a0c
Browse filesBrowse the repository at this point in the historyBrowse files
fix(cron): harden preHook against shell injection and log leakage
Replace shell `command` string with direct `file` + `args[]` execFile
(CWE-78): metacharacters in config are now literal text, not parsed by
/bin/sh or cmd.exe. Schemas, normalization, and tool surfaces are updated
to match; legacy `{command}` payloads are rejected at the normalizer.
Stop logging raw hook stdout/stderr at info level (CWE-532). On success,
log only metadata (outcome, exitCode). On skip/error, log truncated and
redacted output at debug via summarizePreHookOutput, keeping secrets
printed by hook scripts out of routine info logs.
Addresses Aisle Security Analysis findings on PR #62195.
Copy file name to clipboardExpand all lines: docs/automation/cron-jobs.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -355,14 +355,15 @@ Model override note:
355
355
356
356
## Pre-run hooks
357
357
358
-
An optional `preHook` runs a shell command before agent execution. Use it to gate runs on preconditions like disk space, network reachability, or API availability.
358
+
An optional `preHook` runs a fixed executable before agent execution. Use it to gate runs on preconditions like disk space, network reachability, or API availability. The hook is spawned directly — no shell — so metacharacters in `file` or `args` are passed as literal text.
@@ -377,8 +378,8 @@ The hook runs with the same permissions as the cron trigger. Exit codes control
377
378
| Any other | Error (increments `consecutiveErrors`, triggers backoff and alerts) |
378
379
379
380
-**Timeout**: default 30 seconds, maximum 300 seconds. The process is killed when the timeout is reached.
380
-
-**Output**: stdout and stderr are captured (up to 64 KB)and included in structured logs.
381
-
-**Platform**: `/bin/sh -c` on Unix, `cmd.exe /c` on Windows.
381
+
-**Output**: stdout and stderr are captured (up to 64 KB), truncated and redacted before being written to structured logs. Keep secrets out of hook output; do not rely on raw output appearing in logs.
382
+
-**Shell**: not used. If you need shell features (pipes, globs, redirection), wrap them in a script file and set `file` to that script.
Copy file name to clipboardExpand all lines: docs/gateway/heartbeat.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -425,7 +425,7 @@ Use `--mode next-heartbeat` to wait for the next scheduled tick.
425
425
426
426
## Pre-run hooks (optional)
427
427
428
-
An optional `preHook` runs a shell command before each heartbeat turn. The hook runs after preflight checks (enabled, active hours, queue empty) but before the agent turn.
428
+
An optional `preHook` runs a fixed executable before each heartbeat turn. The hook runs after preflight checks (enabled, active hours, queue empty) but before the agent turn. It is spawned directly — no shell — so metacharacters in `file` or `args` are passed as literal text.
429
429
430
430
```json5
431
431
{
@@ -434,7 +434,8 @@ An optional `preHook` runs a shell command before each heartbeat turn. The hook
434
434
heartbeat: {
435
435
every: "30m",
436
436
preHook: {
437
-
command: "/usr/local/bin/check-should-run.sh",
437
+
file: "/usr/local/bin/check-should-run.sh",
438
+
args: ["--quiet"],
438
439
timeoutSeconds: 30,
439
440
},
440
441
},
@@ -449,7 +450,7 @@ An optional `preHook` runs a shell command before each heartbeat turn. The hook
449
450
| 10 | Skip (not a failure) |
450
451
| Any other | Fail (logged as heartbeat error) |
451
452
452
-
Default timeout is 30 seconds (max 300). stdout and stderr are captured in logs.
453
+
Default timeout is 30 seconds (max 300). stdout and stderr are captured, truncated and redacted before being written to logs — keep secrets out of hook output. If you need shell features (pipes, globs, redirection), wrap them in a script file and set `file` to that script.
0 commit comments