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

Get real rand in `possiblyrandom` on supported platforms w/o feat

Public commit record

What the developer wrote

Authored by Matt Corallo

78/100 · Adequate
Get real rand in `possiblyrandom` on supported platforms w/o feat

It turns out that conditionally-enabling a dependency via `target`
in `Cargo.toml` does not enable the corresponding dependency
`feature` when compiling the code. As a result, only when building
`possiblyrandom` with an explicit `getrandom` feature did we ever
actually return random values.

This fixes this by matching the `target` cfg in `Cargo.toml` to the
cfg in `lib.rs`.

Reported by Project Loupe
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit fixes a bug in a small helper crate called `possiblyrandom` used by the Lightning Dev Kit. The crate was supposed to return real random bytes on normal operating systems, but due to a Cargo.toml misconfiguration it was silently returning zeros unless an explicit feature flag was turned on. Randomness is important for cryptographic operations; using predictable zeros could weaken security in places that expect random input. The patch makes the code actually call the system's random source on supported platforms.

Recommended action

Upgrade to a version of `rust-lightning` that includes this commit, and audit any downstream code that consumed `possiblyrandom` output before this fix to determine whether predictable zeros could have affected cryptographic material such as nonces, ephemeral keys, or channel identifiers. Review Cargo.toml cfg-to-feature mappings in other crates for similar mismatches.

Security signals we found

01

Cryptographic randomness source silently disabled, producing all-zero output

02

Conditional compilation mismatch between Cargo.toml target cfg and source feature cfg

03

Security-relevant helper crate (`possiblyrandom`) used by Lightning Dev Kit

04

Reported by external party (Project Loupe)

Risk score

Why this scored 61/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 10/15
Affected reach 10/15
Confidence 7/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.