Repository navigation
feat(cron): allow trusted private webhook targets - #118286
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 7:49 PM ET / 23:49 UTC. ClawSweeper reviewWhat this changesThe branch adds Merge readinessThis is a coherent, well-proven implementation of the linked cron-webhook request. The patch keeps omitted configuration strict, routes the one resolved policy through primary, completion, failure-destination, and failure-alert webhook delivery, and preserves the central SSRF guard; no discrete correctness defect was found. Because the new setting intentionally authorizes every cron webhook route to reach trusted private targets, the remaining gate is explicit maintainer acceptance of that service-wide security boundary. Priority: P2 Review scores
Verification
How this fits togetherGateway cron jobs can send primary and follow-up webhook notifications after an automation run. The cron service reads operator configuration, passes the selected outbound policy to the central guarded-fetch layer, and records whether each delivery succeeded or was intentionally blocked. flowchart LR
Config[Operator cron configuration] --> Snapshot[Cron service snapshot]
Job[Automation job and delivery target] --> Delivery[Primary and follow-up webhook delivery]
Snapshot --> Policy[Resolved SSRF policy]
Policy --> Guard[Central guarded fetch]
Delivery --> Guard
Guard --> Outcome[Delivered or recorded not-delivered outcome]
Decision needed
Why: Both choices are viable product/security contracts. The branch is mechanically coherent, but only maintainers can choose the intended blast radius of a configuration-controlled SSRF relaxation. Before merge
Agent review detailsSecurityNone. PR surfaceSource +57, Tests +114, Docs +42, Generated +2. Total +215 across 30 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Accept the flat Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main’s cron test and guarded-fetch call establish that loopback delivery records Is this the best way to solve the issue? Yes, subject to the maintainer security-scope choice: resolving one canonical policy at the cron-service boundary and passing it through the existing guard is cleaner than duplicating SSRF logic or adding per-route exceptions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b7f9cd0a0167. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
b1b5bea to
3b96502
Compare
|
Merged via squash.
|
Fixes #118237
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
What Problem This Solves
Fixes an issue where operators sending automation webhooks to loopback or private-network receivers always got a recorded
not-deliveredresult with no supported opt-in. The restriction also applied to completion destinations, failure destinations, and failure-alert webhooks, but the automation docs did not explain it.Why This Change Was Made
Cron now exposes
cron.webhookSsrfPolicyusing one canonical four-field SSRF config type and Zod schema shared with browser and web fetch. The Gateway resolves that policy once per cron-service snapshot and passes it through the existing central guarded-fetch owner for primary, completion-destination, failure-destination, and failure-alert webhook sends. Omitted config remains strict.Current source differed from the issue's file map: browser and web fetch had separate, disjoint inline schemas rather than the referenced shared object. This change first extracts the approved canonical schema/type, then reuses the existing
mergeSsrFPoliciesruntime primitive at all three surfaces. The cron key is flat because the existing cron config is flat aroundwebhookToken, andcron.webhookis an explicitly retired namespace.Config-surface metric: 9 intentional schema paths are added (the cron policy object plus four leaves, two new browser leaves, and two new web-fetch leaves). Generated core config entries move from 2309 to 2321 because array leaves also project item paths. Defaults do not change; every relaxation remains an explicit operator opt-in. Production code is +52 net lines, primarily the required shared type/schema/help/label contract and the central security-policy handoff; tests and docs are counted separately.
User Impact
Operators can now deliver automation webhooks to a trusted local or private service with a narrow exact-host exception such as
allowedHostnames: ["127.0.0.1"], or usedangerouslyAllowPrivateNetwork: truewhen every configured automation webhook may reach trusted private-network services. Existing installations remain blocked by default.Release note: Automation webhooks now support explicit private-network and exact-host SSRF policy opt-ins through
cron.webhookSsrfPolicy, while retaining strict defaults.Evidence
Source-blind packaged CLI/Gateway validation against a real
127.0.0.1HTTP receiver passed:delivered: false,deliveryStatus: "not-delivered", and the SSRF block reason; the receiver saw zero requests.allowedHostnames: ["127.0.0.1"], the identical job and URL recordeddelivered: true; the receiver saw a real POST.dangerouslyAllowPrivateNetwork: truewith an empty hostname list, the identical job and URL delivered a second real POST.config validate --jsonaccepted all four canonical leaves together with no warnings.allowedHostnamesentry, and an unknown policy leaf were rejected.Focused tests:
OPENCLAW_HEAVY_CHECK_LOCK_SCOPE=worktree node scripts/run-vitest.mjs src/infra/net/ssrf.test.ts src/config/config-misc.test.ts src/config/schema.test.ts— 206 passed.OPENCLAW_HEAVY_CHECK_LOCK_SCOPE=worktree node scripts/run-vitest.mjs src/agents/tools/web-fetch.ssrf.test.ts— 13 passed.OPENCLAW_HEAVY_CHECK_LOCK_SCOPE=worktree node scripts/run-vitest.mjs src/gateway/server-cron-primary-webhook.test.ts src/gateway/server-cron-notifications.test.ts src/gateway/server-cron.test.ts— 92 passed.OPENCLAW_HEAVY_CHECK_LOCK_SCOPE=worktree node scripts/run-vitest.mjs extensions/browser/src/browser/config.test.ts— 69 passed, 1 skipped.OPENCLAW_HEAVY_CHECK_LOCK_SCOPE=worktree node scripts/run-vitest.mjs src/plugin-sdk/ssrf-policy.test.ts src/config/schema.help.quality.test.ts— 86 passed.Changed gate:
node scripts/check-changed.mjsattempted the configured remote workload route, but Blacksmith/Testbox health failed and no owned-cloud broker was authenticated.OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 OPENCLAW_HEAVY_CHECK_LOCK_SCOPE=worktree node scripts/check-changed.mjspassed the full selected core, core-test, extension, extension-test, docs, config-metadata, typecheck, lint, dead-code, SDK-contract, and architecture/security guard plan locally.git diff --check— passed.Review:
.agents/skills/autoreview/scripts/autoreview --mode local --engine codex --model gpt-5.6-sol --thinking high --stream-engine-output— clean, no accepted/actionable findings (0.97 confidence on the final diff).Maintainer live proof (dist build, ephemeral gateway :19874, isolated state dir)
cron.webhookSsrfPolicy: { dangerouslyAllowPrivateNetwork: true }+ loopback listener on 127.0.0.1:9151: command job with--webhook http://127.0.0.1:9151/hook→ runstatus: ok, webhook payload received by the listener, run record shows"delivered": true, "deliveryStatus": "delivered".not-deliveredwith "Blocked hostname or private/internal/special-use IP address".