feat(server): scope user-secret writes per caller (RIG-3655) - #1187
Open
rigel-mintaka wants to merge 3 commits into
Open
feat(server): scope user-secret writes per caller (RIG-3655)#1187rigel-mintaka wants to merge 3 commits into
rigel-mintaka wants to merge 3 commits into
Conversation
rigel-mintaka
added this pull request to stack #1188
September 12, 2026 23:02
|
Compass engineering docs preview: https://compass-server-rig-3655-t5-s.compass-eng-docs.pages.dev Deployed from |
SetSecret and DeleteSecret now carry a SecretScope selector. An unspecified scope resolves to the caller's own user coordinate, so a client built before the field existed writes a private value rather than a tenant-wide one. Tenant scope is explicit and requires an admin, checked at the RPC edge where requireUser already holds the caller's role. The wire numbers deliberately differ from the store's, so the handler maps between them; a cast would turn an omitted field into a tenant write, which is the case the default exists to prevent. DeclareSecret and its InsertSecret query were scope-blind and hardcoded the tenant coordinate, so every declare landed at (0, '') no matter what the handler resolved. Both now take the coordinate, validated by the same validateScopeShape the upsert door uses. A re-set at user scope does NOT retire an existing tenant row: it writes a new primary key, and the shared value keeps resolving for every other user until an admin deletes it at tenant scope. A regression test pins that, since the intuition runs the other way. Refs RIG-3655 Co-authored-by: Matt Wilkinson <matt@rigel.build>
Completes the T5 cutover. The scope selector previously reached only the value-free declaration registry, so the value path stayed name-keyed: a user setting a name another user already held overwrote their value, and two rows for one name made buildManifest emit a duplicate TOML key, failing FetchSecrets for every live session. SetSecret and DeleteSecret now go through the DB-backed StoreResolver at the resolved coordinate. The upsert is atomic, so the declare-then-set trio and its rollback are gone, and DeclareSecret with its InsertSecret query goes with them. Boot resolves the master key and builds the resolver from it, still failing closed when the key is absent. FetchSecrets resolves per agent, collapsing scope precedence in SQL. With the upsert the sole writer, the value columns are NOT NULL. ServeConfig.SecretProvider carries the provider URI both resolvers read, reachable in production via --secret-provider or COMPASS_SECRET_PROVIDER; empty keeps the SDK default chain. Tests set the same field rather than a test-only knob. The isolation tests now assert through the production delivery path instead of a store query no production code calls, which is what let the clobber hide. Refs RIG-3655 Co-authored-by: Matt Wilkinson <matt@rigel.build>
rigel-mintaka
force-pushed
the
compass-server/rig-3655-t5-scope-writes
branch
from
September 13, 2026 03:27
aa26c43 to
3694f3e
Compare
mattwilkinsonn
approved these changes
Sep 13, 2026
T5 resolves the master key unconditionally at boot, so the e2e stack's compass-server now fails closed before serving: the job staged neither the cdylib the secrets read path dlopens nor a resolvable key, and every leg failed in shared fixture stand-up. Stages the cdylib with the pgtest job's recipe and seeds an obviously-fake key into a dotenv the podman user can read, reaching the spawned server through the provider env it already inherits. Refs RIG-3655 Co-authored-by: Matt Wilkinson <matt@rigel.build>
|
❌ This stack could not start testing because there was a merge conflict. See more details here.
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
This was referenced Sep 13, 2026
mattwilkinsonn
approved these changes
Sep 14, 2026
|
Stacked PR 1223 failed testing in the merge queue. Please investigate the failure and re-submit the stack. |
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.
This PR is part of a stack containing 4 PRs:
mainSetSecret and DeleteSecret now carry a SecretScope selector. An unspecified
scope resolves to the caller's own user coordinate, so a client built before
the field existed writes a private value rather than a tenant-wide one. Tenant
scope is explicit and requires an admin, checked at the RPC edge where
requireUser already holds the caller's role.
The wire numbers deliberately differ from the store's, so the handler maps
between them; a cast would turn an omitted field into a tenant write, which is
the case the default exists to prevent.
DeclareSecret and its InsertSecret query were scope-blind and hardcoded the
tenant coordinate, so every declare landed at (0, '') no matter what the
handler resolved. Both now take the coordinate, validated by the same
validateScopeShape the upsert door uses.
A re-set at user scope does NOT retire an existing tenant row: it writes a new
primary key, and the shared value keeps resolving for every other user until an
admin deletes it at tenant scope. A regression test pins that, since the
intuition runs the other way.
Refs RIG-3655
Co-authored-by: Matt Wilkinson matt@rigel.build