Skip to content

Webhook Providers and Plugins

Mcdavid Obioha edited this page Dec 1, 2026 · 2 revisions

Webhook Providers and Plugins

Kera works for any HTTP or webhook traffic. Provider detection is a convenience layer that adds a label such as stripe or github, plus an advisory event type. It never gates capture, forwarding, replay, or inspection.

Provider labels are debugging aids, not authentication. A request with stripe-signature is labeled stripe whether or not the signature is valid. Kera forwards and stores original bytes and does not verify or regenerate signatures.


Universal capture first

Every request sent to the Kera listener is handled the same way:

  1. Check for x-kera-hop; reject loops with 508.
  2. Capture method, path, raw query, lowercase multi-value headers, and raw body bytes.
  3. Forward to the configured target.
  4. Capture response status, headers, body, and timing.
  5. Persist the exchange in SQLite.
  6. Derive an optional provider label and event type from the request.
  7. Return the upstream response unchanged.

Provider detection therefore adds metadata; it does not change proxy behavior. Unrecognized traffic still appears in list_requests with provider: null and eventType: null.


Built-in providers

The registry is tried in table order; the first match wins.

provider Match in normalized request headers eventType
stripe stripe-signature JSON type, e.g. invoice.payment_failed
github x-github-event Event header plus JSON action if present, e.g. pull_request.opened; otherwise header alone
shopify x-shopify-topic Topic header, e.g. orders/create
svix svix-id, svix-timestamp, and svix-signature JSON type when supplied, e.g. user.created for a Clerk event delivered by Svix
twilio x-twilio-signature null; callback types vary by Twilio product
paystack x-paystack-signature JSON event, e.g. charge.success
paddle paddle-signature JSON event_type, e.g. transaction.completed
lemonsqueezy x-signature and a usable x-event-name Event header, e.g. order_created

Signature headers recognized for warning purposes:

Provider Signature header(s)
Stripe stripe-signature
GitHub x-hub-signature-256, legacy x-hub-signature
Shopify x-shopify-hmac-sha256
Svix svix-signature
Twilio x-twilio-signature
Paystack x-paystack-signature
Paddle paddle-signature
Lemon Squeezy x-signature

Stripe

  • Matches the presence of stripe-signature.
  • Reads the top-level JSON type for the event label.
  • Example: "type": "invoice.payment_failed" → eventType: "invoice.payment_failed".
  • A malformed, incomplete, or non-UTF-8 body falls back to a provider match with no event label.
  • Use list_requests with {"provider":"stripe"} to filter.

GitHub

  • Matches the presence of x-github-event.
  • Uses the event header as the base label.
  • If the body contains a valid top-level JSON action, appends it: pull_request + opened → pull_request.opened.
  • Repeated event headers are not used as labels.
  • GitHub signed deliveries are recognized through x-hub-signature-256 or legacy x-hub-signature.

Shopify, Svix/Clerk, Twilio, Paystack, Paddle, Lemon Squeezy

These are already built in. Use them as reference implementations when adding a provider.

  • Shopify: topic header must match ^[a-z0-9_]{1,63}/[a-z0-9_]{1,63}$.
  • Svix / Clerk: requires all three Svix headers. Clerk events delivered by Svix are labeled svix, not clerk. The event type comes from JSON type.
  • Twilio: signature header only; no generic event type because callback shapes vary.
  • Paystack: JSON event.
  • Paddle: JSON event_type.
  • Lemon Squeezy: requires both x-signature and a usable x-event-name; the event header is the label.

Detection rules and limits

  • Headers passed to detection are lowercase and may contain multiple values.
  • Body metadata is read only when the body is:
    • complete (not capture-truncated),
    • at most 1 MiB,
    • UTF-8 JSON,
    • not content-encoded (other than identity).
  • Event labels must be bounded strings. Invalid labels fall back to header metadata only.
  • Repeated event headers are not used as event labels.
  • A matched provider is still stored if its event label is unavailable.
  • Existing captures are not relabeled when a provider is added.
  • Filter values in list_requests are exact, lowercase provider names.
  • Captured signature headers are masked by default in inspection output.

Signed replays

Kera does not re-sign payloads.

When replaying a captured request:

  • Omit override_body to replay complete original bytes.
  • A capture with a truncated/incomplete body requires an override.
  • If the original was recognized as signed and the replay changes, removes, or replaces an incomplete body, the result includes:
{
  "warnings": [
    {
      "code": "SIGNATURE_MAY_BE_INVALID",
      "message": "Kera did not re-sign the modified webhook body. Upstream signature verification may fail."
    }
  ]
}

Warnings are based on the original capture's headers. Even unchanged bytes may fail verification if the provider checks timestamps or the original delivery URL.


The WebhookProvider interface

Current interface in packages/core/src/providers/provider.ts:

import type { HeaderMap } from '../capture/types.js';

export interface WebhookProvider {
  readonly name: string;
  readonly signatureHeaders?: readonly string[];
  detect(headers: HeaderMap, body?: Uint8Array): { matched: boolean; eventType?: string };
}

detect(headers, body?)

  • Receives lowercase, multi-value headers and optional captured bytes.
  • Returns { matched: false } for unrelated requests.
  • Returns { matched: true, eventType? } for a match.
  • Keep labels bounded and handle absent/malformed bodies without throwing.
  • Use singleHeader() for headers that must have exactly one value.
  • Use readEventField() and isEventLabel() for safe JSON event extraction.

signatureHeaders?

Declare lowercase signature header names so Kera can:

  • mark the provider as signed for replay warnings,
  • ensure centralized redaction masks those headers.

resign() is not implemented

There is no resign() method in the current interface. Kera never regenerates provider signatures. A future cryptographic re-signing design would require verified official provider test vectors and explicit security review; it is not part of Milestone 7 and has no scheduled date. Do not build integrations that assume Kera will re-sign a modified webhook.


Add a new provider

The workflow is intentionally small. All eight built-in providers use it.

1. Add a module

Create packages/core/src/providers/<name>.ts. Prefer the shared signedProvider() helper when detection is just a signature header plus one JSON field.

// packages/core/src/providers/example.ts
import { signedProvider } from './provider.js';

export const example = signedProvider(
  'example',
  'x-example-signature',
  'event_type',
);

For custom logic:

import {
  isEventLabel,
  readEventField,
  singleHeader,
  type WebhookProvider,
} from './provider.js';

const eventHeader = 'x-example-event';

export const example: WebhookProvider = {
  name: 'example',
  signatureHeaders: ['x-example-signature'],
  detect(headers, body) {
    if (!Object.hasOwn(headers, eventHeader)) return { matched: false };

    const event = singleHeader(headers, eventHeader);
    if (!isEventLabel(event)) return { matched: true };

    const action = readEventField(body, 'action');
    return {
      matched: true,
      eventType: action === undefined ? event : `${event}.${action}`,
    };
  },
};

2. Verify redaction

If the provider has signature headers, confirm they are masked by packages/core/src/redaction/redact.ts. Header names containing signature, token, secret, key, or password are already masked, and known credential headers are explicitly listed. Add the header to the explicit set if it does not match those patterns.

3. Register it

Add the import and instance to packages/core/src/providers/registry.ts in the desired precedence order. First match wins, so place specific providers before broad ones.

const builtInProviders: readonly WebhookProvider[] = [
  stripe,
  github,
  shopify,
  svix,
  twilio,
  paystack,
  paddle,
  lemonsqueezy,
  example,
];

4. Add tests

Use synthetic payloads and non-authenticating signature placeholders. Never commit real webhook secrets, customer payloads, or valid signatures.

Cover:

  • header match and non-match,
  • event label extraction,
  • missing, malformed, incomplete, and oversized bodies,
  • repeated headers,
  • precedence when another provider also matches,
  • redaction of the signature header,
  • list_requests filtering by the new provider name.

5. Update documentation and release metadata

  • Add the provider to the table in this page.
  • Update any provider counts in README.md / docs/PROVIDERS.md.
  • Add a changeset with pnpm changeset.

6. Run quality gates

pnpm run check

Provider work is a behavior change: tests and docs are required.


Claude Code plugin and providers

The Claude Code plugin is packaging, not a webhook provider. It bundles the MCP server definition and the webhook debugging skill. It does not change provider detection, redaction, or replay behavior.

  • Install: /plugin install kera --marketplace mcdavidobioha/kera
  • Skill: /kera:webhook-debugging
  • Setup details: Quickstart and MCP Setup

Provider plugins in this wiki mean registry modules under packages/core/src/providers/. They are in-process, typed, and tested; there is no third-party dynamic plugin loader in Milestone 7.


Related pages

Clone this wiki locally