---
title: "Discussion on \"The delete that didn't delete\" | Hashnode"
description: "Discussion on \"The delete that didn't delete\". Three Foxstash releases in four days: encryption at rest, a free lunch that wasn't, a delete that left the data on disk, and a position that wasn't an identity"
url: "https://hashnode.com/posts/the-delete-that-didnt-delete/6ad508739ca15024b6915def"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [The delete that didn't delete](https://blog.narcolepticfox.com/the-delete-that-didnt-delete?utm_source=hashnode&utm_medium=feed)

Three Foxstash releases in four days: encryption at rest, a free lunch that wasn't, a delete that left the data on disk, and a position that wasn't an identity

Oct 18 · 8 min read · blog.narcolepticfox.com  
Read the article

-   [#rust](https://hashnode.com/tag/rust)
-   [#databases](https://hashnode.com/tag/databases)
-   [#security](https://hashnode.com/tag/security)
-   [#testing](https://hashnode.com/tag/testing)
-   [#open-source](https://hashnode.com/tag/open-source)

## Written by

[Brock Claussen](https://hashnode.com/@claus)

@claus · Florida, US

  
[View profile](https://hashnode.com/@claus)

Founder of Narcoleptic Fox. Marine veteran. Senior engineer learning AI/ML and writing about it. Building Mousing.ai, Reqforay,.ai, and foxstash.

## Responses 5

Markdown supported · ⌘↵ to post

[Abhinav Sharma](https://hashnode.com/@abhinavs1920)

[Oct 20](https://hashnode.com/posts/the-delete-that-didnt-delete/6ad508739ca15024b6915def/comment/6ad76743389aa050b9333d46)

The green test detail is the real lesson: it passed because it never created the state that triggers the bug. Testing delete against every place the data actually lives (log, checkpoint, snapshot) is the part that matters.

[Brock Claussen](https://hashnode.com/@claus)

[Oct 20](https://hashnode.com/posts/the-delete-that-didnt-delete/6ad508739ca15024b6915def/comment/6ad76743389aa050b9333d46#reply-6ad7c4a98cbe573881591b67)

Thanks, that's exactly the part I keep relearning. A test only proves something if it reaches the state that causes the failure, and this one never did: the document lived only in the log, so one compact always cleaned it up. Now the purge test first proves the old way _does_ leave the data behind.

[Sina Rezaei](https://hashnode.com/@sinarezaei)

[Oct 20](https://hashnode.com/posts/the-delete-that-didnt-delete/6ad508739ca15024b6915def/comment/6ad74b1a1c87300438f03ff5)

The empty-folder check is a good safeguard, but I think there’s another failure mode worth considering: a stale build artifact.

Imagine a CI pipeline where a failed build leaves the previous `dist/` directory intact. The deployment job still succeeds, runs `rsync --delete`, and removes pages and assets that were added in a newer release. The source directory isn’t empty, so the usual safety check won’t catch it.

Would it make sense to generate a manifest containing the build’s Git commit SHA and file hashes, then validate it against the intended release before calculating the deletion set? I’d also keep the previous release available for an atomic rollback. That way, the deploy process verifies not just that files exist, but that the source actually represents the version we intend to publish.

[Mike Dabydeen](https://hashnode.com/@firelinks)

[Oct 19](https://hashnode.com/posts/the-delete-that-didnt-delete/6ad508739ca15024b6915def/comment/6ad5fe3bfcadb3d65fdf9d9b)

Rotating the key only makes the purged blocks unreadable once the old key is destroyed, and since Foxstash never holds the key, that last step sits with the app. NIST SP 800-88 Rev. 2 calls this cryptographic erase and defines it as sanitizing the keys, so recovery becomes infeasible because the old key is gone, not because a new one exists. If the meeting recorder keeps old keys around so it can still open older files, the deleted meeting is still recoverable from those blocks.

That runs into your retention default of 2. The old key can only go once no file on disk still needs it, so the order would be purge, rotate, then compact until the fallback checkpoint is also written under the new key, and only then destroy the old one. Destroy it too early and the fallback becomes a file nobody can open. Having the purge report list which key generation each surviving file was written with would tell the app when destroying the old key is safe.

[Brock Claussen](https://hashnode.com/@claus)

[Oct 19](https://hashnode.com/posts/the-delete-that-didnt-delete/6ad508739ca15024b6915def/comment/6ad5fe3bfcadb3d65fdf9d9b#reply-6ad62abdd944c24112939c08)

Thanks Mike, this is right, and sharper than what I wrote. Rotating isn't the erase. Destroying the old key is, and Foxstash can't do that step because it never holds the key.

I checked the code this morning, and the honest version is plainer still: Foxstash 0.9 has no rotation path yet. A store opens with one key, and each file's header records its role, store and generation but not which key encrypted it. So today an app can't rotate in place. It would have to rebuild into a new store under a new key and then destroy the old one.

Your ordering is the one I'd want once rotation exists (purge, rotate, compact until the fallback checkpoint is under the new key, then destroy the old one), and having the purge report show which key each file uses is how the app would know that last step is safe. I've opened an issue for it, crediting you ([github.com/Narcoleptic-Fox/foxstash/issues/71](https://github.com/Narcoleptic-Fox/foxstash/issues/71)), and corrected the paragraph in the post so it doesn't promise a step the library can't do yet.
