Skip to content

fix(alerts): handle profile webhooks like alert destinations - #36722

Merged
manerow merged 15 commits into
mainfrom
fix/profile-webhooks-like-destinations
Nov 4, 2026
Merged

manerow merged 15 commits into
mainfrom
fix/profile-webhooks-like-destinations

Conversation

@manerow

@manerow manerow commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

User and team profile webhooks now go through the same webhook configuration handling as alert destinations (PR #36147). The per-configuration logic moves unchanged from DestinationSecrets into ConfigSecrets so both share it. Includes matching updates to the team subscription editors. Stored rows are brought to this form by the 2.1.0 data step in PR #36939, which follows this PR.

The AI profile's team view now loads the team's profile, so its subscription widget shows the saved webhook and a save keeps the rest of the profile. Changing a destination's authentication type now keeps only the new type's settings; moving to or from OAuth2 asks for the hidden values again, as a token URL change does.

Type of change:

  • Bug fix

Tests:

  • Unit: ProfileWebhookSecretsTest, WebhookSecretStoresTest, BuildSearchIndexDocTest, IngestionPipelineMigrationEntryPointTest.
  • Integration: ProfileWebhookSecretsIT. This and EventSubscriptionResourceIT, DispatchScenariosIT, TemplateTestSendIT pass locally on MySQL + Elasticsearch.
  • UI: TeamsSubscription.test.tsx, MembersTeamInfoWidgets.test.tsx, MembersTeamDetail.utils.test.ts, DestinationConfigField.test.tsx, AlertsUtilPure.test.ts, Playwright helper teamSubscription.ts.
  • Manual: the classic alert form, the AI alert drawer, AI profile > Notifications, the team settings page and the AI profile team widget, on a local stack: saving unchanged keeps every stored secret, and changing a URL, token URL or authentication type asks for the hidden values again.

UI screen recording:

Changing a destination's URL or token URL empties its hidden secrets and opens Advanced Configuration on them, so the form asks for each one before saving. The classic and AI alert forms behave the same.

Classic form:

classic-form-url-changed

AI form:

ai-form-url-changed

Checklist:

@manerow
manerow requested review from a team as code owners October 30, 2026 16:04
@manerow
manerow requested a review from pmbrull October 30, 2026 16:04
@manerow
manerow requested a review from sweta1308 October 30, 2026 16:04
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

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.

@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Oct 30, 2026
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 81%
81.34% (138209/169898) 68.37% (49838/72890) 71.41% (27990/39193)

@manerow
manerow force-pushed the fix/profile-webhooks-like-destinations branch from bc48ebb to b8adad1 Compare November 1, 2026 14:01
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 5 warning(s)

Errors block the build. Warnings do not yet — they are rules whose backlog is still
being worked down, listed so this PR does not add to it. See docs/ui-code-quality-gate.md.

0 error(s), 5 warning(s) across 4 changed file(s).

Count Rule
3 react-hooks/exhaustive-deps
2 openmetadata-imports/no-lower-layer-page-imports
All findings
Location Rule Message
🟡 src/components/Alerts/DestinationFormItem/DestinationSelectItem/DestinationConfigField/DestinationConfigField.tsx:103:9 react-hooks/exhaustive-deps The 'receivers' logical expression could make the dependencies of useCallback Hook (at line 129) change on every render. To fix this, wrap the initialization of
🟡 src/components/Alerts/DestinationFormItem/DestinationSelectItem/DestinationConfigField/DestinationConfigField.tsx:103:9 react-hooks/exhaustive-deps The 'receivers' logical expression could make the dependencies of useCallback Hook (at line 139) change on every render. To fix this, wrap the initialization of
🟡 src/components/Alerts/DestinationFormItem/DestinationSelectItem/DestinationSelectItem.test.tsx:34:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/components/Alerts/DestinationFormItem/DestinationSelectItem/DestinationSelectItem.tsx:60:9 react-hooks/exhaustive-deps The 'destinationItem' logical expression could make the dependencies of useMemo Hook (at line 109) change on every render. To fix this, wrap the initialization
🟡 src/utils/Alerts/AlertsUtilPure.ts:43:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.

Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

@manerow
manerow added this pull request to the merge queue Nov 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-11-03T01:25:25Z)

Blocked the queue: integration-tests-postgres-elasticsearch-redis

manerow added a commit that referenced this pull request Nov 4, 2026
manerow and others added 2 commits November 4, 2026 10:54
# Conflicts:
#	openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/TeamResource.java
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🔄 Playwright impact map auto-refreshed

This PR touched specs or UI source that changed the source→spec routing map. I regenerated .github/playwright/impact-map.generated.json and pushed the diff to this branch.

- source entries: 1028 → 1028
- 0 added, 0 removed, 12 changed spec-list

Entries whose spec list changed:
  openmetadata-ui/src/main/resources/ui/playwright/constant/config.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/domain/DataProduct.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/domain/Domain.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/fixtures/userPages.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/admin.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/common.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/polling.ts
  openmetadata-ui/src/main/resources/ui/src/components/common/NextPrevious/NextPrevious.tsx
  openmetadata-ui/src/main/resources/ui/src/components/common/NextPreviousWithOffset/NextPreviousWithOffset.tsx
  … and 2 more

What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing getByTestId strings. Hand-authored routing in impact-map.json always wins on conflict.

What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit:

python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit  # or a separate commit

@manerow
manerow enabled auto-merge (squash) November 4, 2026 10:00
auto-merge was automatically disabled November 4, 2026 10:27

Head branch was modified

@manerow
manerow enabled auto-merge (squash) November 4, 2026 11:26
auto-merge was automatically disabled November 4, 2026 11:27

Head branch was modified

@manerow
manerow enabled auto-merge (squash) November 4, 2026 11:33
@gitar-bot

gitar-bot Bot commented Nov 4, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 3 closed / 3 findings

🔴 High risk · Encrypting and masking profile webhook credentials changes secret storage and delivery; mistakes could expose credentials or disrupt webhook notifications.

Brings user and team profile webhooks under the same webhook configuration handling as alert destinations, with secrets encrypted at rest, masked in responses, and decrypted only when sending. Resolved this session: the profile webhook secret rule and 2.1.0 data step now have a decision record, the channel-change rule was reconciled with the accepted secrets ADR, and a token URL change now clears the masked endpoint so the save is no longer refused. No issues remain open.

✅ 3 closed
✅ Quality: Profile webhook secret rule and 2.1.0 data step have no decision record

📄 docs/decisions/2026-10-23-alert-destination-secrets-are-encrypted-masked-and-restored.md:28-29 📄 docs/decisions/2026-10-23-alert-destination-secrets-are-encrypted-masked-and-restored.md:79-80 📄 openmetadata-service/src/main/java/org/openmetadata/service/alerting/channel/webhook/ProfileWebhookSecrets.java:40-46 📄 openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v210/WebhookSecretsMigration.java:31-45 📄 openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v210/WebhookSecretsMigration.java:130-144 📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/TeamResource.java:124-128
This commit makes decisions that no record in docs/decisions/ covers. The only related record, 2026-10-23-alert-destination-secrets-are-encrypted-masked-and-restored.md, covers alert destinations only. Its masking scope is "every response of EventSubscriptionResource and of the MCP tools", and its Consequences say "A migration encrypting existing rows is a separate change." This PR adds that migration (WebhookSecretsMigration, wired into the mysql and postgres v210 Migration), so the record is now out of date.

The commit introduces three rules that exist only in the PR description and the code:

  1. New scope. A user's or team's profile.subscription webhooks (endpoint, header values, bearer and OAuth2 credentials) are encrypted at rest, masked in every UserResource, TeamResource and MCP response, and dropped from the search index (profile.subscription added to UserIndex/TeamIndex excludes). A mask sent back is restored only for the same slot while its endpoint and token URL are unchanged, and a PATCH may not copy/move out of /profile/subscription.
  2. Visible contract change. The UI no longer shows or links a profile webhook endpoint.
  3. Irreversible data step. In 2.1.0, stored change_event rows for users and teams are rewritten with the mask, not encrypted, because "delivery reads the profile from the user or the team, never from an event". Rows in the entity tables and their versions are encrypted.

The description says only "User and team profile webhooks now go through the same webhook configuration handling as alert destinations". The repository squash-merges, so that sentence never reaches git log.

The fix is to add a record, or supersede the existing one, that states these rules. For example: "A user's or team's profile webhooks keep their endpoint, header values and credentials the way an alert destination does: encrypted at rest, masked in every User/Team/MCP response and excluded from the search index, restored from the stored profile only for the same slot while its target is unchanged; the 2.1.0 data step encrypts stored rows and versions and replaces these secrets in stored user/team change events with the mask." Also remove the stale "migration is a separate change" consequence.

✅ Quality: Channel-change rule contradicts Accepted secrets ADR, which is not revised

📄 openmetadata-service/src/main/java/org/openmetadata/service/alerting/channel/DestinationSecretGuards.java:105-119 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EventSubscriptionRepository.java:328
The Accepted record docs/decisions/2026-10-23-alert-destination-secrets-are-encrypted-masked-and-restored.md (v3, lines 55-57) says: "A destination an update keeps by its id serves through the channel it is stored under; the update that names another channel is refused." This commit removes requireServedChannelUnchanged and adds requireStoredSecretsStaySecret, so an update can now move a destination to another channel when every stored secret field stays secret on the new channel. The new test_ownersDestinationMovesFromEmailToSlack exercises that case. The ADR's Status, Revisions and Guard list still describe the old rule, so the code and the record now contradict each other. Either keep the old guard, or add a v7 revision that replaces the v3 sentence. Suggested wording: "A destination kept by its id may move to another channel, but every field its stored channel named a secret must be either secret on the new channel or empty; Webhook, Slack, Microsoft Teams and Google Chat name the same fields, while email and the activity feed name none." Also update the Guard list to cite DestinationSecretGuardsTest#aDestinationMayChangeChannelWhileItsStoredSecretsStaySecret.

✅ Bug: Token URL change leaves the masked endpoint, so the save is refused

📄 openmetadata-ui/src/main/resources/ui/src/utils/Alerts/AlertsUtilPure.ts:454-468 📄 openmetadata-ui/src/main/resources/ui/src/components/Alerts/DestinationFormItem/DestinationSelectItem/DestinationConfigField/DestinationConfigField.tsx:320-334 📄 openmetadata-ui/src/main/resources/ui/src/components/observability/Alerts/AlertAiDestinationConfigFields.component.tsx:604-616
clearMaskedSecrets empties only the masked header values and authType secrets. A saved webhook's endpoint is also a masked secret: the new renderSavedWebhookField fixture has endpoint: '*********'. Editing only the OAuth token URL therefore clears the client ID and client secret but keeps the masked endpoint. The server treats a changed token URL as a moved target and asks for every secret again, so requireFreshSecretsOnAMovedTarget rejects the save with "enter its URL again". The form never cleared or flagged that field, which contradicts the comment saying the form asks for each hidden value again. When changeWhereItSends runs for authType.tokenUrl, it should also empty a masked endpoint in both forms.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@sonarqubecloud

sonarqubecloud Bot commented Nov 4, 2026

Copy link
Copy Markdown

@manerow
manerow merged commit 1da62c9 into main Nov 4, 2026
64 of 68 checks passed
@manerow
manerow deleted the fix/profile-webhooks-like-destinations branch November 4, 2026 11:55
@sonarqubecloud

sonarqubecloud Bot commented Nov 4, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants