Skip to main content

Module webhook_local

Module webhook_local 

Source
Expand description

A job on the webhook_local source starts a run when a script on this computer POSTs to http://127.0.0.1:<port>/agentmux/hook/<job id> with the job’s secret (docs/specs/SPEC_DRONE_REAL_WORLD_JOBS_2026_11_11.md §3.2; the route is server::hook_handlers).

The job’s filter holds one thing: secret_sha256, the SHA-256 of the secret, as 64 lowercase hex characters (printf %s "$SECRET" | shasum -a 256). The secret itself is never stored: whoever writes the hook’s caller (a git hook, a CI script) keeps it, and a job definition, which agents and the Jobs list can read, holds only the hash. A secret should be random (openssl rand -hex 32); a guessable one makes its hash guessable.

The run reads the request as {{trigger.body}} (the JSON object the script sent) and {{trigger.received_ms}}. The body sits under its own key so a script’s own field names can never be read as the event’s.

Constants§

ID_HEADER
An optional header naming the call, so a script that retries a call it did not hear back from starts one run.
MAX_BODY
The most a request body may be.
MAX_ID_CHARS
The longest a call id may be.
SECRET_HEADER
The header that carries the secret: never the URL, a query or the body, so a cross-site form cannot send it.

Functions§

accepts
Whether job is an enabled event job on webhook_local, and secret is its secret. The hashes are compared in constant time. A job that is not one, or is off, never matches: the caller answers all of those the same way.
hash_of
The hash a job keeps for a secret.
validate_filter
A webhook_local trigger’s filter: the secret’s hash, and nothing else.