gift unwrap: add missing seal verification and rumor pubkey/ID correction#111
Open
alltheseas wants to merge 2 commits into
Open
gift unwrap: add missing seal verification and rumor pubkey/ID correction#111alltheseas wants to merge 2 commits into
alltheseas wants to merge 2 commits into
Conversation
The CLI gift unwrap path skips seal signature verification that nip59.GiftUnwrap() performs. Without this check, a forged seal with an arbitrary pubkey would be trusted for decryption key lookup and sender identity. Fixes fiatjaf#110 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
NIP-17 requires clients verify that the kind:14 pubkey matches the kind:13 pubkey to prevent sender impersonation. The CLI gift unwrap path outputs the rumor as-is without setting the pubkey from the verified seal or recomputing the event ID. This mirrors nip59.GiftUnwrap() which does both operations. The override is placed after the ZeroID sentinel check to preserve decryption failure detection. Fixes fiatjaf#110 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
seal.PubKeyfor decryption key lookupThese three checks exist in
nip59.GiftUnwrap()but were missing from the CLIgift unwrappath, which reimplements unwrapping inline.Why this matters
Without these checks:
kind:13is the same pubkey on thekind:14")Breaking change
Seals with invalid signatures that were previously silently accepted will now be rejected. This is correct per NIP-59 and matches the library behavior.
Test plan
go buildcompiles cleanlyFixes #110
Origin: nostrability/nostrability#169 (comment) — item 4
🤖 Generated with Claude Code