Skip to content

Add the webhooks resource and a signature verifier - #9

Closed
0xFantomMenace wants to merge 2 commits into
fix/package-scopefrom
feat/webhooks-resource
Closed

0xFantomMenace wants to merge 2 commits into
fix/package-scopefrom
feat/webhooks-resource

Conversation

@0xFantomMenace

Copy link
Copy Markdown
Member

Eighteen operations covering endpoints, subscriptions, watched addresses, the delivery log, and the two previews.

src/webhook_signature.rs verifies a delivery. It takes &[u8] rather than a Value, because the body we sign is PostgreSQL's rendering of the payload and re-serialising it will not reproduce those bytes.

It collects every v1 in the header, so a receiver holding either secret keeps verifying through the 24 hour rotation overlap, and it compares with verify_slice, which is constant time and length checked.

WebhookVerifier has a hand written Debug that redacts the secrets it holds. A verifier is long lived and tends to end up inside application state, a tracing span or an error report that derives Debug, and the derived impl would put every signing secret in that log line. WebhookEndpoint::secret and RotatedSecret::secret are deliberately left visible, because those are one shot values the caller has to read in order to store them.

Free plans do not include webhook delivery. Estimates and dry runs stay open on every plan for event types that are not scoped to a watched wallet.

Stacked on the packaging fix, so this PR shows only the webhooks commit. Retarget to main once that merges.

Cargo's exclude is a denylist, so any new directory in the working tree ships
by default. Switch to an include allowlist naming src, examples and the
metadata files, which is the same set the crate ships today.

Add a CI job that plants a stray directory and fails if it reaches the crate,
and ignore agent working directories so they never enter the tree.
Eighteen operations covering endpoints, subscriptions, watched addresses, the
delivery log, and the two previews.

src/webhook_signature.rs verifies a delivery. It takes &[u8] rather than a
Value, because the body we sign is PostgreSQL's rendering of the payload and
re-serialising it will not reproduce those bytes. It collects every v1 in the
header so a receiver holding both secrets keeps verifying through a rotation,
and it compares with verify_slice, which is constant time and length checked.
WebhookVerifier has a hand written Debug that redacts the secrets it holds,
because a verifier tends to end up inside application state that derives Debug.

Free plans do not include webhooks. Estimates and dry-runs stay open on every
plan for event types that are not scoped to a watched wallet.
@0xFantomMenace
0xFantomMenace deleted the branch fix/package-scope September 23, 2026 02:36
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