Delete, undelete and destroy
Take a version back softly, bring it back, or remove its values for good, one version or the whole secret.
AvailableAPI
You choose how final each step is. A delete hides a version but keeps its values, so you can undelete it if you were wrong. A destroy removes a version’s values for good. Deleting the whole secret destroys every version and frees the path to start again.
Before you begin
Section titled “Before you begin”- Who: anyone with every right in the vault: the user in their own vault, a member in a group’s, a realm administrator in the realm’s. Grantees can’t delete.
- Where: the API. There are no screens yet.
- First: know the versions: read the secret’s metadata.
How it works
Section titled “How it works”Each call is under https://foobar.cvyuh.com/api/v0/vault/managed/v1/<vault>:
| To | Call | Can it be undone? |
|---|---|---|
| Delete the latest version | DELETE …/data/<path> | Yes, by undelete |
| Delete some versions | POST …/delete/<path> with { "versions": [1, 2] } | Yes, by undelete |
| Undelete versions | POST …/undelete/<path> with { "versions": [1, 2] } | — |
| Destroy versions | POST …/destroy/<path> with { "versions": [1] } | No |
| Delete the whole secret | DELETE …/metadata/<path> | No |
Each answers 204. Reading a deleted or destroyed version answers 404 with its metadata, so you can see when it was
deleted or that it was destroyed.
Set it up
Section titled “Set it up”Destroy version 1 of web/github for good (Call the API shows how to get $CVYUH_SESSION):
curl https://foobar.cvyuh.com/api/v0/vault/managed/v1/me/destroy/web/github \ -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \ -H "Content-Type: application/json" \ -d '{ "versions": [1] }'To have versions delete themselves after a time, set delete_version_after on the path, or
managed.deleteVersionAfter for the realm. Each version then reads as deleted that long after it was written, and can
be undeleted like any other. See Metadata and
Realm settings.
What grantees see
Section titled “What grantees see”No one is told of a delete. A grantee reading a deleted or destroyed version gets 404, as the owner does, and a
use grantee reading a secret whose latest version is deleted gets nothing until it is undeleted or written again.
When it fails
Section titled “When it fails”| Answer | When | What to do |
|---|---|---|
400, “no versions provided” | The body has no versions list | Send { "versions": [<n>, …] } |
400, “a version is a positive integer” | A version isn’t a whole number | Send version numbers |
404 | The path isn’t there, or, in a personal vault, you have no access | Check the path |
403 | A grantee, or no right in a group’s or the realm’s vault | Ask someone with the vault’s right |
Limits and defaults
Section titled “Limits and defaults”| Limit | Value |
|---|---|
| Undo a delete | any time, until the version is destroyed or dropped past the version limit |
| Undo a destroy, or a whole-secret delete | none |
| Automatic deletion | off (0) unless the path or the realm sets delete_version_after; up to ten years |
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Fix |
|---|---|---|
| Undelete does nothing | The version was destroyed, or dropped past the version limit | Nothing brings it back; write the value again if you have it |
| Versions read as deleted that no one deleted | delete_version_after is set on the path or the realm | Undelete them, and change the setting |
| The secret’s path is still listed | Its versions are deleted but its metadata remains | Delete the whole secret |
Audit record
Section titled “Audit record”Each delete, undelete and destroy, and a whole-secret delete, is an UPDATED change record on the secret, under who
made it. See Secrets audit trail.
Good to know
Section titled “Good to know”- A destroyed version never comes back. Undeleting it does nothing.
- A version number the path doesn’t hold is passed over, not refused.
- After the whole secret is deleted, the path reads as absent, its settings and labels are cleared, and the next write starts again at version 1.
- Destroyed values leave database backups only as the backups expire. They are gone from the live store at once. To make them unreadable everywhere at once, see Crypto-shredding.
Related
Section titled “Related”- Take back a change: each step, start to finish.
- Versions: what a version is.