Webhook receiver hardening

What middleBrick covers

  • Validate webhook signatures and reject unsigned requests
  • Detect CORS wildcard and header manipulation risks
  • Identify input validation and data exposure issues
  • Probe SSRF via URL-accepting parameters and body fields
  • Map findings to OWASP API Top 10 and compliance evidence
  • Provide remediation guidance for each finding

What webhook receiver hardening means

A webhook receiver is a public endpoint that accepts POST requests from third parties. Hardening means validating and constraining every incoming request so that only expected senders and payloads are processed. This includes verifying signatures, restricting HTTP methods, enforcing idempotency, and rejecting malformed or unexpected data before it reaches application logic.

Common risks when skipping hardening

Without hardening, teams expose endpoints that can be invoked by any remote party. Common outcomes include unintended data modification, duplicate processing, resource exhaustion, server-side request forgery through forwarded URLs, and injection of malicious headers or payloads. Attackers can probe for weak validation and use compromised third-party integrations as a pivot into internal services.

A secure workflow for webhook receivers

Start with a strict allowlist: accept only signed requests from known sources and reject everything else. Validate the webhook signature using the algorithm and secret documented by the sender. Enforce idempotency with an event ID and server-side deduplication window. Use a schema to validate structure, deserialize only safe types, and reject extra fields. Return early for invalid requests with a 400-level status, and log minimal metadata for audit without exposing sensitive content.

Example validation in code:

const crypto = require('crypto');
function verifySignature(body, header, secret) {
  const expected = 'sha256=' + crypto.createHmac('sha256', secret).update(body).digest('hex');
  return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(header));
}
if (!verifySignature(req.body, req.headers['x-hub-signature-256'], webhookSecret)) {
  res.status(401).send('Invalid signature');
  return;
}

What middleBrick covers out of the box

middleBrick scans your webhook receiver URL as an API surface using read-only methods and text-only POST probes. It checks for authentication bypass around webhook secrets, host header manipulation, CORS wildcard usage, and exposure of sensitive data in error messages. Detection categories include input validation, security headers, data exposure, SSRF against URL-accepting parameters, and unsafe consumption surfaces such as excessive third-party targets. Findings map to OWASP API Top 10 and support audit evidence for SOC 2 Type II and PCI-DSS 4.0.

Limitations and complementary controls

middleBrick does not fix, patch, or block findings; it reports and provides guidance. It does not perform active SQL injection or command injection testing, and it cannot detect business logic flaws that require domain understanding. The scanner also does not assess off-channel signals or out-of-band blind SSRF. Use it as one layer in a broader strategy that includes code review, schema validation, rate limiting, and signature verification testing.

Frequently Asked Questions

Can middleBrick authenticate to my webhook endpoint?
Yes, starting at the Starter tier you can provide Bearer, API key, Basic auth, or Cookie credentials for authenticated scans. Domain verification is required to ensure only the domain owner can scan with credentials.
Does the scanner modify data at my webhook endpoint?
No. middleBrick uses read-only methods and text-only POST for LLM probes. It never sends destructive payloads.
How are findings related to compliance frameworks?
Findings map directly to OWASP API Top 10 (2023) and help you prepare for audit evidence under SOC 2 Type II and PCI-DSS 4.0. For other frameworks, the scanner supports alignment with security controls described in relevant standards.
Can I integrate scanning into my CI/CD pipeline?
Yes. The CLI and GitHub Action allow you to gate builds based on score thresholds and receive alerts when new findings appear.
How are webhook-specific risks detected?
By probing input validation, CORS settings, HTTP method handling, error disclosure, and SSRF paths that accept URLs. The scanner also checks for weak or missing signature validation patterns.