You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(alerts): keep destination endpoint, header values and credentials encrypted, masked and restorable - #36147
Alert destinations now treat the whole credential surface of a webhook configuration the way the governance workflow sinks already treat theirs:
The endpoint, every custom headers value, and the bearer / OAuth2 credentials of a Slack, MS Teams, Google Chat or generic Webhook destination are encrypted before the alert is stored (create and every update path, before the diff, so the change description holds ciphertext too).
Every response of the event-subscription API and of the MCP tools returns those fields masked (*********), for every caller, including version history and change descriptions.
A request that sends the mask back keeps the stored value (by destination id, or by position for a PUT that carries no ids). A plaintext secret equal to the stored one keeps the stored ciphertext, so re-sending a configuration changes nothing.
The secrets are decrypted only where a message is actually sent (WebhookConfigRules.stored / submitted).
Requests that cannot be honoured are refused with 400: a mask with no stored value behind it, ciphertext that is not the stored value, and a JSON Patch copy/move of a stored secret into another field.
POST /testDestination with a destination sent back as read uses the stored secrets, only for a caller allowed to edit the alert that holds them, and only when every secret is the stored one.
Changed destinations are compared with their secrets decrypted, so an alert stored by an earlier release is still not re-validated when it is renamed.
This change came out of an internal security review; the specifics are tracked with the security team out-of-band and are intentionally not described here. Decision record: ADR:2026-10-23-alert-destination-secrets-are-encrypted-masked-and-restored.
Type of change:
Bug fix
Improvement
New feature
Breaking change (a client that re-creates an alert from a read copy must now supply the real endpoint, header values and credentials — the same contract as a service connection; the alert form shows the mask where it showed the URL or header value)
Documentation
High-level design:
ConfigRules.secretFields(JsonNode) is the one place a channel names its secrets; SecretWebhookConfigRules lists the webhook-family ones through WebhookSecrets.
DestinationSecrets (encrypt / decrypt / mask / restore) and DestinationSecretGuards (what a request may say) work on any channel through that method; the resource, repository and MCP response masker only call them.
EventSubscriptionRepository.getUpdater is the single point where the stored and incoming alert meet before the diff: restore, guard, encrypt happen there. validatePatch closes the copy/move path.
EventSubscriptionResource masks every read and write response on a copy (entities may come from the shared cache) and resolves stored secrets for testDestination.
Alternatives considered: masking only on read while storing plaintext (leaves history, change events and the row itself as written); returning the ciphertext instead of a mask (the current behaviour of the bearer key — ciphertext round-trips but is an awkward form field value and ties clients to the encryption format). Both rejected in favour of the existing sink-secret model.
Tests:
Use cases covered
Create, get by id / name, list, versions, /destinations, and reads by a data consumer and by a bot: no plaintext secret and no ciphertext in any response; the stored row holds ciphertext that decrypts to the submitted values.
PATCH sending the masks back with another field changed: stored ciphertext byte-identical afterwards. PATCH with a new endpoint: new ciphertext for it, other secrets kept, old value absent from version history.
Refused with 400: mask on create, ciphertext on create, mask whose destination id matches nothing stored, patch copy of a secret into description. A refused request changes nothing.
testDestination with a destination sent back as read reaches the receiver with the real header; a changed endpoint beside a masked header, or an unknown destination id, is refused and nothing is sent.
A real tick delivers to the configured Slack URL with the configured Authorization header while the row holds ciphertext (DispatchScenariosIT).
Unit: encryption of endpoint and headers for all four webhook types, email untouched, idempotent re-encryption, decrypted copy, masking of destinations / change descriptions / version history on a copy, restore by id and by position, plaintext re-sent keeps ciphertext, all guards, MCP masking.
Added: EventSubscriptionResourceIT#test_destinationSecretsAreMaskedEncryptedAndRestored, #test_destinationSecretsTheServerAloneWrites_400, #test_testDestinationWithMaskedValuesUsesTheStoredSecrets; DispatchScenariosIT#aDestinationIsSentToAsConfiguredWhileStoredEncrypted. On 2026-10-29 also EventSubscriptionResourceIT#test_receiversCannotRedirectStoredCredentials and the two masked-destination cases of TemplateTestSendIT.
Ingestion integration tests
Not applicable (no ingestion changes).
Playwright (UI) tests
Updated the two alert-details assertions that read the endpoint field back: it now shows the mask (notificationAlert.ts, observabilityAlert.ts). No UI code change: the alert form already round-trips untouched fields through a JSON patch, so masked values are restored server-side.
Manual testing performed
Against a local server before the change: created an alert with a Slack incoming-webhook URL and an Authorization header as admin, read it back as a freshly registered non-admin user — both returned as written.
After the change, read back as that user: endpoint, header value and credential all return as *********; the stored row holds Fernet ciphertext.
Integration (local, -Pmysql-elasticsearch -DintegrationTests.lane=parallel): EventSubscriptionResourceIT 226 run / 0 failures (27 inherited skips), DispatchScenariosIT 8 run / 0 failures — the four new methods listed above executed and passed.
Functional review follow-up (2026-10-26)
Commits: 303165fa335, 23228fbce9d.
Restores masked and plaintext PUT destinations before encryption; preserves existing destination IDs and reserves explicitly supplied IDs when inserting new destinations.
Masks synchronous DELETE responses for both encrypted and legacy plaintext rows.
Prevents masked destination tests from redirecting stored OAuth credentials to a different token URL.
Protects numeric webhook header values and permits unrelated copy/move patches when unchanged public values coincide with a legacy secret.
Added seven API regressions plus focused unit regressions. Both follow-up review findings were reproduced with failing tests before their fixes.
Validation on the final code:
Selected service/MCP unit tests: 110 passed, no failures or skips.
MySQL/Elasticsearch alert API and batch suites: 244 passed, 38 inherited skips; all seven added API regressions executed and passed.
Dispatch suite: 8 passed on a fresh retry after freeing Docker memory. The preceding combined run had one delivery-count failure during database connection failures; it is not presented as a clean first run.
The broader affected-test plan was attempted but interrupted after widespread HTTP/MySQL timeouts; remaining isolated/RDF/cache lanes were not run. This is not a full affected-suite pass.
The two existing services temporarily stopped with permission were restarted afterward.
Review follow-up (2026-10-29)
Commits: bbe9ddcd147.
POST /v1/notificationTemplates/send refused a destination sent back as it was read — the mask failed URL validation, so a template could no longer be test-sent to an existing alert's destination. Both test-send paths now resolve masks through one DestinationTestSecrets (authorize EDIT_ALL on the alert, restore the stored secrets, require them as stored); testDestination delegates to the same class.
A destination's receivers list replaces the endpoint at send time and is sent the same headers and credentials, so it is a target now too: a request that changes it while keeping any stored or masked value at another secret field is refused with 400 on every write path and both test paths. Email destinations are unaffected (the email channel names no secret fields).
ADR revision v6 records both rules.
Validation on the final code:
Unit: DestinationSecretsTest + DestinationSecretGuardsTest — 46 passed; the full alerting package — 489 passed, 0 failures.
Integration (local, postgres lane): EventSubscriptionResourceIT + TemplateTestSendIT — 280 testcases run, 0 failures, 38 inherited skips; the four new methods executed and passed.
Each new regression was reproduced failing before its fix (RED runs with the fix reverted): the reported Invalid webhook endpoint URL: Invalid URL format on the template send, the stored header delivered to a caller-chosen receiver, and the receivers PATCH accepted.
Spotless apply/check and the java impact-map hook passed.
UI screen recording:
N/A — backend change; the form shows ********* where it showed the URL.
…ypted, masked and restorable
A webhook-family destination's endpoint, every custom header value and
its bearer/OAuth2 credentials are now one secret set: encrypted before
the alert is stored (create and every update path, before the diff),
decrypted only where a message is sent, and masked in every response of
the event-subscription API and the MCP tools, version history and change
descriptions included. A request that sends the mask back keeps the
stored value; a mask with nothing behind it, ciphertext that is not the
stored value, and a PATCH copy/move of a secret are refused. A test send
of a destination sent back as read uses the stored secrets, for a caller
allowed to edit the alert, and only as stored.
Changed destinations are compared with their secrets decrypted, so an
alert stored by an earlier release is still not re-validated on rename.
Decision record: ADR:2026-10-23-alert-destination-secrets-are-encrypted-masked-and-restored
This PR cannot be merged until the following are addressed on its linked issue:
No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.
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 skip-pr-checks label.
- [high] Channel changes bypass secret protection and expose retained credentials (F-e35a06946d)
- [medium] Updates restore masked secrets even when the endpoint or OAuth tokenUrl is moved to a server the editor controls (F-11000f8ab3)
- [medium] Internal webhook destination updates validate ciphertext as a URL (F-7df729b604)
- [medium] * (G-82af130b0d)
- [medium] * (G-c55c4a431b)
Automated by pr-supervisor using glm-5.3-flash:cloud via ollama; reviewed by gpt-6.1-sol.
The reason will be displayed to describe this comment to others. Learn more.
⚠️Bug: Duplicate destination ids within an alert make every PATCH fail
counterpartIndex takes the first stored destination with a matching id. The new Carried.isStoredAt check then requires a carried marker's origin index to equal that counterpart. Nothing makes destination ids unique within an alert: ensureDestinationIds only fills in missing ids, and a create, a PUT, or a patch such as copy /destinations/0 -> /destinations/1 can store two destinations with the same id. Once that is stored, any later PATCH (even replace /enabled) leaves a marker from destination 1 at position 1. Its id resolves own to 0, so requireCarriedSecretsStayProtected throws COPIED_MESSAGE and the alert can't be patched until every secret is entered again. When several stored destinations share an id, prefer the one at the incoming position, or reject duplicate ids at create/update, so the guard doesn't refuse a destination's own secrets.
Prefer the same-id destination at the incoming position before falling back to the first match:
if (destination.getId() != null) {
boolean samePosition =
position < stored.size() && destination.getId().equals(stored.get(position).getId());
found =
samePosition
? OptionalInt.of(position)
: IntStream.range(0, stored.size())
.filter(it -> destination.getId().equals(stored.get(it).getId()))
.findFirst();
}
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Stored secrets can leak through asynchronous deletion events, PATCH error responses, and unregistered-channel configurations; new test fixtures also break type checking, and stored-secret authorization lacks denial-path regression coverage.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Critical gaps in history redaction, unavailable-channel masking, webhook test responses, and target comparison can expose stored credentials or send them to a different recipient.
When a stored webhook's named channel is unavailable, this fallback masks only strings, leaving legacy numeric credentials such as headers.Authorization: 123456789 visible in REST, MCP and history responses. Numeric header values are accepted as secrets by the webhook parser, as the new numeric-header test demonstrates. Mask non-null scalar values too, and preserve their original JSON types when restoring masks so unchanged unavailable-channel configurations remain editable.
Timestamp history returns unmasked destination secrets
The inherited /history?startTs=...&endTs=... endpoint bypasses these version-specific wrappers and returns unmasked alert snapshots, exposing legacy plaintext secrets and newer ciphertext. EntityResource.listEntityHistoryByTimestampInternal uses snapshotRedaction, which defaults to empty here. Override that hook with DestinationSecrets::mask and add a timestamp-history regression.
Test-send status details can expose stored credentials
When a webhook echoes an Authorization header or request URL, a masked test send can return the restored secret in statusDetails. WebhookRequests.createStatusContext captures upstream body, headers and Location, and DestinationStatuses returns them even though this resource clears config. Omit or redact upstream response fields for tests using stored credentials, and add a receiver-echo regression.
The reason will be displayed to describe this comment to others. Learn more.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
🔴 High risk · Encrypting, restoring, and routing webhook secrets across alert APIs changes sensitive credential handling; bypasses could expose credentials or send them to unintended endpoints.
Adds encryption, masking and restore handling for alert destination endpoints, header values and credentials across create, update, read and test-send paths. Changes are requested because duplicate destination ids within an alert cause every subsequent PATCH to fail with a COPIED_MESSAGE refusal, since the guard resolves a carried secret's counterpart to the first stored destination with a matching id.
Resolved this session: PUT on an existing alert no longer refused with 400, delete responses now mask destination secrets, the moved-target guard covers legacy plaintext secrets left by a PATCH, and unregistered-channel texts are masked on PATCH copy.
⚠️Bug: Duplicate destination ids within an alert make every PATCH fail
counterpartIndex takes the first stored destination with a matching id. The new Carried.isStoredAt check then requires a carried marker's origin index to equal that counterpart. Nothing makes destination ids unique within an alert: ensureDestinationIds only fills in missing ids, and a create, a PUT, or a patch such as copy /destinations/0 -> /destinations/1 can store two destinations with the same id. Once that is stored, any later PATCH (even replace /enabled) leaves a marker from destination 1 at position 1. Its id resolves own to 0, so requireCarriedSecretsStayProtected throws COPIED_MESSAGE and the alert can't be patched until every secret is entered again. When several stored destinations share an id, prefer the one at the incoming position, or reject duplicate ids at create/update, so the guard doesn't refuse a destination's own secrets.
Prefer the same-id destination at the incoming position before falling back to the first match
if (destination.getId() != null) {
boolean samePosition =
position < stored.size() && destination.getId().equals(stored.get(position).getId());
found =
samePosition
? OptionalInt.of(position)
: IntStream.range(0, stored.size())
.filter(it -> destination.getId().equals(stored.get(it).getId()))
.findFirst();
}
✅ 4 closed✅ Bug: PUT on an existing alert is always refused with 400
📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/events/subscription/EventSubscriptionMapper.java:33-34📄 openmetadata-service/src/main/java/org/openmetadata/service/alerting/channel/DestinationSecrets.java:63-68📄 openmetadata-service/src/main/java/org/openmetadata/service/alerting/channel/DestinationSecrets.java:202-208📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EventSubscriptionRepository.java:298-303📄 openmetadata-service/src/main/java/org/openmetadata/service/alerting/channel/DestinationSecretGuards.java:69-83📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/events/subscription/EventSubscriptionResource.java:364-367 PUT /v1/events/subscriptions builds the entity with mapper.createToEntity, which now calls DestinationSecrets.ofANewAlert (EventSubscriptionMapper.java:33-34). That has two effects:
Masked PUTs fail in the mapper. A PUT that sends the mask back is rejected by requireNoMaskedSecrets before getUpdater ever gets to restore anything.
Plaintext PUTs fail in the updater. For a PUT with plaintext, encrypt gives each destination a random id and fresh Fernet ciphertext. In getUpdater, restore skips that value because isCiphertextOf requires a non-tokenized input, and the id lookup finds no stored counterpart. requireStoredCiphertext then sees ciphertext that is not the stored value and throws 400.
The endpoint is always a secret, so every PUT that updates an existing webhook-family alert fails. The ADR's rule "for a PUT that carries no ids, by position" can never apply.
Fix: for PUT, leave the destinations as submitted in the mapper, with no ids and no encryption. The restore, guard and encrypt steps in getUpdater already cover updates. Apply ofANewAlert (or requireNoMaskedSecrets/requireNoCiphertext plus encrypt) only when the PUT turns out to be a create, e.g. in prepare/storeEntity for a new entity. Add an IT that PUTs an existing alert both with the masks and with the same plaintext.
✅ Security: Delete responses still return destination secrets unmasked
📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/events/subscription/EventSubscriptionResource.java:1534-1540📄 docs/decisions/2026-10-23-alert-destination-secrets-are-encrypted-masked-and-restored.md:28-29
Every read and write response is now wrapped in DestinationSecrets.mask/maskResponse. The three delete endpoints (DELETE /{id}, /async/{id}, /name/{name}) are not. They return delete(...)/deleteByName(...), which serialise DeleteResponse.entity() exactly as stored.
The effect depends on when the row was saved:
Rows saved after this change: the response carries Fernet ciphertext.
Rows saved before this change: the response carries the plaintext endpoint and header values. The ADR says these rows keep plaintext until their alert is next saved.
This contradicts the ADR rule that secrets are "masked ... in every response of EventSubscriptionResource". Fix: wrap the delete returns in maskResponse(...). For the async delete, mask the entity it returns too.
✅ Security: Moved-target guard misses legacy plaintext secrets left by a PATCH
📄 openmetadata-service/src/main/java/org/openmetadata/service/alerting/channel/DestinationSecretGuards.java:129-143📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EventSubscriptionRepository.java:310-316 requireFreshSecretsOnAMovedTarget only refuses a secret that is the mask or Fernet ciphertext. The ADR says rows stored before this change keep plaintext until their alert is next saved. On such a row, a JSON Patch that replaces only /destinations/0/config/endpoint (or /authType/tokenUrl) is applied to the stored entity, so the header value and the bearer/OAuth credentials reach getUpdater as the stored plaintext. They are neither masked nor tokenized, so the guard accepts the request, encrypt stores them, and the next event delivers them to the address the caller picked. The caller only ever read the mask, which is exactly the case the v3 rule ("moves either, and keeps any stored or masked value at another secret field, is refused") is meant to block.
The fix is to refuse a moved target when any other secret still equals the stored value. On the PATCH path you can tell a re-entered value from a leftover by the patch itself: in validatePatch, require that the patch writes every secret field of a destination whose target moved. Another option is to encrypt original's legacy plaintext before the patch is applied, so a leftover always shows up as ciphertext.
✅ Security: Unregistered-channel texts are masked but a PATCH copy can still read them
📄 openmetadata-service/src/main/java/org/openmetadata/service/alerting/channel/DestinationSecrets.java:241-246📄 openmetadata-service/src/main/java/org/openmetadata/service/alerting/channel/DestinationSecretGuards.java:277-289
This commit masks every text in the config of a destination whose channel this server doesn't have (maskedFieldsOf → textFieldsOf). The PATCH guards that stop secrets being copied out still use secretFieldsOf, though, and that returns List.of() for such a channel. storedSecrets (used by requireSecretsOnlyInSecretFields) and markSecrets (used by requireUnwrittenSecretsStayProtected) therefore find nothing to protect. For example, [{"op":"copy","from":"/destinations/0/config/endpoint","path":"/description"}] passes both guards. Those texts are also stored in plaintext, because encryption only touches secret fields. The response then serves the endpoint (or a header value) in clear in description, even though the same value reads as ********* everywhere else. Fix: have the copy guards collect the masked fields, so storedSecrets and markSecrets use maskedFieldsOf. Then add a test that copies an unregistered destination's endpoint into /description and expects a 400.
🤖 Prompt for agents
Code Review: Adds encryption, masking and restore handling for alert destination endpoints, header values and credentials across create, update, read and test-send paths. Changes are requested because duplicate destination ids within an alert cause every subsequent PATCH to fail with a COPIED_MESSAGE refusal, since the guard resolves a carried secret's counterpart to the first stored destination with a matching id.
Resolved this session: PUT on an existing alert no longer refused with 400, delete responses now mask destination secrets, the moved-target guard covers legacy plaintext secrets left by a PATCH, and unregistered-channel texts are masked on PATCH copy.
1. ⚠️ Bug: Duplicate destination ids within an alert make every PATCH fail
Files: openmetadata-service/src/main/java/org/openmetadata/service/alerting/channel/DestinationSecrets.java:204-217, openmetadata-service/src/main/java/org/openmetadata/service/alerting/channel/DestinationSecretGuards.java:188-200, openmetadata-service/src/main/java/org/openmetadata/service/alerting/channel/DestinationSecretGuards.java:250-253
`counterpartIndex` takes the first stored destination with a matching id. The new `Carried.isStoredAt` check then requires a carried marker's origin index to equal that counterpart. Nothing makes destination ids unique within an alert: `ensureDestinationIds` only fills in missing ids, and a create, a PUT, or a patch such as `copy /destinations/0 -> /destinations/1` can store two destinations with the same id. Once that is stored, any later PATCH (even `replace /enabled`) leaves a marker from destination 1 at position 1. Its id resolves `own` to 0, so `requireCarriedSecretsStayProtected` throws COPIED_MESSAGE and the alert can't be patched until every secret is entered again. When several stored destinations share an id, prefer the one at the incoming position, or reject duplicate ids at create/update, so the guard doesn't refuse a destination's own secrets.
Fix (Prefer the same-id destination at the incoming position before falling back to the first match):
if (destination.getId() != null) {
boolean samePosition =
position < stored.size() && destination.getId().equals(stored.get(position).getId());
found =
samePosition
? OptionalInt.of(position)
: IntStream.range(0, stored.size())
.filter(it -> destination.getId().equals(stored.get(it).getId()))
.findFirst();
}
A route chunk loads but one of its chunks still exports undefined: a chunking change broke module initialisation. Run yarn build && yarn bundle:runtime locally.
Fix locally (fast - only checks files changed in this branch):
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
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.
Describe your changes:
Alert destinations now treat the whole credential surface of a webhook configuration the way the governance workflow sinks already treat theirs:
endpoint, every customheadersvalue, and the bearer / OAuth2 credentials of a Slack, MS Teams, Google Chat or generic Webhook destination are encrypted before the alert is stored (create and every update path, before the diff, so the change description holds ciphertext too).*********), for every caller, including version history and change descriptions.WebhookConfigRules.stored/submitted).copy/moveof a stored secret into another field.POST /testDestinationwith a destination sent back as read uses the stored secrets, only for a caller allowed to edit the alert that holds them, and only when every secret is the stored one.Changed destinations are compared with their secrets decrypted, so an alert stored by an earlier release is still not re-validated when it is renamed.
This change came out of an internal security review; the specifics are tracked with the security team out-of-band and are intentionally not described here. Decision record:
ADR:2026-10-23-alert-destination-secrets-are-encrypted-masked-and-restored.Type of change:
High-level design:
ConfigRules.secretFields(JsonNode)is the one place a channel names its secrets;SecretWebhookConfigRuleslists the webhook-family ones throughWebhookSecrets.DestinationSecrets(encrypt / decrypt / mask / restore) andDestinationSecretGuards(what a request may say) work on any channel through that method; the resource, repository and MCP response masker only call them.EventSubscriptionRepository.getUpdateris the single point where the stored and incoming alert meet before the diff: restore, guard, encrypt happen there.validatePatchcloses thecopy/movepath.EventSubscriptionResourcemasks every read and write response on a copy (entities may come from the shared cache) and resolves stored secrets fortestDestination.Alternatives considered: masking only on read while storing plaintext (leaves history, change events and the row itself as written); returning the ciphertext instead of a mask (the current behaviour of the bearer key — ciphertext round-trips but is an awkward form field value and ties clients to the encryption format). Both rejected in favour of the existing sink-secret model.
Tests:
Use cases covered
/destinations, and reads by a data consumer and by a bot: no plaintext secret and no ciphertext in any response; the stored row holds ciphertext that decrypts to the submitted values.copyof a secret intodescription. A refused request changes nothing.testDestinationwith a destination sent back as read reaches the receiver with the real header; a changed endpoint beside a masked header, or an unknown destination id, is refused and nothing is sent.Authorizationheader while the row holds ciphertext (DispatchScenariosIT).Unit tests
DestinationSecretsTest,DestinationSecretGuardsTest(new),McpResponseUtilsTest.Backend integration tests
EventSubscriptionResourceIT#test_destinationSecretsAreMaskedEncryptedAndRestored,#test_destinationSecretsTheServerAloneWrites_400,#test_testDestinationWithMaskedValuesUsesTheStoredSecrets;DispatchScenariosIT#aDestinationIsSentToAsConfiguredWhileStoredEncrypted. On 2026-10-29 alsoEventSubscriptionResourceIT#test_receiversCannotRedirectStoredCredentialsand the two masked-destination cases ofTemplateTestSendIT.Ingestion integration tests
Playwright (UI) tests
notificationAlert.ts,observabilityAlert.ts). No UI code change: the alert form already round-trips untouched fields through a JSON patch, so masked values are restored server-side.Manual testing performed
Authorizationheader as admin, read it back as a freshly registered non-admin user — both returned as written.*********; the stored row holds Fernet ciphertext.mvn test -pl openmetadata-service,openmetadata-mcp -Dtest='org.openmetadata.service.alerting.**.*Test,org.openmetadata.service.secrets.masker.*Test,McpResponseUtilsTest'→ 482 + 13 tests, 0 failures.-Pmysql-elasticsearch -DintegrationTests.lane=parallel):EventSubscriptionResourceIT226 run / 0 failures (27 inherited skips),DispatchScenariosIT8 run / 0 failures — the four new methods listed above executed and passed.Functional review follow-up (2026-10-26)
Commits:
303165fa335,23228fbce9d.Validation on the final code:
Review follow-up (2026-10-29)
Commits:
bbe9ddcd147.POST /v1/notificationTemplates/sendrefused a destination sent back as it was read — the mask failed URL validation, so a template could no longer be test-sent to an existing alert's destination. Both test-send paths now resolve masks through oneDestinationTestSecrets(authorize EDIT_ALL on the alert, restore the stored secrets, require them as stored);testDestinationdelegates to the same class.receiverslist replaces the endpoint at send time and is sent the same headers and credentials, so it is a target now too: a request that changes it while keeping any stored or masked value at another secret field is refused with 400 on every write path and both test paths. Email destinations are unaffected (the email channel names no secret fields).Validation on the final code:
DestinationSecretsTest+DestinationSecretGuardsTest— 46 passed; the full alerting package — 489 passed, 0 failures.EventSubscriptionResourceIT+TemplateTestSendIT— 280 testcases run, 0 failures, 38 inherited skips; the four new methods executed and passed.Invalid webhook endpoint URL: Invalid URL formaton the template send, the stored header delivered to a caller-chosen receiver, and the receivers PATCH accepted.UI screen recording:
N/A — backend change; the form shows
*********where it showed the URL.🤖 Generated with Claude Code
Do not merge until PATCH requests cannot bypass secret checks by changing a destination's ID.
Findings
Summary
This PR encrypts webhook destination secrets before storage, masks REST and MCP responses, and restores stored values when clients send masks back.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR Request[Alert write] --> Guards[Check and restore secrets] Guards --> Encrypt[Encrypt secret fields] Encrypt --> Store[(Stored alert)] Store --> Mask[Mask response copy] Mask --> Client[REST or MCP caller] Store --> Decrypt[Decrypt send configuration] Decrypt --> Receiver[Webhook receiver]Reviews (5) · Last reviewed commit: "fix(alerts): a PATCH that moves a destin..." · Reviewed by Greptile