fix(alert): tenant-scope alert keys to prevent cross-tenant collisions#967
Merged
alexluong merged 1 commit intoJun 22, 2026
Merged
Conversation
Contributor
Author
|
Appreciate this fix, @alexluong. Tenant-scoping the alert keys to prevent cross-tenant collisions is an important correctness fix. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Tenant-scope the consecutive-failure alert keys in the Redis alert store. The key format changes from
{deployment}alert:{destinationID}:cf(and thecfevalcompanion) to{deployment}alert:{tenantID}:{destinationID}:cf/:cfeval.getFailuresKeyandgetEvaluatedKeynow take thetenantIDthatIncrementConsecutiveFailureCount,MarkAttemptEvaluated, andResetConsecutiveFailureCountalready receive. No other behavior changes: the deployment prefix and the 24h TTL are preserved.Why this matters
Destination IDs are only unique within a tenant, and the create API accepts a caller-supplied
id. Two tenants that both use a destination id likeprodpreviously collided on a single shared key, corrupting consecutive-failure counts and auto-disable behavior across tenants (#955).No migration code is needed: existing
cf/cfevalkeys carry a 24h TTL and are reset on success, so any orphaned old-format keys age out on their own. This is the lazy in-place migration alexbouchardd greenlit on the issue.Testing
gofmt -l,go vet ./internal/alert/..., andgo build ./...all pass.TestAlertStoreTenantIsolation: two tenants sharing the same destination id increment independently, evaluated markers stay tenant-scoped, and resetting one tenant leaves the other's counter intact (the regression Alert Redis keys are not tenant-scoped — cross-tenant collision when destination IDs match #955 reports).testutil.CreateTestRedisClient); they run in CI.Fixes #955