Skip to content

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

Description

@ruvnet

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 #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 #6240.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions