fix(nats): RevokeWithSeed must zero Conn limit — full revocation on seed path (M12)#42
Merged
Merged
Conversation
…eed path (M12)
RevokeWithSeed re-derived the tenant account from its stored seed and
zeroed JetStreamLimits/Exports/Imports, but never set AccountLimits.Conn
= 0. The primary RevokeTenantCredentials path sets Conn = 0 ("zero
connections allowed = fully revoked"). So a tenant revoked via the seed
path (provisioner teardown after a restart, when the in-memory
accountCache is empty) had JetStream stripped but could STILL OPEN NATS
connections — incomplete revocation of a deleted tenant.
Set accClaims.Limits.AccountLimits = jwt.AccountLimits{Conn: 0} in
RevokeWithSeed to match the primary path's revocation claims exactly.
Added TestNATS_RevokeWithSeed_ZeroesConnLimit_MatchesPrimaryPath, which
decodes the revocation JWTs from BOTH paths and asserts Conn == 0 plus
full AccountLimits/JetStreamLimits/Exports/Imports parity. Verified it
reds (Conn: -1, UNLIMITED) without the fix.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
RevokeWithSeed(the post-restart provisioner-teardown revoke path, used when the in-memoryaccountCacheis empty) re-derived the tenant account from its stored seed and zeroedJetStreamLimits/Exports/Imports— but never setAccountLimits.Conn = 0. The PRIMARY pathRevokeTenantCredentialssetsConn = 0("zero connections allowed = fully revoked"). AConnleft at the JWT default (-1= UNLIMITED) means a tenant revoked via the seed path had JetStream stripped but could still open NATS connections — incomplete revocation of a deleted tenant.Fix
In
RevokeWithSeed, after buildingaccClaims, setaccClaims.Limits.AccountLimits = jwt.AccountLimits{Conn: 0}— matchingRevokeTenantCredentialsexactly. Both paths now zero the same set:JetStreamLimits{},AccountLimits{Conn: 0},Exports{},Imports{}. Minimal, matched to the primary path; no new limits invented.Coverage block (rule 17)
🤖 Generated with Claude Code