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

cleartext: add BIP388 cleartext engine, codegen and CI check

Public commit record

What the developer wrote

Authored by Salvatore Ingala

95/100 · Strong
cleartext: add BIP388 cleartext engine, codegen and CI check

Implements the confusion score and the cleartext representation for a
large subset of commonly used wallet policies. This is the standalone
engine layer: it compiles into the app but is not yet wired into any
handler.

The classifier tables and AST matchers are generated from the TOML specs
in specs/bip388/ by gen.py:
- specs/bip388/cleartext.toml -> cleartext_specs.{h,c}, cleartext_match.c
- specs/bip388/test_vectors.toml -> unit-tests/cleartext_vectors.inc.c
The hand-written runtime (cleartext.c, cleartext_match.h) provides the
scorer/encoder and the primitives the generated classifier calls into.

are_key_placeholders_identical() is exposed from policy.h for use by the
encoder.

A CI job (cleartext-gen-check.yml) runs `gen.py --check` to ensure the
committed generated files stay in sync with the TOML specs.

Mostly ported by Claude from the Rust reference implementation, with
several iterations of review and refinement.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit adds a new feature to the Ledger Bitcoin app that translates complex wallet policies into plain English for user review, plus a 'confusion score' to warn when a policy's description could match multiple different wallet setups. It is a large, self-contained addition of generated code, a code generator, specs, tests, and a CI check. The feature is not yet connected to any user-facing handler, so it cannot by itself change app behavior or expose secrets. Nothing in the commit message or diff describes this as a security fix or reports a vulnerability.

Recommended action

No immediate security action is required. Treat this as a normal feature commit. When the feature is later wired into a handler, review the integration points for buffer handling, canonicalization correctness, and whether the confusion-score threshold is appropriate before user confirmation.

Security signals we found

01

New feature code is present but not wired to any handler, so it is not reachable in the current build.

02

No security bug, buffer overflow, or secret exposure is visible in the diff.

03

Generated C code includes fixed-size arrays and bounds checks (CT_MAX_BINDINGS, CT_MAX_KEYEXPRS).

04

A CI check ensures generated files match their TOML sources, reducing supply-chain/drift risk.

05

The commit message does not frame the change as a security patch or vulnerability fix.

Risk score

Why this scored 12/100

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