fix(hub): add client token revocation (Store.RevokeClient + Revoke RP…#134
Open
Ayshine wants to merge 1 commit into
Open
fix(hub): add client token revocation (Store.RevokeClient + Revoke RP…#134Ayshine wants to merge 1 commit into
Ayshine wants to merge 1 commit into
Conversation
…C + ctx hub revoke)
The hub could mint client tokens but never retract one: a leaked
token stayed valid forever, and the only mitigation was wiping the
persistence dir, which invalidated every other client at once.
This adds a revocation path across all three layers:
- Store.RevokeClient(id) removes a client by stable ID, rebuilds
the token index coherently, and rewrites clients.json atomically
(new saveJSONAtomic helper) so a torn write cannot corrupt the
whole registry.
- An admin-token-gated Revoke RPC + handler (mirrors Register's
admin auth), wired via PathRevoke + makeRevokeHandler.
- A Client.Revoke wrapper and `ctx hub revoke <client-id>` command,
taking the admin token from --token or $CTX_HUB_ADMIN_TOKEN and
the hub address from the saved connection config.
Revoked tokens fail ValidateToken immediately (no in-memory
staleness). Also pins the already-implemented duplicate-project
rejection with a regression test.
Closes ActiveMemory#95.
Signed-off-by: Ayshine <28358926+Ayshine@users.noreply.github.com>
7ba594e to
d50da6a
Compare
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.
…C + ctx hub revoke)
The hub could mint client tokens but never retract one: a leaked token stayed valid forever, and the only mitigation was wiping the persistence dir, which invalidated every other client at once.
This adds a revocation path across all three layers:
ctx hub revoke <client-id>command, taking the admin token from --token or $CTX_HUB_ADMIN_TOKEN and the hub address from the saved connection config.Revoked tokens fail ValidateToken immediately (no in-memory staleness). Also pins the already-implemented duplicate-project rejection with a regression test.
Closes #95.