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

fix(core): nostr string serialization

Public commit record

What the developer wrote

Authored by Martin Milata

57/100 · Thin
fix(core): nostr string serialization

[no changelog]
✓ Descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope! No meaningful explanatory body
The short version

What changed, and why it matters

This commit fixes a bug in how the Trezor hardware wallet builds Nostr event signatures. Previously, special characters in the event content and tags (like quotes, backslashes, tabs, and newlines) were not properly escaped when creating the JSON string that gets signed. This could cause the device to compute a signature that does not match what standard Nostr software expects, or in some cases could allow a malicious app to craft content that changes the meaning of what the user approved on screen versus what is actually signed. The fix adds proper JSON string escaping for both the main content and tag strings.

Recommended action

Treat this as a security-relevant correctness fix. Verify that the new `encode_str()` implementation matches NIP-01 canonical escaping exactly, including ordering of backslash replacement and handling of Unicode control characters beyond the basic set. Consider whether additional characters (e.g., U+0000-U+001F) need explicit escaping per RFC 8259 / NIP-01. Review whether any previously signed events with special characters are now invalid and whether user-facing migration or re-signing guidance is needed.

Security signals we found

01

Incorrect canonicalization of signed message payload

02

Missing JSON string escaping in cryptographic serialization

03

Potential signature malleability / cross-client incompatibility

04

User-approved display string may not match signed bytes

05

Test coverage added for special-character payloads

Risk score

Why this scored 60/100

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