fix: webhook secret rotation 24h default#951
Merged
Merged
Conversation
Extends the rotation test: rotate with an explicit previous_secret_invalid_at, then rotate again without one. The second rotation must default to now+24h, but the stored window is carried forward instead — the Update handler merge-patches stored credentials into the request before Preprocess, so rotateSecret mistakes the stored timestamp for a caller-provided one. Once that timestamp is in the past, every plain rotation produces an already-expired previous secret. Failing test; fix follows. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…t, not merged state The Update handler merge-patches stored credentials into the destination before Preprocess, so on any rotation after the first rotateSecret saw the stored previous_secret_invalid_at as caller-provided and skipped the documented now+24h default. Once the stored timestamp was in the past, every subsequent plain rotation produced an already-expired previous secret, which ObfuscateDestination then stripped from API responses. Give Preprocess the caller's view of the provider-owned fields via PreprocessDestinationOpts.Request (config and credentials exactly as sent, before merging), and have rotateSecret read the custom invalidation window from there instead of inferring intent from the merged map. Applies to both webhook providers (legacy and standard), which duplicate the rotation logic. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
alexbouchardd
approved these changes
Jun 12, 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.
Rotating a webhook secret without
previous_secret_invalid_atis documented to default the window to now+24h, but the default only ever applied to a destination's first rotation. The Update handler merge-patches stored credentials into the destination beforePreprocess, so on later rotationsrotateSecretmistook the stored timestamp for a caller-provided one and carried it forward — once that timestamp was in the past, every plain rotation produced an already-expired previous secret, which was then stripped from API responses.Fixes it by passing the caller's raw config/credentials through
PreprocessDestinationOpts.Request, so providers distinguish "caller sent this field" from "merged from storage". Both webhook providers updated (the rotation logic is duplicated).🤖 Generated with Claude Code