Skip to content

fix(alerts): keep webhook credentials working through the 2.1 upgrade and show the ones that cannot send - #37785

Closed
manerow wants to merge 33 commits into
mainfrom
fix/webhook-secrets-keep-working
Closed

manerow wants to merge 33 commits into
mainfrom
fix/webhook-secrets-keep-working

Conversation

@manerow

@manerow manerow commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

No linked issue. Follows PR #36939, PR #36722 and PR #37269. Backport to 2.1: PR #37788.

Webhook credentials that worked before 2.1 keep working after the upgrade, a wrong encryption key no longer damages them, and the UI now shows a webhook that cannot send and why.

  • Every copy is carried over. The 2.1 data step binds each credential stored encrypted before 2.1 (bearer signing key, OAuth2 client id and secret) to the destination that holds it, wherever else the same value is stored. Cloned alerts and alerts managed as code keep sending. From 2.1 a value opens only where it was written, as before. StoredCiphertextCopies is removed.
  • A wrong key stops the upgrade before anything is encrypted. A read-only check runs before any pending version migrates, so no step of any version (2.0.8 connection secrets, 2.1 authentication settings and webhooks) writes with a wrong key. When it finds credentials stored before 2.1 and the configured FERNET_KEY opens none of them, it stops with an error that names the setting and the alerts, and records no marker, so migrate runs again once the key is fixed. It stops migrate --force too. When those values could not be used before the upgrade either, MIGRATION_KEEP_UNREADABLE_WEBHOOK_CREDENTIALS=true continues and leaves them as stored, to be entered again on their alerts.
  • The status shows a destination that cannot send. Reading an alert with statusDetails reports a destination whose stored credential does not open as failed, with the reason and a new optional configurationUnusable flag, before any event reaches it. A send can find causes a read cannot, such as an endpoint the URL policy refuses. It stores that status with a fingerprint of the destination's settings, and the status stays until those settings change: renaming the alert or editing another destination keeps it, entering the value again clears it. A send that failed or waits for a retry keeps its own status, without the flag. The server owns the status: one sent with the alert is never stored.
  • Team and user webhooks are reported on the alert. When an alert targets a team or user whose webhook cannot be used, nothing is sent to it, and the destination reports it as a failed recipient with the reason, next to the recipients that were sent to.
  • UI. The observability and AI alert lists, Settings > Notifications and the personal-space alert panel show a status badge (disabled first, then failed, awaiting retry and retry limit reached). The alert pages show, next to each destination, why it cannot send ("does not send until this is fixed", only with the flag) or its last send failure.

Type of change:

  • Bug fix

High-level design:

  • Upgrade: MigrationProcess.preflight(Handle) (default no-op) runs on every pending process before any of them migrates. Both engines' v210/Migration.java override it with WebhookSecretsMigration.requireKeysThatOpenStoredCredentials, which throws MigrationHaltException; MigrationWorkflow rethrows it even under --force. The check is skipped on a database with no alerts table or migration log yet and once the alert step has run, and bypassed by the opt-in. The alert step then binds what opens and leaves the rest as stored.
  • Status (AlertDiagnostics, DestinationStatuses, DestinationFingerprint): the read decrypts the way a send does, builds no publisher and resolves no address, and reads the health of all listed alerts in one query. One builder makes the unusable status for both the read and the send. The fingerprint is a SHA-256 of the destination as stored (secrets still encrypted; id, status and enabled left out), computed only when a send records the status.
  • Team and user webhooks (ProfileWebhookSecrets, WebhookAddresses): a webhook that does not open fails as one recipient of the destination. Profiles have no status, so reading a user or team decrypts nothing.
  • Schema: optional configurationUnusable on subscriptionStatus.json (never stored) and optional configurationFingerprint on destinationHealth.json (in the health JSON). No migration is needed: both are optional and absent on existing rows.
  • Alternatives rejected: reading the pre-2.1 format at send time, which would keep the old decryption forever and still lose endpoints encrypted with a wrong key; re-running the step on every migrate; clearing a stored status on any save of the alert, which a rename would clear.

Decision record: docs/decisions/2026-11-03-a-webhook-secret-opens-only-where-it-was-written.md (amended).

Tests:

Use cases covered

  • A credential stored before 2.1 in two alerts keeps sending from both after the upgrade.
  • An upgrade with a key that opens none of the stored credentials fails before any version migrates, leaves alert, team and authentication settings rows unchanged and records no marker or version, also under --force; with the right key it succeeds.
  • With the opt-in, the step continues and leaves those credentials as stored.
  • A destination whose stored credential does not open reads as failed, with the reason, before any event.
  • A status a send stored stays through a rename and an edit of another destination, and clears when that destination's settings change.
  • A status sent with a create, PUT or PATCH is never stored.
  • A team whose webhook cannot be used fails as one recipient, reported on the alert; its other recipients still receive.
  • The alert lists and pages show the status; only an unusable configuration shows "does not send until this is fixed".

Unit tests

  • Java: 188 focused tests pass (block below), including WebhookSecretsMigrationTest, StoredWebhookSecretsTest, AlertDiagnosticsStatusTest, DestinationFingerprintTest, TickChannelsTest, ChannelDispatchTest, WebhookAddressesTest, ProfileWebhookSecretsTest, MigrationWorkflowTest and IngestionPipelineMigrationEntryPointTest.
  • Jest: 2111 tests in the 216 alert, team and notification suites pass. tsc: no errors in the changed files.
  • Mutation checks: each change was reverted once and a named test failed every time (preflights not run before the versions, each engine's preflight, --force swallowing the halt, the check after the alert step ran, already-bound credentials, the opt-in, the flag, the batched health read, dropping a client-sent status, the retry statuses, and each UI surface).
  • Not measured: jacoco coverage.

Backend integration tests

  • WebhookSecretsMigrationIT, ProfileWebhookSecretsIT and WebhookSecretOwnershipIT: 17 tests on mysql-elasticsearch (block below). The alert IT set built with -am at aa9f2f0fe3e: 46 run on postgres-opensearch and 46 on mysql-elasticsearch, none failed, 2 skipped (AlertStateIT).

Local Java test run: PASSED

  • Commit: bc81f83d2bdd (base origin/main)
  • Finished: 2026-11-14 13:45 UTC · 4.2 min
  • Scope: focused; merge readiness is not established. Broader steps deferred: 6 (run --scope full).
Step Scope Classes Tests Failed Skipped Min Result
unit openmetadata-service (15 classes) 15 188 0 0 1.1 passed
integration mysql-elasticsearch · parallel 3 17 0 0 3.1 passed

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not run. make playwright_affected selects about 95 specs through shared alert and settings files. The relevant ones, Flow/NotificationAlerts, Flow/ObservabilityAlerts, Features/AIMode/AiObservabilityAlerts and Features/AIMode/ProfileNotificationTab, are pending, and no spec was added in this PR.

Visual regression baselines

  • Not applicable: no visual regression scene covers the alert or notification pages.

Manual testing performed

None by hand. The upgrade paths are covered by the ITs above on both engines; the UI by Jest.

UI screen recording:

pr37785_webhook_status.mp4

The recording predates the last round: its team page step no longer exists. A new one follows.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation> (no issue for this PR)
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed (above: both fields are optional).
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Self-review: I reviewed the final diff against REVIEW.md (the pr-checklist skill runs it) and fixed every 🔴 finding, or answered it on the line below.
    Self-review: independent passes against REVIEW.md on ccfe74c1c7c, 78128c678d4, c2df96bb930, 68f52b50387, 18f5ab26fd1 and aa9f2f0fe3e. Every 🔴 is fixed: the key check runs before any version writes and before reading a migration log that may not exist yet; retry statuses count as not sending; a rename no longer clears a status a send stored (fingerprint, 10e8de2773b). One 🔴 is answered instead: how credentials stored before 2.1 are carried over is kept as on 2.0, by decision (see the decision record). The last pass found no 🔴; three of its 🟡 are fixed in bc81f83d2bd (the fingerprint taken once a tick, an unused overload, a test half that could not fail), and one is accepted: a secret stored in plain text before an encryption key was configured is encrypted by the next save, which clears a stored status until the next send.
  • Decision check: docs/decisions/2026-11-03-a-webhook-secret-opens-only-where-it-was-written.md amended.

Known, out of scope: CompiledTextTest fails on main too. After a description or owner save, the alert details pages show statuses again only after a reload.

@manerow
manerow requested review from a team as code owners November 13, 2026 15:20
@manerow

manerow commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

Local Java test run: PASSED — details

  • Commit: aa9f2f0fe3e0 (base origin/main) — uncommitted changes were present
  • The summary is in the PR description.

Tests run locally

  • unit · openmetadata-service (15 classes): AlertDiagnosticsStatusTest (9 passed), ChannelDispatchTest (10 passed), DataMigrationStepTest (4 passed), DestinationFingerprintTest (5 passed), DestinationSecretsTest (33 passed), DestinationValidationTest (16 passed), HealthAttributionTest (19 passed), IngestionPipelineMigrationEntryPointTest (2 passed), MigrationTest (4 passed), MigrationWorkflowTest (47 passed), ProfileWebhookSecretsTest (15 passed), StoredWebhookSecretsTest (6 passed), TickChannelsTest (5 passed), WebhookAddressesTest (3 passed), WebhookSecretsMigrationTest (10 passed)
  • integration · mysql-elasticsearch · parallel: ProfileWebhookSecretsIT (5 passed), WebhookSecretOwnershipIT (7 passed), WebhookSecretsMigrationIT (5 passed)

Per-class counts come from the test reports, which can credit a test to the wrong class when classes run concurrently, and keep only the last run of a nested class that several test classes inherit. The summary's step totals are Maven's own counts.

Broader coverage not executed by this focused run

  • mvn -B package -pl openmetadata-service -am -Dspring-boot.repackage.skip=true -Dtest=AlertDiagnosticsStatusTest,AlertJobsOwnershipTest,AlertLedgerTest,AlertMetricsTest,AlertPublisherDeliveryTest,AlertReconcilerTest,AlertRowsTest,AlertingArchitectureTest,ChannelDispatchTest,DataMigrationStepTest,DestinationFingerprintTest,DestinationSecretGuardsTest,DestinationSecretsTest,DestinationValidationTest,DispatchIsolationTest,DispatchOrderTest,EmailPublisherTest,EmailPublisherTickBudgetTest,EventSubscriptionDaoDedupTest,GenericPublisherTest,HealthAttributionTest,IngestionPipelineMigrationEntryPointTest,LineageBasedDownstreamHandlerTest,MigrationCodeFingerprintTest,MigrationProcessImplTest,MigrationTest,MigrationUtilDataConsumerPolicyCacheTest,MigrationWiringTest,MigrationWorkflowDataMigrationTest,MigrationWorkflowReprocessingTest,MigrationWorkflowTest,OpenSearchVectorServiceChunkStagingTest,ProfileWebhookSecretsTest,RecipientResolutionTest,RecipientsTest,SeedAlertsTest,SelfDrivenDeliveryTest,StoredConfigBoundsTest,StoredWebhookSecretsTest,TargetResolverTest,TickChannelsTest,TransportTest,WebhookAddressesTest,WebhookRequestsTest,WebhookSecretStoresTest,WebhookSecretsMigrationTest,WorkflowHandlerSchemaUpdateTest,WorkflowRedeployEntryPointTest -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel '-Dit.test=<99 classes>' -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=global-state -Dit.test=ConversationSchemaMigrationIT,MetricMigrationIT,OpsRegenerateBotTokensIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pcache-tests -DintegrationTests.lane=parallel -Dit.test=AlertStateIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Ppostgres-opensearch -DintegrationTests.lane=parallel '-Dit.test=<70 classes>' -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Ppostgres-opensearch -DintegrationTests.lane=global-state -Dit.test=ConversationSchemaMigrationIT,MetricMigrationIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
Commands
mvn -B package -pl openmetadata-service -am -Dspring-boot.repackage.skip=true -Dtest=AlertDiagnosticsStatusTest,ChannelDispatchTest,DataMigrationStepTest,DestinationFingerprintTest,DestinationSecretsTest,DestinationValidationTest,HealthAttributionTest,IngestionPipelineMigrationEntryPointTest,MigrationTest,MigrationWorkflowTest,ProfileWebhookSecretsTest,StoredWebhookSecretsTest,TickChannelsTest,WebhookAddressesTest,WebhookSecretsMigrationTest -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel -Dit.test=ProfileWebhookSecretsIT,WebhookSecretOwnershipIT,WebhookSecretsMigrationIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false

@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.

@gitar-bot

gitar-bot Bot commented Nov 14, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk

Rebinding legacy webhook credentials during the 2.1 migration could leave alerts unable to authenticate or send if ownership handling is wrong.

Keeps webhook credentials stored before 2.1 working through the upgrade by binding each to its owning destination, stops the upgrade before any encryption when the configured key cannot open stored credentials, and reports destinations that cannot send on alerts and in the UI. No issues found.

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant