Description
Complementing the audit-and-harden fix elsewhere in this batch that reviews every WalletError variant's fields for accidental secret exposure, this ticket adds the actual Display implementation (if one doesn't already exist via thiserror or similar) as the single, deliberate place user/log-facing error text is produced — rather than relying on Debug's auto-derived output (which, depending on struct field visibility and derive macros used, can be far more verbose and harder to audit than a hand-written Display) being what actually reaches logs or API error responses.
Requirements and Context
- Confirm whether
WalletError currently derives Debug only, or also has an explicit Display/std::error::Error impl (likely via thiserror, check Cargo.toml).
- If
Display isn't hand-controlled per variant, add explicit per-variant messages (via thiserror's #[error("...")] attributes, which this project may already use elsewhere) so exactly what's user-facing is deliberate, not whatever Debug's derive happens to produce.
- This should land alongside (or after) the WalletError secret-exposure audit fix elsewhere in this batch, using its findings to write each variant's message.
Suggested Execution
Branch: feat/wallet-core/safe-display-for-walleterror
Implement Changes
- Add/tighten
thiserror::Error #[error("...")] messages for every WalletError variant in crates/wallet-core/src/error.rs.
- Confirm every call site currently relying on
Debug formatting for a WalletError (in logs or API error mapping) is unaffected or intentionally updated to use Display instead.
Test and Commit
every_walleterror_variant_has_an_explicit_display_message_containing_no_secret_material (parametrized across all variants, reusing the secret-exposure audit's findings).
- Run
cargo test -p octo-wallet-core locally before committing.
Example Commit Message
feat(wallet-core): add explicit, audited Display messages for every WalletError variant
WalletError's user/log-facing text needed confirmation that it comes from a deliberate,
per-variant Display implementation rather than whatever Debug's derive happens to
produce. Adds explicit thiserror messages for every variant, informed by the parallel
secret-exposure audit.
Guidelines
- Coordinate with the WalletError secret-exposure audit ticket — use its findings to write each variant's message rather than duplicating that research.
- Reference this issue with
Closes #<issue-number> in the PR description.
- Open your pull request against the
dev-branch branch — PRs targeting main will not be reviewed.
Description
Complementing the audit-and-harden fix elsewhere in this batch that reviews every
WalletErrorvariant's fields for accidental secret exposure, this ticket adds the actualDisplayimplementation (if one doesn't already exist viathiserroror similar) as the single, deliberate place user/log-facing error text is produced — rather than relying onDebug's auto-derived output (which, depending on struct field visibility and derive macros used, can be far more verbose and harder to audit than a hand-writtenDisplay) being what actually reaches logs or API error responses.Requirements and Context
WalletErrorcurrently derivesDebugonly, or also has an explicitDisplay/std::error::Errorimpl (likely viathiserror, checkCargo.toml).Displayisn't hand-controlled per variant, add explicit per-variant messages (viathiserror's#[error("...")]attributes, which this project may already use elsewhere) so exactly what's user-facing is deliberate, not whateverDebug's derive happens to produce.Suggested Execution
Branch:
feat/wallet-core/safe-display-for-walleterrorImplement Changes
thiserror::Error#[error("...")]messages for everyWalletErrorvariant incrates/wallet-core/src/error.rs.Debugformatting for aWalletError(in logs or API error mapping) is unaffected or intentionally updated to useDisplayinstead.Test and Commit
every_walleterror_variant_has_an_explicit_display_message_containing_no_secret_material(parametrized across all variants, reusing the secret-exposure audit's findings).cargo test -p octo-wallet-corelocally before committing.Example Commit Message
Guidelines
Closes #<issue-number>in the PR description.dev-branchbranch — PRs targetingmainwill not be reviewed.