Repository navigation
nvs: scrub — erase dead values from the flash itself - #6
Merged
Merged
Conversation
… itself. NVS rewrites and removes by marking the old entry erased; the old bytes stay until the page is erased, so a sealed passphrase's plaintext was still readable off an encrypted C6's flash (2026-10-15). scrub compacts each page holding an erased entry; every live value survives it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ttimmahlax
pushed a commit
that referenced
this pull request
Oct 16, 2026
rusty_esp_core 0.1.3 adds Nvs::scrub: replaced and removed values are erased from the flash itself, not just marked erased (#6). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
NVS rewrites and removes a value by marking its old entry erased in the page bitmap; the old bytes stay on the flash until that page is erased, which only a full partition's compaction does. For a secret that was rewritten (a passphrase sealed where it lay, a key rotated) that leaves the old value readable off a dumped flash.
Found on an ESP32-C6 with flash encryption on (2026-10-15): the extender's settings were sealed in place (
rusty_esp_midseal), yet the network name and passphrase were still in the clear in a raw read of the nvs partition.Nvs::scrubcompacts every page that holds an erased entry (reusingcompact, one active page kept), so each is erased once its live entries are copied out. Tests: the hazard shown and removed, live values read back after a fresh open, a reserve page kept, writes still taken; a clean partition is left byte for byte. On the C6:scrubbed 1 pagesat boot, and a raw read of the partition afterwards shows neither the name nor the passphrase.🤖 Generated with Claude Code