Repository navigation
Conversation
Signed-off-by: Camilo Sanchez <camilos@squareup.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a1eab0-97d0-75be-af34-a93d1ee350c1 Co-authored-by: Amp <amp@ampcode.com> Signed-off-by: Camilo Sanchez <camilos@squareup.com>
Amp-Thread-ID: T-01a1eab0-97d0-75be-af34-a93d1ee350c1 Signed-off-by: Camilo Sanchez <camilos@squareup.com>
Signed-off-by: Camilo Sanchez <camilos@squareup.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a1f0c7-8b00-70a9-94bd-c1d62fed3aab Co-authored-by: Amp <amp@ampcode.com> Signed-off-by: Camilo Sanchez <camilos@squareup.com>
|
🤖 Discussion migrated from the original fork-backed PR. Quotes below preserve the original authors and context. Historical review results apply only to the old commits, not this PR. Review by @joahg
Inline comment by @joahgOriginal comment on
Inline comment by @joahgOriginal comment on
Inline comment by @joahgOriginal comment on
Earlier comment by @github-actions[bot]
Earlier comment by @cshtdd
Earlier comment by @cshtdd
Build instructions from @kazemek21Original comment. The community-specific message link is retained at its original location rather than copied here. Earlier comment by @cshtdd
|
|
@builderbot review |
|
@buzz-security-review 3e0cdfa |
🔐 Codex Security Review
|
|
🤖 @joahg, following up on your original review.
Lifecycle feedback: What should mention lookup do after an issuer reassigns an alias to another key? The lookup still reads stored heads without an age or The new matching-cost finding is also open and under investigation. These replies do not mark either concern resolved. |
Signed-off-by: Camilo Sanchez <camilos@squareup.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a1f101-9451-7674-ab92-1c2ea9f8515c Co-authored-by: Amp <amp@ampcode.com>
brow
left a comment
There was a problem hiding this comment.
🤖 The pre-review recommends landing this with one small fix: #9686 bound mention alias cost. Without it, every workflow message loads and parses each channel member's full verified-profile event and scans several times more names, so sends in large channels cost about five times more relay CPU even when the message mentions no one, and stored verified names still resolve in communities that no longer advertise verified profiles, which can drop an existing mention of an ordinary member. Please merge the fix into your branch (it needs no approval there); this PR is then approved and merged on Tom's go-ahead.
|
@buzz-security-review ee990c0 |
|
@builderbot review |
|
🤖 Addressed the earlier “Stop matching immediately when a candidate name differs” finding from this security review in ee990c0. The bot subsequently replaced that finding with a no-findings result for The matcher now normalizes message text once. Alias comparisons stop at the first mismatch, and an offset table preserves original-character boundaries through Unicode expansion and reordering. The isolated release benchmark reproduced the earlier finding. For 240 KiB of repeated All 23 matcher tests passed, including canonical Unicode equivalence, ambiguity and agent-wake authority cases. Another 20,026 isolated baseline/fix comparisons returned identical results. The large benchmark was one run, not a live-relay latency test. This removes repeated normalization, not all per-alias scanning or long-prefix costs. Requested a fresh security review for this exact commit. The stored-profile lifecycle question remains open. |
joahg
left a comment
There was a problem hiding this comment.
🤖 Requesting changes for the P1 inline.
The alias matching is sound:
- Candidates are channel members only, and each lookup is scoped to the community.
- When different keys collide, no mention tag is added.
- The Unicode normalization holds up, including Hangul and reordered combining marks.
- Outsider and other-community aliases don't resolve.
The unit, Postgres and observability_source tests pass locally.
The P1: verified aliases are read even when the community doesn't currently advertise verified profiles. Stored verified profiles are never retracted, so a stale or reassigned alias can send a mention, and an agent wake, to the wrong member. Two P2s are inline: the per-send cost, and a display name that shadows someone's verified alias. Smaller points:
- The AGENTS.md paragraph can drop the sentence about normalizing once, which repeats the code comment.
- Pin
unicode-normalizationto 0.1.25 in buzz-relay to match buzz-auth, or make it a workspace dependency.
This needs a human maintainer's review before it merges.
Follow-up to #9685 (verified profile aliases in workflow mentions), targeting its branch. #9685 makes every workflow `send_message` load each channel member's full kind:30382 verified-profile event, parse it into a `nostr::Event` while holding the writer connection, and scan the message for about five times as many names, on a tokio worker. That cost lands on every workflow send, including ones that mention no one. It also reads verified names even when the community no longer advertises verified profiles, so leftover profile heads can make an ordinary `@Name` ambiguous after an operator turns the feature off. This keeps the same output tags and: - **Skips mention resolution when the rendered text has no `@`.** No `@` means no `p` or `buzz:workflow-mention` tag can result, so the member and alias reads are skipped. - **Projects only the three name tags in SQL** (`display_name`, `username`, `full_name`, the same `jsonb_path_query_first` expression profile search uses) instead of shipping and parsing whole events. Identical case-folded names for one member are deduplicated. A malformed head no longer fails the send. - **Tries names only at mention anchors.** The resolver collects the positions of `@` at a left boundary once and matches each name only there, so its cost is names × mentions instead of names × characters. Matching rules are unchanged. - **Reads verified names only where the community advertises them**, using the same `verified_profiles::discovery` check as profile search. Otherwise the heads join is skipped. ### Validation - Extended the existing workflow alias test ([`workflow_send_message_binds_authority_to_authored_mentions`](https://github.com/block/buzz/blob/e0526e62c8f70a1b55b50e0f2d5d160337197c34/crates/buzz-relay/src/workflow_sink.rs)): it now runs with verified profiles advertised, adds a message with no `@`, and repeats two cases on the same roster without the advertisement (`@alex` notifies no one, `@Alex Example` notifies the ordinary member). - The existing resolver unit tests cover the anchor-only scan. ### Regressions None expected. Output tags are identical for every advertised community. In a community that does not advertise verified profiles, workflow mentions fall back to ordinary names, which is what they matched before #9685. --------- Signed-off-by: Tom Brow <tomb@block.xyz>
|
@buzz-security-review 89938da |
joahg
left a comment
There was a problem hiding this comment.
🤖 Re-checked at 89938da, after #9686 was merged in.
What's fixed:
- The gating half of my P1. Verified aliases are read only when the community advertises verified profiles, and the new test covers leftover heads with advertising off.
- The cost P2. The lookup now runs in SQL, is skipped when the text has no
@, and matching is anchored on@.
The matcher, workflow_sink and observability tests pass locally against a scratch database.
On your lifecycle question: I wouldn't add an age bound in the mention lookup. The reader can't tell whether an alias was reassigned, and an age bound still leaves a stale window. Reassignment belongs where the heads are written: when an issuer gives a username or full name to a new key, retract or supersede the other heads in that community with the same value. Until that exists, please note in the PR body and the verified_profiles.rs doc that a reassigned alias can still resolve to its old holder when that holder is the only member. With that documented, I'll treat the remaining half as an accepted limitation and clear my change request.
Still open, inline: display-name shadowing (P2) and the unicode-normalization pin (P3). This comes from outside the core maintainers, so a human maintainer still needs to review it before merge.
Signed-off-by: Camilo Sanchez <camilos@squareup.com>
…-workflow-verified-mentions * 'main' of https://github.com/block/buzz: (21 commits) chore: require relay owner review for the relay and db crates (#9728) fix(mobile): align Huddle cards and preserve conversation navigation (#9713) Match mobile mention chips to desktop styling (#9706) feat(relay): push mentions to people outside a listed channel (#9623) fix(db): undo migration 0097 (#9710) fix(mobile): keep glass controls mounted and the wide thread push parallax (#9726) fix(mobile): stabilize Duo chat switching and sheet layering (#9717) Require relay schema owner review for migrations and schema (#9708) fix(relay): resurface a hidden DM when someone else messages it (#9678) fix(deploy): pin self-host installs to relay 0.3.0 (#9714) fix(mobile): keep open shared sessions in Solo (#9704) fix(mobile): align channel indicators and Duo section menus (#9703) fix(mobile): allow person mentions in Solo chats (#9705) fix(mobile): let code scroll under the code block copy button (#9612) Transcribe Bestie hold recordings into text on device (#9645) feat(cli): show and search verified identity in users get (#9647) fix(mobile): keep agent poster up until the iOS video draws (#9688) test(relay): stop bridge cancel_fixture tests timing out on the first replica connect (#9691) Revert "feat(relay): support community-scoped NIP-AR artifacts" (#9689) feat(relay): add conditional Solo member role updates (#9667) ... Signed-off-by: Camilo Sanchez <camilos@squareup.com>
Signed-off-by: Camilo Sanchez <camilos@squareup.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a1f53d-3f92-75a5-84d3-cf4a28407929 Co-authored-by: Amp <amp@ampcode.com>
joahg
left a comment
There was a problem hiding this comment.
🤖 Re-checked at a547f8a. The unicode-normalization pin now matches buzz-auth at 0.1.25, thanks, and the workflow_sink tests pass locally.
My change request stands on one thing: the reassigned-alias limitation still isn't written down. Please add a sentence or two to the verified_profiles.rs module doc and the PR body covering what happens when an issuer gives a username or full name to a new key:
- The alias still resolves to the old holder when that holder is the only channel member.
- It's silently dropped when both holders are members.
- Retraction belongs where heads are written.
Once that's in, I'll treat the rest as accepted and clear the request.
Display-name shadowing (P2, inline from before) is still open. AGENTS.md now calls the collisions deliberate, so either let a verified alias win over an ordinary one, or say in the PR body that the griefing trade-off is accepted.
|
@buzz-security-review 7d015a7 |
Signed-off-by: Camilo Sanchez <camilos@squareup.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a1f53d-3f92-75a5-84d3-cf4a28407929 Co-authored-by: Amp <amp@ampcode.com>
|
@buzz-security-review 0777585 |
|
@builderbot review |
joahg
left a comment
There was a problem hiding this comment.
🤖 Both points from my last review are fixed on this head.
- Reassigned-alias limitation: now documented in the
verified_profiles.rsmodule doc and in the PR body. When the old holder is the only match, the alias still resolves to them. When both holders are members, the mention is dropped silently. Retraction belongs in the profile writer, and that is deferred to a follow-up PR. - Display-name shadowing: fixed in 7d015a7.
MentionNamenow carries averifiedflag, so a verified alias wins over an ordinary name. A collision between two names of the same kind (both verified or both ordinary) still suppresses the mention, and the result no longer depends on row order. AGENTS.md describes the new precedence.
cargo test --locked -p buzz-relay --lib workflow_sink -- --include-ignored passes against a scratch Postgres (32 tests, including the new precedence test). I found no new issues, so I'm dismissing my earlier change request.
This is a contribution from outside the core maintainer group, so a human maintainer still needs to review it before merge.
🤖 Addressed on 0777585; see the latest review.
|
@buzz-security-review 0777585 |
1 similar comment
|
@buzz-security-review 0777585 |
|
codex security review keeps timing out |
jedwards27
left a comment
There was a problem hiding this comment.
🤖
Relay contract: workflow p and buzz:workflow-mention recipient tags now resolve relay-verified aliases; exercise desktop and mobile mention notifications, collisions, and delegated agent wakes against the changed relay.
:bot: Jude’s code review agent — recommend request changes for one concrete issuer-scope defect. This is a COMMENT review under block/buzz's agent-review policy; the human maintainer decides whether to request changes.
Reviewed: base 4e1d0b27fd0baac0315ae4a959d175c11de6a36c → exact head 0777585a2be6c7593ea36fe0be3e87832f37202f (open/non-draft at submission). Risk: critical, because a revoked issuer's stale identity claim can direct notifications and delegated agent wakes to the wrong member.
Blocking finding — filter aliases by the authorized issuer, not merely by feature availability. try_discovery reduces the currently authorized issuer set to Some/None; workflow_sink.rs:547–565 passes that boolean; the alias query joins every historical verified-profile head in the community regardless of v.issuer. When issuer A has been removed but B remains advertised, a channel member's old A-only alias still resolves to a p tag and, when authored/authorized, buzz:workflow-mention. The exact-head integration fixture itself advertises only https://issuer.test while writing heads from https://identity.example.org and asserting those tags (workflow_sink.rs:1117–1121, 1699–1719, 1819–1893). This is distinct from the documented same-issuer alias-reassignment limitation. Author action: pass the host/community's currently authorized issuer set into the DB lookup; constrain v.issuer accordingly, and add a revoked-A/active-B regression asserting no A-derived recipient or wake tag while B-derived aliases still resolve. Update the fixture's intended issuer accordingly. Verification owner: author for patch/test; reviewer for exact-head retest.
Client/product lens: desktop and mobile notification selectors consume recipient p tags without requiring a kind-0 profile (desktop/src/features/notifications/lib/shouldNotify.ts:12–27; mobile/lib/shared/mentions/mention_tags.dart:10–30). Verified-only alias text may remain plain rather than a clickable identity because the message renderers derive bindings from kind-0/agent names, not the verified alias set (desktop/src/shared/lib/resolveMentionNames.ts:40–64; mobile/lib/shared/mentions/mention_bindings.dart:121–150). This is a non-blocking UX caveat for this PR's stated routing scope; do not dynamically rebind historical text when aliases change. Author action on UI: none for this PR.
Validation: independent clean worktree at 0777585a2be6c7593ea36fe0be3e87832f37202f; inspected the diff, SQL, issuer policy, workflow sink, test fixture, VISION and TESTING contracts. Separate reviewer ran git diff --check at that head (pass). Exact-head GitHub checks for PostgreSQL Tests, Rust Unit Tests/Lint, Relay E2E and Desktop E2E Integration report success; Run Codex Security Review is cancelled, not a test-pass claim. A separate full buzz-db + buzz-relay package run on isolated Blox is pending; no local package pass is claimed.
Manual/native evidence: not run. Verification owner: reviewer/tooling for the desktop and iOS native changed-relay gate: verified-only member without kind-0, foreground/background notification and click-through; verified/ordinary collision refusal; trigger-injected text cannot delegate-wake while permitted authored mention can. The acknowledged alias-reassignment behavior also needs an honest observation, not a test that presumes the deferred writer fix. Human maintainer review/testing remains required under repo policy. Residual risk: live delivery, native push, and renderer behavior remain unwitnessed; green CI does not establish them.
|
🤖 :bot: Jude’s code review agent — exact-head validation addendum to the integrated review: on an isolated Blox workstation with clean |
Summary
Fix missing mention recipients in workflow messages for members who have only a relay-verified profile.
For example, Alex is a channel member whose verified profile shows
Alex Example (@alex), but who has no ordinary profile. A workflow sendsReminder @alex: post your update:@alex, but Alex is missing from its recipient (p) tags. The text looks like a mention without actually tagging Alex.The lookup includes verified display names, usernames and full names only when the community advertises verified profiles. Candidates remain channel/community-scoped. Verified aliases take precedence over ordinary names with the same normalized value. Distinct keys sharing a verified alias remain ambiguous, as do ordinary-name collisions without a verified match. Canonically equivalent Unicode names match consistently, and authored-template agent-wake authority checks remain unchanged. See the precedence fix and regression coverage.
Known limitation
Alias reassignment is deferred to a follow-up chained PR. If an issuer gives a username or full name to a new key, a workflow mention can still resolve to the old holder when only that holder is a channel member. If both holders are members and retain that verified alias, the mention is silently dropped. The same resolution feeds delegated agent-wake tags, subject to the existing authority checks. Retraction or supersession belongs in the profile writer, not an age bound in mention lookup, which would still leave a stale window. This limitation is also documented in
verified_profiles.rs, following the review's requested scope.Related issue
Supersedes the fork-backed PR #9624. Related: #9340 optimizes the ordinary-profile lookup but does not add verified aliases. #9686 is integrated into this branch, including advertisement gating and SQL alias extraction.
Testing
The precedence regression failed before the fix and passed afterward. On the precedence commit, all 24 matcher tests and eight isolated PostgreSQL workflow tests passed locally. A local relay webhook probe returned HTTP 202 and persisted recipient and delegated agent-wake tags for the verified member, excluding the ordinary-name shadow. This does not establish device notification delivery or human testing.
The PostgreSQL CI job and Rust lint job passed for that commit. Other checks and the fresh security review must be assessed on the final PR head. Human testing and human maintainer review remain required before merge.
Generated with Amp