fix(cli,relay): resolve agents by verified owner - #2615
Conversation
|
P0 triage — merge candidate. 🐝 Confirmed the identity/access bug: The fix is the right shape: Before merge, please confirm:
Code on the CLI side LGTM; the security guarantee lives in the relay half — worth a reviewer with relay context signing off on that. |
There was a problem hiding this comment.
🤖 The core of this is sound and it fixes a real incident class — the owner rows come from users.agent_owner_pubkey, materialized only after cryptographic NIP-OA verification (crates/buzz-relay/src/api/mod.rs:147-216), not from self-asserted tags; the SQL is parameter-bound and community-scoped; requested authors are intersected rather than replaced; and zero owner matches fail closed on the catch-all/search paths. But there are three things I'd want fixed before this merges, the first one especially:
Blocking:
- The channel-window fast path bypasses the owner filter. In
crates/buzz-relay/src/api/bridge.rs(around 1042-1060 and 1122-1137),agent_owneris rewritten intoauthors, but a request combiningagent_ownerwithtop_level:trueis dispatched tohandle_channel_window_filter()before the catch-all's empty-owner guard, and that path queries only channel/kind/cursor — it ignoresauthorsentirely. So an owner-constrained query can return events from every author in the channel. Since the extension presentsagent_owneras a generic/queryfilter, it needs to be enforced on every dispatch path: either rejectagent_owneron the specialized filters it can't honor, or centralize the owner/author constraint so each path applies it before returning. - No end-to-end behavioral test for the security contract. The relay test at
bridge.rs:2886-2895only checks hex parsing, the DB test atcrates/buzz-db/src/user.rs:539-589is ignored and doesn't exercise/query, and the CLI tests only cover field copying. Nothing currently proves that two same-name agents with different verified owners resolve to only the requested owner's agent, that zero matches stay empty, or that an existingauthorslist is intersected. Given this is an identity/access fix, please add relay-backed tests that fail without the fix and cover those cases — including the channel-window path above. - Missing index for the new lookup.
crates/buzz-db/src/user.rs:294-310filters by(community_id, agent_owner_pubkey), but the schema only has the users PK plus the NIP-05/Okta indexes (migrations/0001_initial_schema.sql:154-181), so every owner-filtered search scans the tenant's users table. A partial index like(community_id, agent_owner_pubkey) WHERE agent_owner_pubkey IS NOT NULLplus a quick query-plan check would keep the fix from being O(all users in community).
Minor, non-blocking:
crates/buzz-cli/src/commands/users.rs:44-55, 144-155always sendsinclude_agent_owner:trueand serializesagent_owner:nulleven for plainbuzz users get, which adds an extra DB lookup to every profile read and couples the whole command to the bridge extension. Omitting it unless requested would keep the default path lean.- A one-line example of
users get --name … --owner meincrates/buzz-cli/README.mdwould help agents actually discover the owner-aware path — it's the safe replacement for exactly the lookup that caused the incident.
Happy to re-review once the fast-path enforcement and tests are in.
1df7cdd to
f774fd9
Compare
Co-authored-by: npub1qye6rec0htgg3np8yt6plpyyg8cyffaq66emt3kmk05eylckkzhq0hnf2k <0133a1e70fbad088cc2722f41f848441f044a7a0d6b3b5c6dbb3e9927f16b0ae@buzz.block.builderlab.xyz> Signed-off-by: npub1qye6rec0htgg3np8yt6plpyyg8cyffaq66emt3kmk05eylckkzhq0hnf2k <0133a1e70fbad088cc2722f41f848441f044a7a0d6b3b5c6dbb3e9927f16b0ae@buzz.block.builderlab.xyz>
Co-authored-by: npub1qye6rec0htgg3np8yt6plpyyg8cyffaq66emt3kmk05eylckkzhq0hnf2k <0133a1e70fbad088cc2722f41f848441f044a7a0d6b3b5c6dbb3e9927f16b0ae@buzz.block.builderlab.xyz> Signed-off-by: npub1qye6rec0htgg3np8yt6plpyyg8cyffaq66emt3kmk05eylckkzhq0hnf2k <0133a1e70fbad088cc2722f41f848441f044a7a0d6b3b5c6dbb3e9927f16b0ae@buzz.block.builderlab.xyz>
Co-authored-by: npub1qye6rec0htgg3np8yt6plpyyg8cyffaq66emt3kmk05eylckkzhq0hnf2k <0133a1e70fbad088cc2722f41f848441f044a7a0d6b3b5c6dbb3e9927f16b0ae@buzz.block.builderlab.xyz> Signed-off-by: npub1qye6rec0htgg3np8yt6plpyyg8cyffaq66emt3kmk05eylckkzhq0hnf2k <0133a1e70fbad088cc2722f41f848441f044a7a0d6b3b5c6dbb3e9927f16b0ae@buzz.block.builderlab.xyz>
f2cc0ce to
f86ef32
Compare
|
Nudge on behalf of @doph — high-priority merge list. CI is green (32 checks) and the review gate is a pending re-review request to @wpfleger96. A fresh look would unblock this. 🐝 |
* origin/main: fix(cli,relay): resolve agents by verified owner (#2615) fix(desktop): make the test loader work on Windows (#2758) fix(desktop): make lint and unit-test gates work on Windows (#2943) feat(mobile): refactor Activity behavior and ui (#2889) Signed-off-by: npub1223z34hd7vtwc6qj4s7flsxkj644nlre2nthu7lrrmkumhu3xddsrx9r6w <52a228d6edf316ec6812ac3c9fc0d696ab59fc7954d77e7be31eedcddf91335b@buzz.block.builderlab.xyz>
Inherits the #3154 file-size override for AgentCreationPreview.tsx that turned Desktop Core red on every PR's synthetic merge, plus #2615 and Windows test-gate fixes. Co-authored-by: Tyler Longwell <tlongwell@block.xyz> Signed-off-by: Tyler Longwell <tlongwell@block.xyz> * origin/main: chore(desktop): add AgentCreationPreview file-size override to unblock main CI (#3154) fix(cli,relay): resolve agents by verified owner (#2615) fix(desktop): make the test loader work on Windows (#2758) fix(desktop): make lint and unit-test gates work on Windows (#2943) feat(mobile): refactor Activity behavior and ui (#2889) feat(desktop): add search to agent emoji picker (#2630) fix(desktop): keep identity key help dialog readable in dark mode (#2854) feat(acp): title agent sessions from the agent and channel name (#3028) feat(mobile): bring message actions to desktop parity (#3070) feat(git): use agent display name as git author name (#3040) Signed-off-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@buzz.block.builderlab.xyz>
* origin/main: (102 commits) chore(desktop): add AgentCreationPreview file-size override to unblock main CI (block#3154) fix(cli,relay): resolve agents by verified owner (block#2615) fix(desktop): make the test loader work on Windows (block#2758) fix(desktop): make lint and unit-test gates work on Windows (block#2943) feat(mobile): refactor Activity behavior and ui (block#2889) feat(desktop): add search to agent emoji picker (block#2630) fix(desktop): keep identity key help dialog readable in dark mode (block#2854) feat(acp): title agent sessions from the agent and channel name (block#3028) feat(mobile): bring message actions to desktop parity (block#3070) feat(git): use agent display name as git author name (block#3040) fix(security): enforce durable community ban on NIP-43 relay-admin kinds 9030-9033 (block#3128) chore(deps): update react monorepo to v19.2.8 (block#3064) fix(deps): bump nostr to 0.44.6 for RUSTSEC-2026-0216 (NIP-44 remote DoS) (block#3135) docs(contributing): set PR expectations and require UI screenshots (block#3140) fix(desktop): read the newest pair-scoped harness log (block#3134) fix(security): authorize kind:9000 role changes in both directions (block#3017) feat(desktop): handle project work from Inbox (block#3117) fix(desktop): clarify identity key button when key exists (block#2357) Restore Goose and Buzz Agent to onboarding harness selection (block#2731) fix(mobile): mitigate message-post delay with optimistic rendering (block#3037) ...
* origin/main: (102 commits) chore(desktop): add AgentCreationPreview file-size override to unblock main CI (block#3154) fix(cli,relay): resolve agents by verified owner (block#2615) fix(desktop): make the test loader work on Windows (block#2758) fix(desktop): make lint and unit-test gates work on Windows (block#2943) feat(mobile): refactor Activity behavior and ui (block#2889) feat(desktop): add search to agent emoji picker (block#2630) fix(desktop): keep identity key help dialog readable in dark mode (block#2854) feat(acp): title agent sessions from the agent and channel name (block#3028) feat(mobile): bring message actions to desktop parity (block#3070) feat(git): use agent display name as git author name (block#3040) fix(security): enforce durable community ban on NIP-43 relay-admin kinds 9030-9033 (block#3128) chore(deps): update react monorepo to v19.2.8 (block#3064) fix(deps): bump nostr to 0.44.6 for RUSTSEC-2026-0216 (NIP-44 remote DoS) (block#3135) docs(contributing): set PR expectations and require UI screenshots (block#3140) fix(desktop): read the newest pair-scoped harness log (block#3134) fix(security): authorize kind:9000 role changes in both directions (block#3017) feat(desktop): handle project work from Inbox (block#3117) fix(desktop): clarify identity key button when key exists (block#2357) Restore Goose and Buzz Agent to onboarding harness selection (block#2731) fix(mobile): mitigate message-post delay with optimistic rendering (block#3037) ...
* origin/main: (22 commits) chore(desktop): add AgentCreationPreview file-size override to unblock main CI (block#3154) fix(cli,relay): resolve agents by verified owner (block#2615) fix(desktop): make the test loader work on Windows (block#2758) fix(desktop): make lint and unit-test gates work on Windows (block#2943) feat(mobile): refactor Activity behavior and ui (block#2889) feat(desktop): add search to agent emoji picker (block#2630) fix(desktop): keep identity key help dialog readable in dark mode (block#2854) feat(acp): title agent sessions from the agent and channel name (block#3028) feat(mobile): bring message actions to desktop parity (block#3070) feat(git): use agent display name as git author name (block#3040) fix(security): enforce durable community ban on NIP-43 relay-admin kinds 9030-9033 (block#3128) chore(deps): update react monorepo to v19.2.8 (block#3064) fix(deps): bump nostr to 0.44.6 for RUSTSEC-2026-0216 (NIP-44 remote DoS) (block#3135) docs(contributing): set PR expectations and require UI screenshots (block#3140) fix(desktop): read the newest pair-scoped harness log (block#3134) fix(security): authorize kind:9000 role changes in both directions (block#3017) feat(desktop): handle project work from Inbox (block#3117) fix(desktop): clarify identity key button when key exists (block#2357) Restore Goose and Buzz Agent to onboarding harness selection (block#2731) fix(mobile): mitigate message-post delay with optimistic rendering (block#3037) ...
Co-authored-by: Kalvin Chau <kalvin@block.xyz> Signed-off-by: Kalvin Chau <kalvin@block.xyz> * origin/main: chore(deps): update plugin org.jetbrains.kotlin.android to v2.2.21 (#3058) resolve findings (#3150) Revert "fix(cli,relay): resolve agents by verified owner" (#3168) feat(desktop): redesign agent runtime settings (#3093) fix(mobile): match markContextRead signature in activity test fake (#3158) fix(desktop): use forward slashes for git credential.helper on Windows (#3023) fix(mobile): tapping threaded message in Inbox navigates to top level of channel (#2103) fix(mobile): retry channel-sections startup sync when relay rate-limits cold start (#3004) chore(desktop): add AgentCreationPreview file-size override to unblock main CI (#3154) fix(cli,relay): resolve agents by verified owner (#2615) fix(desktop): make the test loader work on Windows (#2758) fix(desktop): make lint and unit-test gates work on Windows (#2943) feat(mobile): refactor Activity behavior and ui (#2889) feat(desktop): add search to agent emoji picker (#2630) fix(desktop): keep identity key help dialog readable in dark mode (#2854) feat(acp): title agent sessions from the agent and channel name (#3028) feat(mobile): bring message actions to desktop parity (#3070) Signed-off-by: npub122y0pqkertljmedu303rl0aqrj3w8pvu43t6jxm6875lzg6f2pwqegc3xc <5288f082d91aff2de5bc8be23fbfa01ca2e3859cac57a91b7a3fa9f12349505c@buzz.block.builderlab.xyz>
…inks * origin/main: (24 commits) Refine pending message status (#3153) feat(admin): show reported message content in report detail (#3149) fix(desktop): recover full local storage on startup (#3182) Replace mobile reconnect banners with skeleton shimmer (#3143) fix(desktop): keep collapsed table separators out of spoilers (#3169) chore(deps): update plugin org.jetbrains.kotlin.android to v2.2.21 (#3058) resolve findings (#3150) Revert "fix(cli,relay): resolve agents by verified owner" (#3168) feat(desktop): redesign agent runtime settings (#3093) fix(mobile): match markContextRead signature in activity test fake (#3158) fix(desktop): use forward slashes for git credential.helper on Windows (#3023) fix(mobile): tapping threaded message in Inbox navigates to top level of channel (#2103) fix(mobile): retry channel-sections startup sync when relay rate-limits cold start (#3004) chore(desktop): add AgentCreationPreview file-size override to unblock main CI (#3154) fix(cli,relay): resolve agents by verified owner (#2615) fix(desktop): make the test loader work on Windows (#2758) fix(desktop): make lint and unit-test gates work on Windows (#2943) feat(mobile): refactor Activity behavior and ui (#2889) feat(desktop): add search to agent emoji picker (#2630) fix(desktop): keep identity key help dialog readable in dark mode (#2854) ... Signed-off-by: npub1dccv64krpcpse5cmkzfeh998cftungyatw3djt8jwdw6g43f7fyqzzmrf7 <6e30cd56c30e030cd31bb0939b94a7c257c9a09d5ba2d92cf2735da45629f248@buzz.block.builderlab.xyz> Co-authored-by: npub1dccv64krpcpse5cmkzfeh998cftungyatw3djt8jwdw6g43f7fyqzzmrf7 <6e30cd56c30e030cd31bb0939b94a7c257c9a09d5ba2d92cf2735da45629f248@buzz.block.builderlab.xyz>
* origin/main: (22 commits) chore(desktop): add AgentCreationPreview file-size override to unblock main CI (block#3154) fix(cli,relay): resolve agents by verified owner (block#2615) fix(desktop): make the test loader work on Windows (block#2758) fix(desktop): make lint and unit-test gates work on Windows (block#2943) feat(mobile): refactor Activity behavior and ui (block#2889) feat(desktop): add search to agent emoji picker (block#2630) fix(desktop): keep identity key help dialog readable in dark mode (block#2854) feat(acp): title agent sessions from the agent and channel name (block#3028) feat(mobile): bring message actions to desktop parity (block#3070) feat(git): use agent display name as git author name (block#3040) fix(security): enforce durable community ban on NIP-43 relay-admin kinds 9030-9033 (block#3128) chore(deps): update react monorepo to v19.2.8 (block#3064) fix(deps): bump nostr to 0.44.6 for RUSTSEC-2026-0216 (NIP-44 remote DoS) (block#3135) docs(contributing): set PR expectations and require UI screenshots (block#3140) fix(desktop): read the newest pair-scoped harness log (block#3134) fix(security): authorize kind:9000 role changes in both directions (block#3017) feat(desktop): handle project work from Inbox (block#3117) fix(desktop): clarify identity key button when key exists (block#2357) Restore Goose and Buzz Agent to onboarding harness selection (block#2731) fix(mobile): mitigate message-post delay with optimistic rendering (block#3037) ...
Context
buzz users get --name Honeysearches relay-wide profiles and returns up to 100 identically named results without verified ownership metadata. An agent resolving “my Honey” cannot distinguish the requesting human's agent from another owner's agent, and the owned match can be excluded by the result limit. This caused the wrong Honey and Bumble pubkeys to be added to a channel.Summary
This bug fix makes personal-agent resolution owner-aware. Callers can filter profiles by a verified owner identity before result limits are applied, and all profile results expose enough ownership context to diagnose duplicate names.
Changes
buzz users get --owner me|<hex>|<npub>for name and pubkey lookups.meto the NIP-OA owner identity when the CLI runs as an agent.agent_owner_pubkeyrelationship before applying the result limit.owner_pubkey,owner_display_name, and client-relativeowned_by_mein compact and JSON output.nullremains equivalent to no owner filter for ordinary CLI lookups.(community_id, agent_owner_pubkey)index for owner lookups.users get --name Honey --owner melookup.Reviewer-reproducible examples
The relay-backed test creates two same-name agents with different verified owners, queries through the HTTP
/queryroute, verifies only the selected owner's agent is returned with verified owner metadata, and verifies a missing owner returns[].cargo test -p buzz-relay query_agent_owner_returns_only_verified_owner_matches --lib -- --ignoredThe owner/author intersection and unsupported-specialized-filter contracts also have infrastructure-free relay tests:
cargo test -p buzz-relay agent_owner --libThe CLI surface is visible in command help:
cargo run -q -p buzz-cli -- users get --help | grep -- --ownerValidation
cargo test -p buzz-cli(252 passed)cargo test -p buzz-db(84 passed, 122 infrastructure tests ignored)cargo test -p buzz-relay --lib(owner-filter tests pass; the full local suite is blocked by unrelated Postgres pool timeouts in media/admin tests)cargo test -p buzz-relay query_agent_owner_returns_only_verified_owner_matches --lib -- --ignored(passed)cargo check --workspace --all-targetscargo fmt --all -- --checkflutteris not installedpnpm check:file-sizes(passed after rebasing onto currentmain)