Skip to content

Secret store: report a failed restore; test the Set request wipe - #4311

Merged
mstomar125 merged 1 commit into
mainfrom
issue-4291-secrets-fixes
Nov 19, 2026
Merged

mstomar125 merged 1 commit into
mainfrom
issue-4291-secrets-fixes

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Follow-up to the credential store, from its review. Core side only; no change under packages/agent.

  • A failed restore is reported. In SecretStore::set, if the names index write fails and putting the account back as it was also fails, the error was swallowed and the account was left holding the new value, unlisted. It now returns SecretError::NotRestored (the daemon maps it to Internal), naming the secret, the index failure and what to run (nodespace secret set <name> to list it or nodespace secret delete <name>), and logs the event without the value. The comment no longer claims the account is left as it was. Tested with a backend whose restore fails, for both an existing old value and none.
  • The Set request value is wiped on every path, and tested. The handler stores through store_and_wipe(&SecretStore, &mut SetSecretRequest), which overwrites the value whether the store accepted it or not. The test calls it on an accepted and a refused request and checks the string is empty and the buffer that held it is zeroed.

Tests

  • Core secrets:: 20, daemon secret_service 6; clippy -D warnings clean; bun run test:changed passes.
  • 5 mutants, all caught: restore failure swallowed; restore failure losing its cause; zeroize only on success; zeroize only on error; zeroize removed.

🤖 Generated with Claude Code

…value is wiped on every path

- A failed set whose own restore also fails now returns NotRestored (and logs
  without the value) instead of swallowing the restore error.
- The daemon's Set handler stores through store_and_wipe, tested on the
  accepted and the refused path, including that the buffer is zeroed.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant