AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 21 Bitcoin

common: add randbytes() wrapper to override cryptographic entropy: $CLN_DEV_ENTROPY_SEED

Public commit record

What the developer wrote

Authored by Rusty Russell

90/100 · Strong
common: add randbytes() wrapper to override cryptographic entropy: $CLN_DEV_ENTROPY_SEED

Only in developer mode, ofc.

Notes:
1. We have to move the initialization before the lightningd main trace_start,
since that uses pseudorand().
2. To make the results stable, we need to use per-caller values to randbytes().
Otherwise external timing changes the call order.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit adds a developer-only feature that lets Core Lightning use predictable fake random numbers instead of real cryptographic randomness when a special environment variable is set. It is intended only for testing and reproducible debugging, not for production use. The code is gated behind developer mode and is not itself a vulnerability, but any accidental use in production would severely weaken security that depends on randomness.

Recommended action

Treat this as a test/debugging aid, not a security fix. Verify that the override cannot be activated in production builds (developer mode disabled), that the environment variable is not documented for end users, and that CI/release builds do not enable it. No patch is required unless the override can be triggered in non-developer builds.

Security signals we found

01

Addition of a deterministic entropy override mechanism gated on developer mode

02

Use of SipHash of argv[0] plus environment seed to derive per-process predictable randomness

03

Assertion that the override is not installed after randbytes() has already been used

04

Macro-based per-caller offset to keep deterministic output stable across call-order changes

05

Developer-mode-only environment variable CLN_DEV_ENTROPY_SEED controls activation

Risk score

Why this scored 21/100

Our methodology →
Potential impact 2/30
Exploitability 2/25
Stealth signal 3/15
Affected reach 2/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.