[Go to site: main page, start]

squirrelscan
GitHub

Webhooks

Subscribe external systems to your squirrelscan audit events

Outbound webhooks let your organization push audit events to any HTTPS endpoint you control - a Slack relay, a CI pipeline, your own backend. squirrelscan POSTs a signed JSON payload the moment an event fires, so you can react to completed audits and new issues without polling.

Creating an endpoint

  1. Open your organization at app.squirrelscan.com.
  2. Go to Settings → Webhooks.
  3. Click Add endpoint, enter an HTTPS URL, and select the events to subscribe to.
  4. Save. The signing secret is shown once - copy and store it securely. It is never displayed again.

Each organization can have up to 20 endpoints. Toggle an endpoint off at any time to pause delivery without deleting it, and view the recent deliveries list to confirm endpoints are healthy.

Event types

EventFires when
audit.completedA cloud audit finishes (on-demand or CLI-triggered)
issues.detectedNew issues are detected during an audit
schedule.completedA scheduled audit finishes
notification.createdA notification for the organization is created, such as an audit result, new issues or a broken link alert

Payload

Every delivery is a JSON body with a stable, versioned envelope:

{
  "version": "1",
  "event": "audit.completed",
  "id": "del_01J...",
  "timestamp": "2026-06-15T12:34:56.000Z",
  "orgId": "org_01J...",
  "data": {
    "websiteId": "...",
    "auditId": "...",
    "runId": "...",
    "reportId": "...",
    "url": "https://nutshop.squirrelscan.com",
    "domain": "nutshop.squirrelscan.com",
    "healthScore": 87,
    "errorCount": 2,
    "warningCount": 5,
    "passedCount": 120,
    "totalPages": 25
  }
}
  • version is the contract version. Always check it and ignore envelopes whose version you don’t understand - the shape of data may grow over time.
  • event is one of the event types above; data is the payload for that event.
  • id is the delivery’s unique ID (also sent in X-Squirrel-Delivery) - use it to dedupe retries.

The data shape varies by event. issues.detected carries created/updated/resolved counts and, once issue triage has filed the audit’s issues, the issues themselves (see issues.detected payload); schedule.completed carries the completed run + report identifiers and healthScore (null for a failed or rule-filtered run).

issues.detected payload

At most one issues.detected delivery is sent per audit. It always has the audit identifiers and counts:

{
  "version": "1",
  "event": "issues.detected",
  "id": "del_01J...",
  "timestamp": "2026-06-15T12:34:56.000Z",
  "orgId": "org_01J...",
  "data": {
    "websiteId": "...",
    "auditId": "...",
    "runId": "...",
    "domain": "example.com",
    "created": 3,
    "updated": 1,
    "resolved": 2,
    "source": "triage",
    "issues": [
      {
        "id": "...",
        "number": 12,
        "priority": "high",
        "critical": false,
        "transition": "created"
      }
    ],
    "moreIssues": 0
  }
}
FieldMeaning
websiteId, auditId, runId, domainThe website and audit the event belongs to
created, updated, resolvedHow many issues the audit created, updated and resolved
sourceAbsent on the counts-only delivery. "triage" when issue triage filed the audit’s issues; only then are issues and moreIssues present
issuesThe issues the audit created, reopened or raised in priority: at most 100, ordered by number
moreIssuesHow many further issues are not listed in issues

Each entry in issues has:

FieldMeaning
idThe issue ID. It is stable across audits and is the ID the API and MCP issue tools take
numberThe issue’s number on its website (#12)
prioritycritical, high, medium, low, or null when unprioritized
criticaltrue when the issue is in the critical set, such as a leaked secret, an expiring certificate or critical pages set to noindex
transitionWhy it is listed: created, reopened or priority_raised

Handle both forms: check source before reading issues, and use the envelope id to dedupe retries.

Headers

HeaderValue
X-Squirrel-EventThe event name, e.g. audit.completed
X-Squirrel-Signaturesha256=<hex> HMAC of the raw request body (see below)
X-Squirrel-TimestampISO-8601 emission time (matches timestamp in the body)
X-Squirrel-DeliveryUnique delivery ID (matches id in the body)

Verifying the signature

squirrelscan signs every delivery with HMAC-SHA256 over the raw request body using your endpoint’s signing secret. The hex digest is sent in X-Squirrel-Signature with a sha256= prefix.

To verify, compute the HMAC over the exact bytes you received (do not re-serialize the parsed JSON - whitespace differences will break the comparison) and compare it to the header value using a constant-time comparison to avoid timing side-channels:

import { createHmac, timingSafeEqual } from "node:crypto";

function verifyWebhook(rawBody: string, signatureHeader: string, secret: string): boolean {
  // Header form: "sha256=<hex>"
  const provided = signatureHeader.startsWith("sha256=")
    ? signatureHeader.slice("sha256=".length)
    : signatureHeader;

  const expected = createHmac("sha256", secret).update(rawBody).digest("hex");

  // Constant-time compare: bail if lengths differ, then compare bytes.
  const a = Buffer.from(provided, "hex");
  const b = Buffer.from(expected, "hex");
  return a.length === b.length && timingSafeEqual(a, b);
}

Reject any request whose signature does not verify. You can additionally reject deliveries whose X-Squirrel-Timestamp is too far from your clock to limit replay of captured deliveries.

Retries and delivery

  • A 2xx response marks the delivery delivered.
  • A 4xx response is treated as a permanent failure - squirrelscan does not retry (fix the endpoint, the next event will deliver).
  • A 5xx response, a network error, or a timeout is retried with exponential backoff, up to 3 attempts total per event.
  • Delivery is best-effort: a failing endpoint never blocks the audit pipeline, and endpoints are delivered to in parallel.

Return 2xx quickly and do heavy work asynchronously so a slow handler doesn’t cause a timeout and a retry. Use the X-Squirrel-Delivery ID (or the body id) to make your handler idempotent across retries.

Type to search…

↑↓ navigate↵ openesc close