Skip to content

security: remove private key logging and fix shell variable quoting#162

Open
devin-ai-integration[bot] wants to merge 2 commits into
masterfrom
devin/1780244713-security-fixes
Open

security: remove private key logging and fix shell variable quoting#162
devin-ai-integration[bot] wants to merge 2 commits into
masterfrom
devin/1780244713-security-fixes

Conversation

@devin-ai-integration
Copy link
Copy Markdown

Summary

Removes plaintext private key logging from the bip-0360 reference implementation and fixes unquoted shell variables that could cause word splitting.

Changes

Private key logging removed (bip-0360/ref-impl/rust/src/lib.rs):

  • Removed info!() call logging SLH-DSA private key during script construction (was line 131)
  • Removed info!() call logging all secret_key_bytes of keypairs_of_interest (was lines 273–274) — public keys and merkle root are still logged
  • Removed info!() call logging SLH-DSA private key during signature creation (was line 491)
  • Downgraded remaining public key log from info!() to debug!()

Private key logging removed (bip-0360/ref-impl/rust/src/bin/slh_dsa_key_gen.rs):

  • Changed info!() to log only the private key size, not the key value

Shell variable quoting (bip-0360/ref-impl/common/utils/signet_miner_loop.sh):

  • Quoted $BITCOIN_SOURCE_DIR, $P2MR_ADDR, and $(date +%s) in the miner invocation to prevent word splitting/glob expansion

Not fixed (noted for awareness)

  • Outdated Go deps (bip-0158/go.mod): btcd/btcutil pinned to Jan 2019 snapshots. Updating would require code changes since btcutil was absorbed into btcd/btcutil in newer versions — risky without the ability to compile/test.
  • Hardcoded RPC credentials (bip-0158/gentestvectors.go lines 175–176): User: "kek", Pass: "kek" for local btcd. These are clearly dev-only credentials for localhost, but worth noting.
  • Private key exported to env (bip-0360/ref-impl/rust/examples/p2mr-end-to-end.sh): LEAF_SCRIPT_PRIV_KEY_HEX is exported. This is inherent to the end-to-end demo workflow (construction → spending) and can't be removed without breaking the flow.

Link to Devin session: https://app.devin.ai/sessions/4225031c36e144a6bff2180ecebebfe3
Requested by: @MarcelRaschke

- Remove info!() calls that log private/secret key material in plaintext
  from bip-0360 ref-impl (lib.rs lines 131, 273-274, 491)
- Remove private key value from slh_dsa_key_gen.rs log output (line 25),
  keeping only the key size
- Downgrade remaining public key debug log from info!() to debug!()
- Quote shell variables in signet_miner_loop.sh to prevent word
  splitting and glob expansion

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Signed-off-by: Marcel Raschke <42359664+MarcelRaschke@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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