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>
🔐 Codex Security Review
Review SummaryOverall Risk: NONE
FindingsNo concrete security, correctness, or reliability findings were identified. Notes
Generated by Codex Security Review | |
|
No description provided. |
|
@builderbot review |
Amp-Thread-ID: T-01a1eab0-97d0-75be-af34-a93d1ee350c1 Signed-off-by: Camilo Sanchez <camilos@squareup.com>
|
No description provided. |
|
@builderbot review |
joahg
left a comment
There was a problem hiding this comment.
🤖 This is a comment, not an approval. A human maintainer must review this PR before it can merge.
I read the diff against main and traced the verified-profile code paths. I did not run the tests: the Rust CI jobs have not run on this PR yet.
What looks right
- A "verified profile alias" is the
display_name,usernameorfull_nametag of the relay-signed kind 30382 head innip_fi_profile_heads. It is written only after an issuer assertion is checked on a human WebSocket admission, for the key proven by NIP-42. A user cannot claim another user's alias by editing their own kind:0, because that table is never fed from kind:0. - The query is scoped to the community and joined only to the destination channel's member keys, so non-members and other communities do not match. The tests cover both.
- Ambiguity is kept: every (name, key) pair goes into the existing map, and a name shared by two keys resolves to nobody. The ordinary-vs-verified collision is tested.
- Authority is unchanged. The
buzz:workflow-mentiontag is still only added when the name resolves from the owner's authored template, so text injected throughtrigger.textgets aptag but no agent wake. This is tested.
Findings
- P2: These tables are documented as output-only ("Authorization never reads these tables", top of
store/verified_profiles.rs). Workflow mention resolution now reads them, and that resolution decides who receivesbuzz:workflow-mention. The wake gate still holds, but the doc comment is now wrong. Please update it or say why this use is safe. - P2: Verified heads are never retracted, and the
activetag is alwaystrue, so aliases are only as fresh as the holder's last admission. If an issuer reuses a username, the old holder keeps a stale alias. While both are channel members the mention is silently dropped. If only the old holder is in the channel, they are notified in place of the new holder. A bounded age check onverified_at, or a note that this is accepted, would help. - P2: Any channel member can set an ordinary display name equal to someone's verified username or full name. That makes the alias ambiguous and silently drops the mention. It cannot redirect the mention to the attacker, and ordinary names already behave this way. But verified names now look trustworthy, and a workflow can start missing a person with no error. Consider a log line when a mention is dropped as ambiguous.
- P3: Matching only uses
to_lowercase, with no Unicode normalization. A composed name in the issuer profile and a decomposed name typed in the template will not match. This fails closed, so it is only a missing notification. - P3: The new test covers lowercase aliases only. Add a mixed-case alias such as
@ALEX, and a case where two verified heads share a username, to pin the behavior. Also the doc comment onresolve_mention_pubkeyshas a line that runs past the usual wrap width.
| names.push((name, pubkey.clone())); | ||
| } | ||
| let profile: Option<sqlx::types::Json<nostr::Event>> = row.try_get("event")?; | ||
| if let Some(profile) = profile { |
There was a problem hiding this comment.
🤖 P2: The head is read as stored, with no check of verified_at or active. Heads are never retracted, so a stale alias can still resolve. Please add an age bound or note that it is accepted.
| let named_members = state | ||
| .db | ||
| .get_users_bulk_for_event_write(tenant.community(), &member_pubkeys) | ||
| .get_mention_names_for_event_write(tenant.community(), &member_pubkeys) |
There was a problem hiding this comment.
🤖 P2: This lookup now feeds the same resolver that produces buzz:workflow-mention. store/verified_profiles.rs says authorization never reads these tables. Please update that doc or explain why this is safe.
| [evalexpr](https://docs.rs/evalexpr) for condition evaluation. Keep expressions | ||
| simple and testable. | ||
|
|
||
| Workflow mention candidates include ordinary display names and verified |
There was a problem hiding this comment.
🤖 P2: Worth adding that a member's ordinary display name can collide with a verified alias and make it ambiguous, so the mention is dropped silently.
|
Instructions to get the build to run: |
|
@buzz-security-review abbb55c |
|
🤖 Superseded by #9685. The replacement is a draft on an upstream branch. Review comments were copied there with attribution and links to the originals. |
## Summary `buzz users get` reads only kind:0 profiles, so the CLI can't find or confirm a person by their verified username. This adds relay-verified profiles (kind:30382) to `users get`. - `--pubkey` adds a `verified` object (`username`, `display_name`, `full_name`, `issuer_label`, `verified_at`) for subjects that have one. A requested person with a verified profile but no kind:0 is still returned. - `--name` uses the relay's `POST /profiles/search` when the community advertises verified profiles with `searchable: true`, so it matches verified names (word prefix). Otherwise, or for queries over the endpoint's 100-character limit, it runs the existing NIP-50 substring search and attaches verified profiles where the community advertises them. Verified profiles are read only when NIP-11 advertises `federated_identity.public_profile`. A projection is trusted only if it is kind 30382, signed by the relay's `self` key with a valid signature, and follows the NIP-FI projection rules the mobile client applies: empty content, exactly the projection tags (each once with one value), `p` equal to `d`, `active` set to `true`, a valid username, names of 1–64 characters with no surrounding whitespace or control characters (looser than mobile, which also requires NFC and rejects more Unicode categories), and a decimal `verified_at` no later than `created_at`. The newest projection per subject wins (the lower id breaks a same-second tie), so a retraction clears the verified name. Any `verified` key in user-authored kind:0 content is dropped on every path, so only a relay-signed projection can set it. `users get` now makes one NIP-11 request. If that request fails, the advertisement is malformed, or the kind:30382 lookup fails, it still prints the kind:0 results and writes a `verified_profiles_unavailable` warning to stderr. This applies to `--pubkey`, no args, and `--name`. ### Related issue Related: #8745 (verified profile spec), #9624 (verified-name mentions in workflows). ### Testing - `cargo test -p buzz-cli` passes, with tests for trust checks, retraction, both lookup paths, search without the advertisement, and a forged `verified` object in kind:0 (no advertisement, impostor-only projection, and a valid projection replacing it). - `cargo fmt` and `cargo clippy -p buzz-cli -D warnings` are clean. - An earlier revision of the built CLI was run against a live community with verified profiles: `--name <verified username>` found a user whose kind:0 name differs, and `--pubkey` returned the expected `verified` objects. --------- Signed-off-by: damienrj <damien@squareup.com>
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 previously used only ordinary profile names. Include verified display names, usernames and full names too. Keep the existing channel/community boundaries, reject ambiguous names and preserve agent-wake authority checks.
Related issue
Related: #9340 optimizes the ordinary-profile lookup but does not add verified aliases.
Generated with Amp