feat(relay): add BUZZ_AGENT_SHARING_DISABLED flag and tighten channel_add_policy default#1297
Closed
wpfleger96 wants to merge 1 commit into
Closed
feat(relay): add BUZZ_AGENT_SHARING_DISABLED flag and tighten channel_add_policy default#1297wpfleger96 wants to merge 1 commit into
wpfleger96 wants to merge 1 commit into
Conversation
…_add_policy default
Security: any relay member could add any agent to any channel because
channel_add_policy defaulted to 'anyone'. Two targeted fixes:
1. Migration 0005 changes the column default from 'anyone' to 'owner_only'
so new agents start safe on all relays.
2. BUZZ_AGENT_SHARING_DISABLED=true enables relay-wide enforcement:
- kind:9000 PUT_USER targeting an agent is rejected unless the actor
is the agent's owner (pre-storage, returns NIP-01 NOTICE).
- kind:10100 setting channel_add_policy='anyone' is blocked (the DB
column is not updated; the event is stored but has no effect).
- On startup, all existing channel_add_policy='anyone' rows are
clamped to 'owner_only' (idempotent, runs every restart while
the flag is set).
Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
Collaborator
Author
|
Closing in favor of ACP harness-side enforcement per team decision. Relay should not control client behavior. |
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
Addresses the security gap where any relay member could add any agent to any channel, and agents could configure themselves to respond to anyone.
Two targeted changes in one PR:
1. Migration 0005 — changes the
channel_add_policycolumn default from'anyone'to'owner_only'. New agents on any relay start safe without any operator action.2.
BUZZ_AGENT_SHARING_DISABLED=true— relay-wide enforcement flag for immediate Block relay relief:kind:9000PUT_USER targeting an agent is rejected pre-storage unless the actor is the agent's registered owner. Non-agent targets are unaffected.kind:10100settingchannel_add_policy = 'anyone'is blocked: the DB column is not updated (the event is stored per NIP-01 semantics, but has no effect).channel_add_policy = 'anyone'rows are clamped to'owner_only'. Idempotent — runs every restart while the flag is set.When the flag is
false(default), behavior is identical to today.Files changed
migrations/0005_default_channel_add_policy_owner_only.sql— new migrationcrates/buzz-relay/src/config.rs—agent_sharing_disabledfield + env var parsing + 3 new testscrates/buzz-relay/src/handlers/side_effects.rs— enforcement at kind:10100 and kind:9000crates/buzz-relay/src/main.rs— startup clampcrates/buzz-db/src/lib.rs—clamp_anyone_channel_add_policymethod onDbcrates/buzz-db/src/user.rs—clamp_anyone_channel_add_policyfn + DB testcrates/buzz-db/src/migration.rs— migration count test updated to 4