Skip to content

Add a Display impl for WalletError guaranteed to never include secret material, with a compile-time-checked test #364

Description

@Emmyt24

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.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programarea/contractStellar transaction/signing layer: wallet-core, cryptodifficulty/mediumMedium difficultyenhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions