Skip to content

Conversation

@mrz1836
Copy link
Contributor

@mrz1836 mrz1836 commented Dec 2, 2025

This pull request improves the security of the example code and documentation for wallet and HD key generation by avoiding the exposure of sensitive key material. Instead of printing or logging raw private or public keys, the code now logs only short fingerprints derived from the public keys. The documentation is updated to reflect these best practices.

Security improvements in key handling:

  • In both create_wallet.go and generate_hd_key.go, added logic to compute and log only a fingerprint (first 8 bytes of a SHA-256 hash) of the public key or xPub, instead of printing the full key material. This reduces the risk of accidental key exposure. [1] [2]

Documentation updates:

  • Updated generate_hd_key/README.md to instruct users not to log raw keys, to use fingerprints for verification, and to clarify the importance of keeping private keys secure. The code walkthrough and output description were also revised to match the new fingerprinting approach. [1] [2] [3]

Dependency additions:

  • Added the crypto/sha256 import to both example files to support fingerprint generation. [1] [2]

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@mrz1836 mrz1836 added the enhancement New feature or request label Dec 2, 2025
@mrz1836 mrz1836 self-assigned this Dec 2, 2025
@mrz1836 mrz1836 requested a review from galt-tr December 2, 2025 20:27
@mrz1836 mrz1836 changed the title Avoid logging sensitive key material in examples [Fix] - Avoid logging sensitive key material in examples Dec 2, 2025
@codecov
Copy link

codecov bot commented Dec 2, 2025

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
docs/examples/create_wallet/create_wallet.go 0.00% 2 Missing ⚠️
docs/examples/generate_hd_key/generate_hd_key.go 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@mrz1836 mrz1836 merged commit f6a2b48 into master Dec 2, 2025
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants