New Tool Radar

AI Agents & Automation

How to Verify a Webhook Signature Before Triggering an Agent Run

Verify a webhook signature before triggering an agent run, so forged requests never start work.

Schematic with three steps: Check the signature before any other work; Reject unsigned or mismatched requests outright; Test with a valid request and a.

A webhook trigger is an open door: anyone who can reach the endpoint can start your agent. A signature is the lock on that door. The sending service signs each request with a shared secret, and your receiver checks the signature before doing anything else. Zapier’s trigger docs show the shape of the problem: an agent can start from a webhook, a form submission, or another app, and each of those starts the agent with data attached. If the data is forged, the agent does forged work. Check the signature first, reject anything unsigned, and only then let the agent run.

What you need

  • A webhook endpoint that triggers an agent run
  • The shared secret the sender signs with, stored safely, never in a log
  • A test request with a valid signature and one with a forged signature

Step 1: Check the signature before any other work

On every incoming request, compute the expected signature from the shared secret and compare it with the one the request carries. Do this before parsing the payload, before logging it, and before starting the agent.

Step 2: Reject unsigned or mismatched requests outright

If the signature is missing or does not match, return an error and stop. Do not run the agent, do not queue the work, and do not log the payload.

Step 3: Test with a valid request and a forged one

Send a valid signed request and confirm the agent runs, then send a forged one and confirm nothing runs. If the forged request starts work, the check is in the wrong place.

Worked example: synthetic webhook signature check

The table below is a synthetic example. It shows the expected result of signature verification; no webhook was sent.

Request Signature valid? Agent runs?
Signed form submission Yes Yes
Forged submission No No
Unsigned request No No
No forged work starts Yes Pass

Expected result (UNTESTED). the signed request starts the agent, and the forged and unsigned requests start nothing. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • A shared secret that leaks is a broken lock: rotate it and store it safely.
  • Signature checks verify the sender, not the content: a signed but wrong payload still runs.
  • Clock skew between sender and receiver can break time-based signatures, so allow a small window.
  • The check must run before any work, or the protection is decoration.

Sources

See all