Skip to content

fix(relay): stop disclosing internal origins via NIP-98 and push - #5020

Open
VaibhavJain2609 wants to merge 1 commit into
block:mainfrom
VaibhavJain2609:fix/4954-sanitize-auth-origin-disclosure
Open

fix(relay): stop disclosing internal origins via NIP-98 and push#5020
VaibhavJain2609 wants to merge 1 commit into
block:mainfrom
VaibhavJain2609:fix/4954-sanitize-auth-origin-disclosure

Conversation

@VaibhavJain2609

@VaibhavJain2609 VaibhavJain2609 commented Aug 6, 2026

Copy link
Copy Markdown

Summary

  • Sanitize NIP-98 HTTP 401 bodies so unauthenticated callers no longer receive the relay's expected URL (which can be an internal bind address behind a reverse proxy). Detail stays in server logs via tracing::warn!; clients get AuthError::client_message().
  • Omit NIP-11 push descriptors when the tenant host is private, loopback, or localhost (including localhost.), so push.origin cannot advertise internal topology on the unauthenticated root document.
  • Pin both behaviors with unit tests in buzz-auth and buzz-relay.

Closes #4954

Related surfaces checked

  • Git smart-HTTP already returned opaque "NIP-98 auth failed" (no change needed).
  • buzz-media already collapses auth failures to "authentication failed".

Test plan

  • cargo test -p buzz-auth --lib
  • cargo test -p buzz-relay --lib push_descriptor
  • cargo test -p buzz-relay --lib push_origin_host
  • cargo test -p buzz-relay --lib verify_bridge_auth_rejects_nip98
  • cargo test -p buzz-relay --lib moderation_read_query_bearing_nip98_event_rejected
  • cargo clippy -p buzz-auth --lib -- -D warnings
  • Confirm a mismatched NIP-98 POST /query returns {"error":"NIP-98: URL mismatch"} with no host/IP in the body
  • Confirm NIP-11 with Host 10.x.x.x (push configured) omits push entirely

Made with Cursor

Unauthenticated callers could learn a reverse-proxied relay's bind address
from NIP-98 401 bodies and NIP-11 push.origin. Return client-safe auth
messages and omit push descriptors for private/loopback hosts.

Closes block#4954

Signed-off-by: Vaibhav Jain <vaibhavjain@Vaibhavs-MacBook-Pro.local>
Co-authored-by: Cursor <cursoragent@cursor.com>
@VaibhavJain2609
VaibhavJain2609 requested a review from a team as a code owner August 6, 2026 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Relay's internal address is disclosed to unauthenticated callers via push.origin and NIP-98 error detail

1 participant