feat(team-vault): delete secrets when an object leaves the vault - #3
Merged
Conversation
delete_object soft-deleted the object but left team_vault_secrets untouched, so a removed password stayed readable by everyone with VIEW_SECRETS. Adds the cascade, a DELETE /secrets/:secret_id route for objects that move out rather than die, and a migration sweeping the rows already orphaned. The route gates on the secret's own type so it still works once the object row is gone.
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.
delete_objectsoft-deleted the object but leftteam_vault_secretsuntouched, so a password removed from a team vault stayed readable by everyone with VIEW_SECRETS.delete_objectnow cascades toteam_vault_secrets.DELETE /v1/teams/:team_id/secrets/:secret_idfor objects that move out of a vault rather than being deleted — the client calls this when a cut/paste or a Move-to-vault takes an object elsewhere. It gates on the secret's own type, not the object's, because the object row is soft-deleted or gone by the time it runs.030sweeps the rows already orphaned by the old behaviour.Verified: 5 new authz tests plus the existing suite (145 tests) pass against a real Postgres; migration 030 checked against a scratch DB to purge exactly the orphans and keep live secrets.
The client half is already on
voltiusdev(1cf73d3) and needs this deployed — until then the DELETE 404s, which the client treats as success and degrades to the old behaviour.