← All notes

GitHub webhook deliveries are checked with an HMAC SHA-256 signature

Answer: You can use a webhook secret to verify that a webhook delivery is from GitHub. Create a secret token for a webhook. Store the token securely on your server. Validate incoming webhook payloads against the token.

The header

Each delivery has a signature header. The hash signature always starts with sha256=. GitHub uses an HMAC hex digest to compute the hash. The hash signature is generated using your webhook's secret token and the payload contents.

Checking the digest

Calculate a hash using your secret token. Then compare the hash that GitHub sent with the expected hash that you calculated. The hmac module implements the HMAC algorithm as described by RFC 2104. The key is a bytes or bytearray object giving the secret key. When comparing a hexdigest to an externally supplied digest, use the compare_digest function instead of the == operator. The example calls compare_digest on expected_signature and signature_header.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: GitHub Docs, Validating webhook deliveries, CC-BY-4.0 (https://raw.githubusercontent.com/github/docs/main/LICENSE). Copyright GitHub, Inc.; Python docs, hmac — Keyed-Hashing for Message Authentication, PSF-2.0 (https://docs.python.org/3/license.html). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: GitHub Docs, Validating webhook deliveries, CC-BY-4.0 (https://raw.githubusercontent.com/github/docs/main/LICENSE). Copyright GitHub, Inc.; Python docs, hmac — Keyed-Hashing for Message Authentication, PSF-2.0 (https://docs.python.org/3/license.html).

Cite this

Permanent ID: iil:note:ztefwydv

iinventedlight. 2026. "GitHub webhook deliveries are checked with an HMAC SHA-256 signature." iinventedlight Library, iil:note:ztefwydv, version of 2026-11-16. https://iinventedlight.com/library/notes/github-webhook-signatures/. License: CC-BY-4.0.

@misc{iil_note_ztefwydv,
  author = {{iinventedlight}},
  title = {{GitHub webhook deliveries are checked with an HMAC SHA-256 signature}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-16},
  url = {https://iinventedlight.com/library/notes/github-webhook-signatures/},
  note = {Permanent ID iil:note:ztefwydv. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/github-webhook-signatures.md.