Repository navigation
fix(alerts): encrypt webhook secrets with the server Fernet key, as every other secret (backport 2.1 #37817) - #37860
Conversation
…very other secret (backport 2.1 #37817)
❌ 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 |
| public static Map<UUID, Map<String, DestinationHealth>> healthOf(List<UUID> alertIds) { | ||
| Map<UUID, Map<String, DestinationHealth>> health = new HashMap<>(); | ||
| for (List<UUID> chunk : Lists.partition(alertIds, HEALTH_READ_BATCH)) { | ||
| List<AlertExtension> rows = | ||
| dao() | ||
| .listAlertsExtensions( | ||
| chunk.stream().map(UUID::toString).toList(), | ||
| List.of(LedgerKeys.POSITION, LedgerKeys.HEALTH)); |
There was a problem hiding this comment.
New code breaks Java requirements
The repository's Java guide requires methods of about 15 lines, final on unchanged locals and parameters, and tests that assert results rather than internal calls. The new healthOf() exceeds that method limit and introduces unchanged variables without final. The new status test also mocks AlertRecord statically and checks its internal calls.
Split the health read into focused helpers, apply final, and keep the status assertions without checking internal calls. These repository requirements must be satisfied before merging.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Describe your changes:
Cherry-pick of #37817 to
2.1. No linked issue, as for #37817.The cherry-pick applied cleanly, and its patch is identical to the merged commit on
main(samegit patch-id). #36939, which this reverts to the server Fernet key, is in 2.1.0-rc2, so2.1needs the same change before 2.1.0 ships.What it does, in short (the full description is in #37817):
BoundCiphertext) is removed.encryptAlertDestinationSecretsandencryptProfileWebhookSecrets, so databases that ran 2.1.0-rc2 run them too. Credentials that releases before 2.1 encrypted stay as stored; every other value is encrypted as stored; a value rc2 wrote in its per-holder format is converted back. Each step runs once, in one transaction with its marker.fields=statusDetailsreturns each destination's status, and astatusDetailssent on create, PUT or PATCH is no longer stored.Decision record:
docs/decisions/2026-11-14-webhook-secrets-are-encrypted-with-the-server-fernet-key.md.Type of change:
High-level design:
Same as #37817. No conflicts and no
2.1-specific changes.Tests:
Run on this branch (
2.1+ the cherry-pick):Unit tests
StoredWebhookSecretsTest,DestinationSecretsTest,ProfileWebhookSecretsTest,DestinationValidationTest,AlertLimitsTest,AlertDiagnosticsStatusTest,IngestionPipelineMigrationEntryPointTest: 85 run, 0 failed.Backend integration tests
WebhookSecretsIT,WebhookSecretsMigrationIT,ProfileWebhookSecretsIT,EventSubscriptionResourceITon mysql-elasticsearch: 298 run, 0 failed, 38 skipped (the same counts as onmain).Not run: Postgres, and the full affected scope.
Playwright (UI) tests
Checklist:
Fixes <issue-number>: <short explanation>(no issue for this PR)Fixes #<issue-number>above.The earlier Java-guide finding must be addressed before merging; no new blocking behavior was found.
Findings
Summary
This backport returns webhook secrets to the server's Fernet keys.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Stored webhook secret] --> B{Pre-release bound format?} B -->|Yes| C{Opens with its holder and configured keys?} C -->|Yes| D[Encrypt with server Fernet key] C -->|No| E[Keep stored value] B -->|No| F{Older encrypted credential?} F -->|Yes| E F -->|No| D D --> G[Commit changes and completion marker together] E --> GReviews (2) · Last reviewed commit: "fix(alerts): encrypt webhook secrets wit..." · Reviewed by Greptile