-
Notifications
You must be signed in to change notification settings - Fork 602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NIP-109: Pubkey Deletion #377
base: master
Are you sure you want to change the base?
Conversation
This seems like the best pragmatic mitigation for what will certainly be a real problem in a decentralized social media protocol. Question: @alexgleason the only difference between a kind 5 event that deletes one or more events and a kind 5 event that signals account (pubkey) deletion is that the latter includes a ‘p’ tag? Given the unrecoverable severity of pubkey “cancelation”, should there be something / anything else in the event and/or does the extreme nature of this functionality beg creating a different kind (not 5) altogether? If not a new kind, should there be additional constraints on the NIP-69 kind 5 event such as if it has a ‘p’ tag it can have one and only one ‘p’ tag and/or if it has a ‘p’ tag it must not have any ‘e’ tags? |
Suggestions/ideas:
PS: Some issues regarding event deletion and account compromise were also brought up in #343. |
I think, as NIP-09, these MUSTs should be atleast SHOULDs cause if a relay keep these deletion events around forever while also marking pubkeys as deleted, one may flood a relay with deletion events with a zillion different pubkeys, just so to fill the relay's DB.
Now I think MUST delete is better for a relay that wishes to support this NIP, as this should be the main goal of this NIP. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This should be renamed to "Public Key Revocation", since that is a more fitting name and represents what this actually is.
- Content should not be used since attackers that obtained the private key may use this maliciously.
- The NIP should specify that pubkey deletions from delegated keys should be ignored since that is an issue
- Maybe add support for delegation
- NIP-69 is already occupied by 1-2 other proposals
Co-authored-by: Semisol <45574030+Semisol@users.noreply.github.com>
@Semisol Thank you! |
I've renamed it from NIP-69 to NIP-109 to not conflict with the proposed NIP for polls. 109 still seems appropriate. |
2e7a2a5
to
7a75de1
Compare
The reason to reuse kind 5 is because relays already implement special behavior for kind 5 events, and we want to preserve that behavior for this feature. It therefore decreases complexity while also making sense semantically. I did make a conscious choice to make this a new NIP rather than extend NIP-09, so clients can check the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't a rejection, but would be great to specify if you are revoking your key or deleting your account (true deletion doesn't exist) or something else
|
||
### Client behavior | ||
|
||
Clients which recieve a pubkey revocation event SHOULD treat all events from that pubkey as if they were deleted in accordance with [NIP-09](09.md). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clients which recieve a pubkey revocation event SHOULD treat all events from that pubkey as if they were deleted in accordance with [NIP-09](09.md). | |
Clients which recieve a pubkey revocation event SHOULD treat all events from that pubkey as if they were deleted in accordance with [NIP-09](09.md). If a client receives multiple events, it SHOULD use the highest priority intent as specified above. Clients SHOULD show a message based off the intent such as account deletion or key compromise. |
|
||
`draft` `optional` `author:alexgleason` | ||
|
||
Events of [kind `5`](09.md) may contain a "p" tag instead of "e" tags. The "p" tag MUST match the `pubkey` of the signed event, and this event indicates that the author wishes for relays and clients to stop showing events for this pubkey, and to reject future events from the pubkey. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Events of [kind `5`](09.md) may contain a "p" tag instead of "e" tags. The "p" tag MUST match the `pubkey` of the signed event, and this event indicates that the author wishes for relays and clients to stop showing events for this pubkey, and to reject future events from the pubkey. | |
Events of [kind `5`](09.md) may contain a "p" tag instead of "e" tags. The "p" tag MUST match the `pubkey` of the signed event, and this event indicates that the author wishes for relays and clients to stop showing events for this pubkey, and to reject future events from the pubkey. | |
They SHOULD also contain a `intent` tag, which may currently be one of the following: | |
- compromised | |
- delete | |
- other | |
The order above also specifies how different intents override each other. |
"kind": 5, | ||
"pubkey": "6027adac157831dfe9d2f988c1b8b7a75d9296a7d42a0f9ed056a320925b0e13", | ||
"tags": [ | ||
["p", "6027adac157831dfe9d2f988c1b8b7a75d9296a7d42a0f9ed056a320925b0e13"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
["p", "6027adac157831dfe9d2f988c1b8b7a75d9296a7d42a0f9ed056a320925b0e13"], | |
["p", "6027adac157831dfe9d2f988c1b8b7a75d9296a7d42a0f9ed056a320925b0e13"], | |
["intent", "delete"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the user has been compromised? Then we can't really trust the intent. I think simplicity is important here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, what you do is publish a higher intent level. If you see both a compromised and delete you pick compromised.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡
That makes sense.
Is the intent
tag already used anywhere else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No.
|
||
### Relay behavior | ||
|
||
Relays receiving a pubkey revocation event MUST mark the pubkey as revoked, and MUST stop delivering events from this pubkey to clients, EXCEPT for events of kind `5`. Relays MAY delete events by this pubkey from their database, and SHOULD reject future events from the pubkey. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relays receiving a pubkey revocation event MUST mark the pubkey as revoked, and MUST stop delivering events from this pubkey to clients, EXCEPT for events of kind `5`. Relays MAY delete events by this pubkey from their database, and SHOULD reject future events from the pubkey. | |
Relays receiving a pubkey revocation event MUST mark the pubkey as revoked, and MUST stop delivering events from this pubkey to clients, EXCEPT for events of kind `5`. Relays MAY delete events by this pubkey from their database, and SHOULD reject future non-kind `5` events from the pubkey. |
My understanding of MAY, SHOULD, and MUST is in relation to whether or not your implementation will be compatible with everything else. So if you say a client MUST not show content because that could be nasty content from the attacker, technically it wouldn't cause incompatibility. I'd revisit them with that in mind. My understanding of these words MAY be wrong and SHOULD be corrected if wrong. |
The problem with this NIP is the persistent state requirement it introduces. NIP-41, for example, states that a public key that was invalidated must be forgotten and removed from follow lists of clients, but it doesn't say relays must ban them or anything like that -- because it didn't want to introduce the persistent state requirement. But if this NIP is adopted then NIP-41 can also include a clause to apply the same effects of this NIP. |
Also I think the name "revocation" is not appropriate here. It has the connotation of a guaranteed and global revocation state, which this NIP cannot guarantee. For example, if I want to scam people without ruining my reputation I can do it, then issue a backdated "revocation" event and then claim it wasn't me. And since the NIP says "revocation" I may get away with that, and blame the victims for not having known about my "revocation". |
@fiatjaf NIP-41 only applies to keys you generated with a seed though, right? We need the ability to invalidate a pubkey regardless of how it was generated. |
Unsure what to call it |
Call them Burn Notices Sorry, all. I know I am new to this conversation (at jared on nostr) but I have also been thinking about this alot and working on a NIP for this, too. I won't shill my whole NIP draft on you all, since we are mostly on the same path. Rather, I suggest the following with details available in my proposal below.
---BEGIN PROPOSAL DRAFT--- NIP Proposal: Burn Notices This NIP helps improve the nostr network’s security and user experience for key deprecation scenarios such as key migration, mishandling, and compromise. Currently, key compromise, mishandling, and migration can only be handled ad-hoc, with user’s notifying their network with a social post “Hey, I stopped using this old npub, here is my new npub. Don’t zap anyone pretending to be me with the old npub.” Hopefully, followers/zappers take on the cumbersome task of moving to the new npub and avoiding the old npub. Nostr is rapidly growing not just in network size but also in functionality and application. The user-controlled public-private keypairs underpin the security of the network and with the potential of nostr-based decentralized identity (NIP-42, NIP-46, etc.) usage to expand, key lifecycle management will become more important as the network grows. A burn notice is simply a kind 10187 event that is used to notify the nostr network that a pubkey is compromised. It is a regular event (vs replaceable event) so that more than one burn notice can be issued per pubkey. This is important so that a user can issue a corrective burn notice, if an attacker issued a pre-emptive Tags Example burn notice Relay behavior Client behavior |
@powershellshock thank you for chiming in! I'm open to the implementation being different, I just want the problem to be solved. I think it's critical for the Nostr network. |
thanks, @alexgleason. i too feel this is critical for Nostr. and i appreciate your willingness to collaborate on this which i also share. i am always willing to be convinced against my own opinions. so if my tone ever seems otherwise, please understand that. my expertise lies in cybersecurity and identity (IAM, as its called in the enterprise identity space), more than as a developer. my concern is more about the proposed behavior than specific implementation details of the json event/tag data structures. i am concerned with any bulk deletion of events or blocking any interaction with the burnt npub, as this presents an advantage for a malicious party in that they can easily burn down the network of the user with little notice or recourse for the user. instead, i think we need to look at options that give useful information to clients, relays, and users for identifying trust/reputational factors about npubs. (this will also likely lead to nostr-based services around providing and monitoring trust factors for npubs.) Threat Model: if B wants to abuse the private key, there are basically two key threats (applying the STRIDE threat model):
Behavior Recommendations: When a new burn notice is issued, it should be considered "suspect" until it reaches a sufficient age without a conflicting burn notice being issued. This gives time for A to login to a client that alerts them that their npub was burnt (by B) and allows them to issue a new burn notice (with a hint to the new legitimate npub). When a conflicting burn notice is issued for an npub, it should be treated like a fork in the road for the user C that is a follower/zapper of A. If the client cannot resolve the conflict with available information (age and number of burn notices, NIP-56 impersonation reports, etc), then it can simply present C with relevant details of both (timestamp of burn notices and what the new npub hint is). The user should be ultimately identifying the right burn notice to follow. (Clients could then report the not-followed burn notice via NIP-56 reporting it as an "impersonation". As the clock and blocks ticks by, the network will become "aware" of which burn notice was actually issued by A, as those followers closest to A are able de-conflict the burn notices outside of nostr. Hopefully, my logic makes sense here. It is just really hard to take active measures based on a single burn notice without creating an advantage for adversaries over the users. Thoughts? |
@fiatjaf Can you review this proposal again? |
Kind 5 is called "deletion" even though it's not guaranteed, and has basically the same semantics as this MR, so I think calling it "Pubkey Deletion" like it was originally is appropriate and makes it consistent with other parts of the spec. "Deletion" is the term users understand. This is what we call it in the ActivityPub world too, even though it's also not guaranteed there. Whether it's perfectly semantically correct doesn't matter. |
I am fine with this NIP, it is simple and useful (as long as you like the idea of we incrementing it with NIP-41 later, or some other deletion methods that may appear). I just think it should be a NIP under the number 100 (yes, I am hoping we will have just 100 NIPs and then we can move to some decentralized NIP registry with no inherent sequence). However I won't merge until other implementors signal their approval and some implementations happen. |
The |
@alexgleason looking into this |
@alexgleason I like the simplicity, but I am concerned that it only takes 1 kind 5 event to burn a key. There's no tech support in Nostr, some people are going to make mistakes... it's happened already and it's really tough for the unfortunate user. |
This NIP provides a way for users to delete their own account. Supported relays would delete all events from the pubkey and prevent new ones from being added. This option enhances user privacy and helps with disaster recovery.
Currently events can only be deleted one-at-a-time. However, users expect a "delete account" option, which I believe will be necessary for mainstream adoption of Nostr.
Precedent
If an attacker steals your private key, you can already protect against them submitting new events by monitoring relays and submitting deletion requests automatically. Here is an example of such a bot: https://gitlab.com/alexgleason/plan-b
A better solution would be for relays to become friendlier about deleting user content. I propose Event<5> on a pubkey. When this happens, relays excommunicate the pubkey as described in this document:
➡️ NIP-109 https://github.com/alexgleason/nips/blob/delete-pubkey/109.md
FAQ
P.S. I'm not the only one thinking about this.