Skip to main content

Module hook_handlers

Module hook_handlers 

Source
Expand description

POST /agentmux/hook/:job: a script on this computer starts an event job’s run (docs/specs/SPEC_DRONE_REAL_WORLD_JOBS_2026_11_11.md §3.2, webhook_local; the job side is backend::jobs::webhook_local).

Any page open in a browser pane can POST to loopback, so the request has to look like a script’s and not a page’s. The route is on the full router only, which listens on loopback; it is not behind the AuthKey (a script has none), and the job’s own secret is its key. In this order, a request is refused when:

  • its peer is not a loopback address, or its Host is not a loopback name (a DNS rebinding page arrives under its own);
  • it carries an Origin or any Sec-Fetch-* header (a browser sends them, curl and scripts do not);
  • its content type is not application/json (a cross-site form cannot send that without a preflight, which is not answered);
  • it has no secret header, or the secret is not the job’s (the same answer for a job that does not exist or is off);
  • its body is over 64 KiB, or is not a JSON object.

Functions§

handle_hook 🔒
loopback_host 🔒
Whether the Host header names this computer’s loopback: 127.0.0.1, localhost or [::1], with or without a port.
precheck 🔒
What is wrong with a request before the secret is looked at, or nothing. Pure: the handler’s first four rules.
refuse 🔒