fix(auth): preserve NIP-OA owner for direct members - #4616
Open
cmyk wants to merge 1 commit into
Open
Conversation
Co-authored-by: Schrödinger’s Cat <62413+cmyk@users.noreply.github.com> Signed-off-by: Schrödinger’s Cat <62413+cmyk@users.noreply.github.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
On membership-enforced relays, a directly admitted agent could authenticate successfully but lose the owner asserted by its valid NIP-OA tag.
Direct membership admission returns without an owner because membership alone does not establish ownership. The AUTH handler previously attempted NIP-OA owner extraction only on open relays, so the direct-member path skipped extraction entirely. The owner mapping was therefore not materialized, the observer cache was not populated, and
auth_ctx.agent_owner_pubkeyremained unset for later owner-authorized behavior.This change supplements only a missing admission owner with the existing cryptographically verified NIP-OA resolver, then reuses the existing materialization path. It does not change membership admission or observer authorization.
Security properties are preserved:
Related issue
No open duplicate issue or PR found.
Related ownership and membership work:
Testing
Regression coverage exercises the real
handle_authboundary with PostgreSQL:auth_ctx.agent_owner_pubkey;Executed red/green proof:
auth_ctx.agent_owner_pubkeyremainedNone;Final verification:
cargo test -p buzz-relay handlers::auth -- --include-ignored— 8 passed, 0 failedcargo clippy -p buzz-relay --tests -- -D warnings— passedcargo fmt --check— passedgit diff --check— passedNo UI behavior changes; screenshots are not applicable.