Skip to content

security: require explicit P2P HMAC secret for gossip#2047

Open
createkr wants to merge 1 commit intoScottcjn:mainfrom
createkr:sec/issue2046-p2p-default-secret-hardening
Open

security: require explicit P2P HMAC secret for gossip#2047
createkr wants to merge 1 commit intoScottcjn:mainfrom
createkr:sec/issue2046-p2p-default-secret-hardening

Conversation

@createkr
Copy link
Copy Markdown
Contributor

@createkr createkr commented Apr 4, 2026

Summary

This change removes the insecure default fallback for RC_P2P_SECRET in the P2P gossip module and makes the secret mandatory at startup.

What changed

  • Removed the repo-public default HMAC secret fallback from node/rustchain_p2p_gossip.py
  • Added fail-closed startup behavior when RC_P2P_SECRET is unset, empty, or still a known insecure placeholder
  • Added operator guidance in .env.example
  • Added a Docker Compose guard so deployments fail clearly if RC_P2P_SECRET is missing
  • Added focused regression tests in node/test_p2p_secret_enforcement.py

Why

The previous behavior allowed nodes to silently fall back to a public secret committed in source control. Any deployment that did not override RC_P2P_SECRET could accept forged HMAC-signed gossip messages.

Validation

Ran:

python3 node/test_p2p_secret_enforcement.py -v

All 4 tests passed.

Closes #2046

Payout Wallet

RTC1d48d848a5aa5ecf2c5f01aa5fb64837daaf2f35

@github-actions github-actions bot added BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) node Node server related ci size/M PR: 51-200 lines labels Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) ci node Node server related size/M PR: 51-200 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security: hardcoded default P2P HMAC secret enables forged gossip messages on default deployments

1 participant