refactor(webhooks): rename misleading SecretHash to ProtectedSecret#1312
Merged
iammukeshm merged 1 commit intoJun 24, 2026
Merged
Conversation
WebhookSubscription.SecretHash stores the per-subscription signing secret encrypted at rest via ASP.NET Data Protection (IWebhookSecretProtector.Protect), then recovered with Unprotect to sign outbound HMAC payloads. The name "SecretHash" wrongly implies a one-way, irreversible hash, misrepresenting the value's security properties and inviting mishandling. - Rename the persisted property/column to ProtectedSecret (matches the existing protectedSecret local in CreateWebhookSubscriptionCommandHandler) with a RenameColumn migration (reversible, no data loss). - Rename IWebhookDeliveryService.DeliverAsync secretHash parameter to signingSecret: there the value is already unprotected plaintext used for signing, matching the signingSecret local in WebhookDispatchJob. No public contract change (the secret is write-only via command).
Member
|
Thanks @marcelo-maciel — great catch. |
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.
What
WebhookSubscription.SecretHashstores the per-subscription signing secret encrypted at rest via ASP.NET Data Protection (IWebhookSecretProtector.Protect), then recovers it withUnprotectto compute the outbound HMAC signature. The nameSecretHashwrongly implies a one-way, irreversible hash, which misrepresents the value's security properties and invites mishandling (treating it as safe-at-rest, or comparing it instead of unprotecting it).This renames the value to describe what it actually is.
Changes
WebhookSubscription.SecretHash→ProtectedSecret(property +Createparameter), matching the existingprotectedSecretlocal inCreateWebhookSubscriptionCommandHandler.RenameColumnmigration (webhooks.Subscriptions.SecretHash→ProtectedSecret) — reversible, preserves existing rows.IWebhookDeliveryService.DeliverAsyncparametersecretHash→signingSecret: there the value is the already-unprotected plaintext used for signing, matching thesigningSecretlocal inWebhookDispatchJob.Notes
TreatWarningsAsErrors).