fix(teams): require VIEW_SECRETS to read the legacy team vault blob - #11
Merged
Conversation
GET /v1/teams/:team_id/sync-blob checked team membership only, while its writer requires six permissions including VIEW_SECRETS. The blob carries every object AND every secret in one ciphertext, so any member — a connect-only one included — could download the whole vault. Harmless only for as long as those members hold no vault key, which is exactly the gate issue #187 proposes to widen. Close the read side first. Also extracts the membership + Teams-tier + permission preamble the five team vault routes each repeated into require_vault_access().
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.
Found while working through VoltiusApp/voltius#187.
The hole
GET /v1/teams/:team_id/sync-blobchecked team membership only:Its writer,
put_team_blob, requires six permissions includingVIEW_SECRETS, with a comment explaining why: the blob "can replace every object and secret in a team vault". The read side got none of that. Any member could download the entire vault ciphertext — objects and secrets together.That is harmless only for as long as such a member holds no vault key. Which is exactly the gate voltius#187 proposes to widen:
get_my_vault_keycurrently requiresVIEW_SECRETS, and the issue's "Yes" option relaxes it toPERM_CONNECT || PERM_VIEW_SECRETS. Doing that on top of a membership-only blob read hands a connect-only member both halves — key and ciphertext — and every secret in the vault falls out. Close the read side first, and the widening becomes a decision about hosts rather than a secrets leak.No client regression
The client only fetches the blob after
getTeamVaultKeyhas already succeeded (src/services/teamVaultSync.ts), and that route has always requiredVIEW_SECRETS. Anyone who could use the blob could already pass the new check.Also in this PR
The five team vault routes each repeated the same membership + Teams-tier + permission preamble. Extracted to
require_vault_access(pool, team_id, user_id, action, permissions); the non-member warning keeps a greppableactionfield instead of five hand-written messages. Order of checks is unchanged.Tests
Two new DB-backed tests: a connect-only member is refused the blob, and a
VIEW_SECRETSmember still reads it.Related: VoltiusApp/voltius#187, VoltiusApp/voltius#70, VoltiusApp/voltius#190