buzz_sdk::build_add_member fails for self-targeted grants (missing p tag)

Open Beginner friendly
#6,241 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
cli

Research direction

Start at buzz_sdk::build_add_member and trace the EventBuilder::new(...).tags([h, p, role]) path used by buzz-cli channels add-member; reproduce the self-targeted command from the issue. The fix is done when the self-targeted event retains its p tag and the relay accepts it, while non-self targets continue to work.

Written by the indexing model from the issue text.

Description

Summary

buzz_sdk::build_add_member (used by buzz-cli channels add-member) builds its kind:9000 event via a plain EventBuilder::new(...).tags([h, p, role]) without calling .allow_self_tagging(). The nostr crate's EventBuilder strips any p tag matching the signer's own pubkey by default (documented behavior — allow_self_tagging() exists precisely to opt out), so a self-targeted add-member call (e.g. an owner explicitly granting themselves membership on a channel they didn't get auto-added to — see block/buzz#6240) silently loses its p tag before signing.

The relay then rejects the resulting event with a confusing invalid: missing p tag — which reads as if the CLI passed a bad --pubkey, when actually the tag was present in the builder and was stripped later, invisibly, during signing.

Repro

buzz channels add-member --channel <id> --pubkey <own-pubkey> --role admin
# → {"error":"relay_error","message":"relay error 400: invalid: missing p tag","retryable":false}

The identical call with a different (non-self) target pubkey succeeds normally.

Suggested fix

In buzz_sdk::build_add_member (and any other builder in buzz-sdk that constructs a structural/administrative p tag rather than a social "mention"), call .allow_self_tagging() before signing, since these aren't NIP-10-style mention tags and self-targeting is a legitimate, expected case.

Found while working around block/buzz#6240.

Dominant language
Rust
Stars
33.7k
Forks
4.4k
Avg merge
1d 21h
Merged PRs (30d)
239

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from block/buzz

All issues in block/buzz

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.