Skip to content

Webhooks: validate CRC requests before signing, fix CRC cadence - #600

Merged
tcaldwell-x merged 1 commit into
mainfrom
tcaldwell/docs-webhook-crc-hardening
Dec 2, 2026
Merged

tcaldwell-x merged 1 commit into
mainfrom
tcaldwell/docs-webhook-crc-hardening

Conversation

@tcaldwell-x

Copy link
Copy Markdown
Collaborator

The CRC response is an HMAC of crc_token with the same secret and algorithm X uses to sign event payloads. The current samples sign whatever crc_token they receive, so anyone who knows the webhook URL can get a valid signature for an arbitrary payload and POST it back as a forged event.

Changes:

  • Webhooks quickstart: document the nonce parameter and the signature headers on the CRC GET, add a "Validate the CRC request" section (check the 48-char URL-safe Base64 token format; verify the request signature over crc_token=<t>&nonce=<n>), and update the Python, Node.js, and Flask samples to reject invalid CRC requests before signing.
  • Manage replies in real time: same validation in the Flask and Express servers.
  • X Chat real-time events: point the CRC note at the validation guidance.
  • Fix CRC cadence: the quickstart, webhooks intro, and replies guide said "hourly". X re-validates about once every 24 hours (checks run every 30 minutes for webhooks not validated in the past 24 hours), which matches the existing Webhook validation section.

Tested the changed samples against a simulated X CRC request (valid token and signature → 200 with the right response_token; JSON payload as crc_token, unsigned request, or mismatched signature → 400/401; POST verification unchanged). mint validate and mint broken-links on the changed files pass.

@mintlify

mintlify Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
x-corp 🟢 Ready View Preview Dec 2, 2026, 12:00 AM

@tcaldwell-x
tcaldwell-x marked this pull request as ready for review December 2, 2026 03:26
@tcaldwell-x
tcaldwell-x merged commit 54b5ed9 into main Dec 2, 2026
3 checks passed

This branch was successfully deployed

1 active deployment
staging — bb8ec32a Deployed Dec 2, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant