Skip to content

fix: Load the svix library the webhook verifier depends on - #577

Open
razor-x wants to merge 1 commit into
mainfrom
claude/ruby-sdk-audit-xbhaia-webhook-require
Open

fix: Load the svix library the webhook verifier depends on#577
razor-x wants to merge 1 commit into
mainfrom
claude/ruby-sdk-audit-xbhaia-webhook-require

Conversation

@razor-x

@razor-x razor-x commented Sep 1, 2026

Copy link
Copy Markdown
Member

Problem

Found while writing the webhook specs the audit asked for (M5, "zero tests"). lib/seam/webhook.rb required only svix/webhook and svix/errors. Svix::Webhook#verify calls Svix.secure_compare, which is defined in svix/util and loaded by the svix entry point, so unless the application happened to require "svix" itself, verifying a correctly signed payload raised:

NoMethodError: undefined method `secure_compare' for module Svix

Forged payloads still raised Seam::WebhookVerificationError (that check runs before the comparison), so the documented rescue path looked fine while the success path was broken.

Fix

require "svix".

Tests

New spec/webhook_spec.rb, signing payloads offline with Svix::Webhook#sign: a valid event parses to its SeamEvent subclass, mixed-case header names are accepted, a tampered payload, a wrong secret, an expired timestamp, and each missing header raise Seam::WebhookVerificationError with the exact svix message, and the re-export is the svix class.

Revert-check against main: 5 failures, all NoMethodError: undefined method 'secure_compare' for module Svix.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SQW83gyXeUG61RDrHEky97


Generated by Claude Code

Seam::Webhook required only svix/webhook and svix/errors, but
Svix::Webhook#verify calls Svix.secure_compare, which lives in svix/util
and is loaded by the svix entry point. Unless the application happened to
require svix itself, every verification of a correctly signed payload
raised NoMethodError instead of returning the event. Nothing caught it
because the webhook verifier had no specs.

Require svix and add the first webhook specs, signing payloads offline
with the svix library so they cover a valid event, mixed-case headers, a
tampered payload, a wrong secret, an expired timestamp, and each missing
header.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SQW83gyXeUG61RDrHEky97
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.

2 participants