refactor(destwebhook)!: whsec_ prefix + eliminate hidden defaults#808
Merged
refactor(destwebhook)!: whsec_ prefix + eliminate hidden defaults#808
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
… prefix
Change default signing secret template from '{{.RandomHex}}' to
'whsec_{{.RandomHex}}' for better DX and consistency with Stripe-style secrets.
BREAKING CHANGE: New webhook destinations will generate secrets with
'whsec_' prefix by default. Existing secrets are unaffected.
Users can set DESTINATIONS_WEBHOOK_SIGNING_SECRET_TEMPLATE='{{.RandomHex}}'
to preserve previous behavior.
…onfig
- Remove internal fallback defaults from SignatureFormatter and
HeaderFormatter — they now panic on empty template strings
- NewSignatureManager requires explicit WithSignatureFormatter and
WithHeaderFormatter options
- Remove timestamp from default signature content/header templates:
content: "{{.Body}}", header: "v0={{.Signatures | join \",\"}}"
- Fix all test files: use NewTestProvider helper, fix s.T() vs t,
fix single-return-value call sites, fix *string→string for
WithHeaderPrefix
- Update destinationmockserver to match new signature format
- Add test helper defaultSignatureManagerOpts() for signature_test.go
- Add panic tests for empty/invalid formatter construction
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
c5774f0 to
c0fb7ec
Compare
Remove hardcoded "webhook-" default from New() — config must provide it explicitly via WithHeaderPrefix. Mirrors the same principle applied to destwebhook: no hidden internal defaults. Add newTestProvider(t) helper for destwebhookstandard tests to provide the "webhook-" prefix centrally. Convert all bare New() calls in test suites to use the helper. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
alexbouchardd
approved these changes
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
{{.RandomHex}}towhsec_{{.RandomHex}}{{.Body}}(was{{.Timestamp.Unix}}.{{.Body}})v0={{.Signatures | join ","}}(wast={{.Timestamp.Unix}},v0={{.Signatures | join ","}})destwebhook.New()validates all required fields, rejects empty stringsdestwebhookstandard.New()no longer defaultsheaderPrefixto"webhook-"— config must provide itNewSignatureFormatter/NewHeaderFormatterpanic on empty template stringsNewSignatureManagerrequires explicitWithSignatureFormatterandWithHeaderFormatterWithHeaderPrefixchanged from*stringtostring(both providers)NewTestProvider(t)/newTestProvider(t)centralize provider constructionBREAKING CHANGE: New webhook destinations generate secrets with
whsec_prefix. Signature header format changes fromt=<ts>,v0=<sig>tov0=<sig>. Existing destinations are unaffected. SetDESTINATIONS_WEBHOOK_SIGNING_SECRET_TEMPLATE,DESTINATIONS_WEBHOOK_SIGNATURE_CONTENT_TEMPLATE, andDESTINATIONS_WEBHOOK_SIGNATURE_HEADER_TEMPLATEto preserve previous behavior.Test plan
destwebhooktests passdestwebhookstandardtests passconfigtests pass🤖 Generated with Claude Code