Repository navigation
fix(alerts): encrypt webhook secrets for the destination or profile webhook that holds them - #36939
Conversation
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
|
|
…ebhook that holds them
…ecrets are encrypted
96ca28e to
2d0b44b
Compare
…d ciphertext to bound
… webhook values for copies
…secret for copies of a webhook value
Code Review ✅ Approved 2 closed / 2 findings🔴 High risk · Owner-bound webhook-secret encryption and the 2.1 migration alter credential access; migration errors could make stored secrets unusable and interrupt alert delivery. Encrypts webhook secrets per owner so each alert destination or profile webhook holds keys only it can decrypt, with a 2.1.0 data step that re-encrypts stored values where possible. Two issues were resolved this session: the copy check now covers Fernet stores whose table names lack ✅ 2 closed✅ Security: Copy check skips Fernet stores whose table name lacks
|
| Compact |
|
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source



Describe your changes:
Webhook secrets (the endpoint, header values, the signing key, and the OAuth2 client id and secret) now have encryption keys of their own: each one is encrypted for the alert destination, or the user or team profile webhook, that holds it, and it can only be decrypted there.
BoundCiphertext(new, insecrets) derives one key per owner and field from the configured Fernet keys (HKDF-SHA256, BouncyCastle). Key rotation works as before. Values are stored asfernet:bound:<token>, so existing checks still treat them as ciphertext. The owner is aSecretOwner(PR feat(secrets): store owned credentials under keys derived from their owner's id #36706): the destination id for an alert destination, and the user or team id plus the slot for a profile webhook.ConfigSecretsis the only place webhook secrets are encrypted or decrypted. A stored value that does not decrypt for its owner is refused with "The value at '' must be entered again": a test send answers 400, a real send records the destination as not usable with that reason (its status and recent events show it), and a profile webhook is left out of the send while its other webhooks still send.WebhookRequestsandOAuth2TokenManagerno longer decrypt anything; they use the configuration they are given.WebhookSecretsMigration, which PR fix(alerts): handle profile webhooks like alert destinations #36722 leaves to this PR) encrypts stored plaintext for its owner. The values earlier releases stored encrypted (an alert destination's signing key and OAuth2 client id and secret) are encrypted for their destination again, unless the same value is also stored somewhere else (StoredCiphertextCopies). That check reads every table with ajsoncolumn except a frozen list of large ones that cannot hold a secret (data assets, event logs, relationships, stored documents, time series), so a store nobody listed, such as one a distribution adds, is still read. It finds versions by entity id through the primary key, so its cost does not follow the number of data assets or events. Any other stored value stays as it is and is reported as above until it is entered again. No destination is disabled and no profile webhook is removed. Versions, change descriptions and stored change events keep the mask. Running the step again changes nothing. The step's rules are frozen beside it inStoredWebhookSecrets, so it calls no live alerting or secrets code, and a row it cannot read stops it with an error that names the row.docs/decisions/2026-11-03-a-webhook-secret-opens-only-where-it-was-written.md, plus a v8 note on the 2026-10-23 destination secrets record.Order: Destination ids own their secrets, so this data step runs after the 2.1.0 destination id step from PR #36791 (
IngestionPipelineMigrationEntryPointTestchecks the order).Upgrade note: Signing keys and OAuth2 credentials keep working after upgrading to 2.1.0. A webhook value that is not carried over is reported, on its alert destination and by a test send, as a field to enter again; the destination stays enabled.
Type of change:
Tests:
BoundCiphertextTest(including the RFC 5869 test vectors),StoredWebhookSecretsTest,DestinationSecretsTest,ProfileWebhookSecretsTest,WebhookRequestsTest. Every alerting, secrets, migration and fernet unit test passes. The new decrypt, signing and token request checks fail without this change and pass with it.WebhookSecretOwnershipIT(new, runs the upgrade step end to end),WebhookSecretsMigrationIT,ProfileWebhookSecretsIT,EventSubscriptionResourceIT,OAuth2TokenManagerIT,DispatchScenariosIT,TemplateTestSendITpass.UI screen recording:
Not applicable: no UI change.
Checklist: