feat(credentials): re-key team vaults, and reach sh1pt's vault as a fifth provider - #117
Merged
Conversation
…rovider Two additions to Credential Sharing. `logicsrc credentials rotate` (alias `logicsrc secrets rotate`) re-keys a team vault: fresh DEK, re-sealed to the members who keep access, every secret re-encrypted under it. Values do not change, so nothing that consumes them breaks; what changes is that every wrapped key issued before the rotation is dead. --active (the default) keeps only active members and revokes the rest -- the "someone left" rotation. --all keeps everyone who holds access, for plain hygiene. Dry run by default, like `sync`. The DEK is recoverable ONLY through the grants, so a half-applied rotation makes a vault permanently unreadable by everyone. The whole next state therefore goes to the server in one request and commits in one transaction (new db.batch helper). The server also requires every submitted fingerprint to equal the stored one: it cannot see values, but it can prove a re-key did not swap any. Rotations that would leave the caller ungranted, grant nobody, or cover the wrong secret count are rejected before anything is written. GET /vaults/:id/grants now returns publicKey and status so a client can re-seal in one pass instead of N+1 user lookups, and revocation finally deletes the grant row rather than leaving one that reports access it no longer confers. The sh1pt adapter is the fifth provider. It is the only one driven through a CLI rather than HTTP, because sh1pt publishes `sh1pt secret set|get|list|rm` as the interface to its vault and documents no REST endpoint. Values go over the child's stdin, never argv -- a secret in argv is readable by any user on the host via ps. Since `sh1pt secret get` needs interactive confirmation it cannot be scripted, so the adapter is write-only for values like github-secrets: a sync target, never a source, no value-restoring rollback. Tests drive a real fake sh1pt binary rather than a mocked execFile, which is how the hang surfaced: with nothing to pipe, stdin was left open and any subcommand that reads it would wait forever. It is now always closed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
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.
Two additions to Credential Sharing: vault re-keying, and the sh1pt provider adapter.
logicsrc credentials rotate— re-key onlyFresh DEK, re-sealed to the members who keep access, every secret re-encrypted under it. Values do not change — nothing that consumes them breaks. What changes is that every wrapped key issued before now is dead, so a kept copy of an old grant buys nothing.
--active(default)activeand who hold a grant today — the "someone left" rotation; everyone else is revoked--allWhy it commits atomically
The DEK is recoverable only through the grants. A half-applied rotation — new grants over old ciphertext, or the reverse — leaves a vault no one can ever read again. So the client computes the entire next state and the server commits it in one transaction (new
db.batchhelper).Guards, all enforced rather than documented:
Two fixes fell out along the way:
GET /vaults/:id/grantsnow returnspublicKeyandstatusso a client re-seals in one pass instead of N+1 user lookups, and revocation now deletes the grant row. Previously there was no revoke path at all, so a stale row kept reporting access it no longer conferred.sh1pt as the fifth provider
sh1pt's vault holds delivery credentials the other four generally don't — App Store Connect keys, Play service accounts, npm/Docker/Cloudflare tokens.
It's the only adapter driven through a CLI rather than HTTP, because sh1pt publishes
sh1pt secret set|get|list|rmas the interface to its vault and documents no REST endpoint. Two consequences:psfor the life of the call. There's a test asserting the value never appears inargv.sh1pt secret getrequires interactive confirmation, so it can't be scripted. The adapter is therefore write-only for values (readValues: false) exactly likegithub-secrets: a sync target, never a source, no value-restoring rollback.docs/credential-sharing.mdsays LogicSRC "does not call out to product-specific commands." I've written the exception into the spec rather than leave it contradicted: a transport choice inside an adapter is the layer where product-specific I/O belongs, and it doesn't move those commands into the core contract. Worth a look if you disagree with that reading.Verification
@logicsrc/plugin-credential-sharing@logicsrc/cli@logicsrc/pwa@logicsrc/webcontract@logicsrc/cliand@logicsrc/webboth build clean.The crypto tests assert the properties that actually matter, not just that the code runs: the old DEK fails to decrypt rotated ciphertext, and a departed member's stale grant opens a key that no longer works. The sh1pt tests drive a real fake
sh1ptbinary rather than a mockedexecFile— which is how a hang surfaced: with nothing to pipe, stdin was left open and any subcommand reading it would wait forever. Fixed to always close.Worth your judgement
--active/--allsemantics. Your sketch had--all (--active default)on one axis. There's no active/inactive concept on secrets in the schema, butcredshare_members.statusisactive | invited, so I read the axis as who keeps the key. Vault selection is positional instead (rotate <team> [project] [env]). Say the word if you meant something else.--project/--envscoping is inferred from the other adapters' endpoint model; sh1pt's public docs don't show its scoping flags. Worth confirming against the real binary before this ships — I had nosh1pton PATH to check.🤖 Generated with Claude Code