Repository navigation
KTMS_READ_KEY: a read-only Keystone key for reads and viewers - #28
Merged
Merged
Conversation
With the optional KTMS_READ_KEY (scope admin:read), Admin API reads and every call of a viewer carry it, so they cannot change Keystone even if a route's role check were wrong; changes keep KTMS_ADMIN_KEY. The sidebar shows whether each key is accepted for its job, probing writes with an empty MintAPIKey that fails validation after the scope check. The e2e covers both keys when Keystone knows admin:read.
The read methods are listed, not guessed from names. Key probes run once a minute on their own context, in parallel with light-tokenmeter's check, so a slow gateway cannot mark it down; a probe that fails for other reasons is not a refused key. The write probe is doubly invalid. A refused read names KTMS_READ_KEY. The e2e proves reads carry the read key with a bogus one, and skips only when Keystone does not know the scope.
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.
Closes ai-process/docs#136 (epic ai-process/docs#137).
KTMS_READ_KEY(Keystone 1.2+, scopeadmin:read). The gRPC interceptor picks the key per call: Admin APIGet*/List*/ExplainRouteand every call made for a viewer (the guard marks the request context) go with the read key; everything else, including the playground, keepsKTMS_ADMIN_KEY. WithoutKTMS_READ_KEYnothing changes.proxy.keysreports each key — the admin key must be able to write, the read key must read and must not write. The write probe isMintAPIKey{}: Keystone checks the scope before the empty name, so the code tells the scopes apart and nothing is created. The sidebar shows a dot per key under "KTMS gateway".KTMS_ADMIN_KEY, an admin key inKTMS_READ_KEY.admin:read(it does on main; the pinned v1.0.0 pair skips it), the console mints a read key, runs with both, reads and changes, and reports a read key used as the admin key. Run locally withKTMS_REF=main TOKENMETER_REF=main: passes.