Skip to content

feat(cli): show and search verified identity in users get - #9647

Merged
damienrj merged 7 commits into
mainfrom
damienrj/cli-verified-profiles
Nov 19, 2026
Merged

damienrj merged 7 commits into
mainfrom
damienrj/cli-verified-profiles

Conversation

@damienrj

@damienrj damienrj commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

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.

Where a community advertises NIP-FI verified profiles, users get attaches a
verified object (username, display_name, full_name, issuer_label,
verified_at) from the relay-signed kind:30382, trusting only the NIP-11 self
key. --name now uses the relay profile search so verified usernames match,
falling back to NIP-50 on relays without it. messages send also resolves
@mentions by a channel member's verified username.

Signed-off-by: damienrj <damien@squareup.com>
@damienrj
damienrj requested a review from a team as a code owner November 18, 2026 08:58
@github-actions github-actions Bot added the codex-security-review-current The posted Codex security review matches its recorded range. label Nov 18, 2026
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🔐 Codex Security Review

Note: This is an automated, security-focused review generated by Codex.
Use it as a supplement to human review; false positives are possible.

Scope

  • Exact PR diff: 44e97e96f43b3882151119ed59f0af4c2fb4fbad...24a8cc6bb229ed9807d9a207295925752c25b468
  • Model: gpt-6.1-sol

💡 Click "edited" above to see earlier reviews for this PR.


Review Summary

Overall Risk: NONE

No concrete security, correctness, or reliability regressions found in the authorized PR range.

Findings

No concrete security, correctness, or reliability findings were identified.

Notes

  • Review used read-only source and history inspection. Builds and tests were not run, as requested.

Generated by Codex Security Review |
Requested by: @damienrj |
Workflow run

Drop the messages send @mention change, the unicode name validation and
strict projection checks, the 404 fallback and verified-only entries.
Strip any verified key from kind:0 content so only a relay-signed
kind:30382 can set it.

Signed-off-by: damienrj <damien@squareup.com>

@joahg joahg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 This needs a human maintainer's review because it comes from outside the core maintainer group. No P0 or P1 findings.

What holds up:

  • Only kind 30382 events signed by the NIP-11 self key count, and event.verify() checks the id and signature for real.
  • The projection shape, the active status and verified_at <= created_at are enforced. The newest event per subject wins, with the lower id breaking ties.
  • A newer retraction or malformed head clears the name. All of this matches the mobile client.
  • /profiles/search is NIP-98 signed, and only a 404 falls back to NIP-50.
  • A relay without federated_identity reads as "not advertised", so older relays are fine.

Inline: two P2s (verified usernames collide with self-declared names in @ resolution, and a NIP-11 discovery failure is now fatal for users get and messages send) and one P3 (queries over 100 characters).

Also P3: the name validators in verified_profiles.rs copy buzz-auth's. Sharing them, or adding a test that pins them to the relay's rules, would keep them from drifting.

Not covered: I didn't build or run the tests, and I didn't review the owner-scoped --name path.

Comment thread crates/buzz-cli/src/commands/users.rs Resolved
@github-actions github-actions Bot removed the codex-security-review-current The posted Codex security review matches its recorded range. label Nov 18, 2026
@github-actions github-actions Bot added the codex-security-review-current The posted Codex security review matches its recorded range. label Nov 18, 2026

@joahg joahg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Follow-up on b8b95d3, which narrows the PR to users get.

  • Dropping the messages send mention change resolves the verified-versus-profile-name collision.
  • Dropping the copied validators resolves the drift risk.
  • The trust core is intact: only kind 30382 events signed by the advertised self key count, event.verify() runs, active must be true, and there's a test for events from other keys.
  • Stripping verified from kind:0 content in both lookup paths is a good addition: it stops a self-written profile from claiming verification.

Two P3s remain:

  • users get, with no args or --pubkey, still fails outright when the relay info can't be fetched or its advertisement is malformed, though the kind:0 output doesn't need it. The doc comment says this is deliberate, which is fine. A stderr warning that keeps the kind:0 output would be friendlier for read-only lookups.
  • On a relay that advertises verified profiles, --name now goes only through /profiles/search. A query over 100 characters errors (400) where NIP-50 used to answer, and results stop at one page of 100.

This still needs a human maintainer's review, because it comes from outside the core maintainer group.

Warn on stderr instead of failing --pubkey lookups when relay info can't be read, and send --name queries over 100 characters to NIP-50 search.

Signed-off-by: damienrj <damien@squareup.com>
@github-actions github-actions Bot added codex-security-review-current The posted Codex security review matches its recorded range. and removed codex-security-review-current The posted Codex security review matches its recorded range. labels Nov 18, 2026

@joahg joahg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Follow-up on c3760e0. Both open points are fixed:

  • users get --pubkey and users get with no arguments now keep the kind:0 output when relay info or the verified lookup fails, and write the verified_profiles_unavailable warning to stderr. stdout JSON is unaffected. --name still fails hard, as you described, since that path needs the advertisement.
  • A --name query longer than 100 characters falls back to NIP-50. The check (trim().chars().count() <= 100) matches the server's trim and character count, so there's no bytes-vs-characters mismatch.

Two small test gaps are noted inline. This is an outside contribution, so a human maintainer still needs to review it before merge.

Comment thread crates/buzz-cli/src/commands/users.rs Resolved
Comment thread crates/buzz-cli/src/commands/users.rs Resolved

@wpfleger96 wpfleger96 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Reviewed at c3760e0, on top of joahg's earlier passes. The trust core holds: only kind 30382 events from the NIP-11 self key with a valid id and signature count, and a verified key in user-written kind:0 content never reaches the output. Two correctness gaps that the existing comments don't cover are inline, and I'd like them fixed before approving. One nonblocking note about spec checks is inline too.

Comment thread crates/buzz-cli/src/commands/users.rs Resolved
Comment thread crates/buzz-cli/src/commands/users.rs Resolved
users get --pubkey returns requested people who have a verified profile but no kind:0. --name uses /profiles/search only when public_profile is searchable, otherwise NIP-50 with verified profiles attached. Restore the NIP-FI projection checks: empty content, exact tag set, p equal to d, verified_at not after created_at, well-formed names, and the lower id winning a same-second tie.

Signed-off-by: damienrj <damien@squareup.com>
Signed-off-by: damienrj <damien@squareup.com>
…-profiles

* origin/main:
  test(relay): refresh the author's membership cache after the stray-h private channel insert (#9640)
  fix(mobile): name the cause of account-unavailable sign-in errors (#9628)
  perf(db): bound deep keyset history pages by the cursor timestamp (#9549)
  feat(cli)!: consistent channels list/get/search output (type, visibility, labels, real created_at) (#9617)
  ci(docker): publish the push gateway only when its inputs change (#9658)
  feat(mobile): reply to a message from its iOS notification (#9439)
  fix(mobile): stop reporting saved images as failed on iOS (#9599)

Signed-off-by: damienrj <damien@squareup.com>
@github-actions github-actions Bot removed the codex-security-review-current The posted Codex security review matches its recorded range. label Nov 18, 2026
@github-actions github-actions Bot added the codex-security-review-current The posted Codex security review matches its recorded range. label Nov 18, 2026
@damienrj
damienrj requested a review from wpfleger96 November 18, 2026 20:39

@joahg joahg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Follow-up on 9a14081. Both of my earlier test gaps are closed: the warning is now asserted, and the 100-character boundary and multi-byte cases are pinned. wpfleger96's three points also look fixed when checked against the code:

  • --pubkey and the no-argument lookup now append people who have only a verified profile, in request order, with no duplicate rows.
  • --name uses /profiles/search only when searchable is literally true, and falls back to NIP-50 plus fetch_verified_profiles otherwise.
  • Projection validation is back and accepts what the relay emits.

The full buzz-cli suite passes locally. I've added two small notes inline.

This is an outside contribution, so a human maintainer still needs to review it before merge.

Comment thread crates/buzz-cli/src/commands/users.rs Resolved
Matches the --pubkey path: kind:0 matches are kept and a verified_profiles_unavailable warning goes to stderr. Document that valid_name is looser than the relay's NFC and category rules.

Signed-off-by: damienrj <damien@squareup.com>
@damienrj
damienrj deployed to codex-review November 18, 2026 22:12 — with GitHub Actions Active
@github-actions github-actions Bot added codex-security-review-current The posted Codex security review matches its recorded range. and removed codex-security-review-current The posted Codex security review matches its recorded range. labels Nov 18, 2026

@wpfleger96 wpfleger96 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Re-reviewed at 24a8cc6. All three of my earlier points are fixed: --pubkey and the no-argument lookup now return people who only have a verified profile, --name uses /profiles/search only when searchable is true and otherwise falls back to NIP-50 with verified profiles attached, and the projection checks are back, including the lower-id tie-break. The new --name fallback keeps kind:0 matches with a warning when the verified check fails, matching --pubkey. I found no new issues. LGTM.

@joahg joahg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Follow-up: 24a8cc6 addresses both of my open P3s. If NIP-11 discovery or the kind:30382 query fails, --name now keeps the kind:0 matches and prints a verified_profiles_unavailable warning on stderr. A failing /profiles/search on a searchable relay still errors, which is reasonable since that request is the search itself. The new test covers both failure branches and the healthy case. The valid_name and parse_projection docs now say their checks are looser than mobile's. The users:: and verified_profiles:: tests pass locally. No new findings.

This PR comes from outside the core maintainer group, so a human Buzz maintainer needs to review and approve it. This review is a comment only.

@damienrj
damienrj merged commit b68c4ed into main Nov 19, 2026
91 checks passed
@damienrj
damienrj deleted the damienrj/cli-verified-profiles branch November 19, 2026 06:02
bostonaholic added a commit that referenced this pull request Nov 19, 2026
…ction-p

* origin/main: (200 commits)
  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)
  feat(mobile): add saved channel section filters (#8479)
  feat(relay): support community-scoped NIP-AR artifacts (#9650)
  feat(mobile): add a diagnostics test report and test crash to Settings (#9676)
  fix(pubsub): round the rate-limit retry hint up from PTTL (#9552)
  feat(mobile): add diagnostic reporting module with crash capture (#9613)
  fix(mobile): recover stuck read-state updates and stale Mark Read (#9492)
  test(relay): refresh the author's membership cache after the stray-h private channel insert (#9640)
  fix(mobile): name the cause of account-unavailable sign-in errors (#9628)
  perf(db): bound deep keyset history pages by the cursor timestamp (#9549)
  feat(cli)!: consistent channels list/get/search output (type, visibility, labels, real created_at) (#9617)
  ...

Signed-off-by: Matthew Boston <mboston@squareup.com>
bostonaholic added a commit that referenced this pull request Nov 19, 2026
…eaction-recipients

* origin/main: (72 commits)
  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)
  feat(mobile): add saved channel section filters (#8479)
  feat(relay): support community-scoped NIP-AR artifacts (#9650)
  feat(mobile): add a diagnostics test report and test crash to Settings (#9676)
  fix(pubsub): round the rate-limit retry hint up from PTTL (#9552)
  feat(mobile): add diagnostic reporting module with crash capture (#9613)
  fix(mobile): recover stuck read-state updates and stale Mark Read (#9492)
  test(relay): refresh the author's membership cache after the stray-h private channel insert (#9640)
  fix(mobile): name the cause of account-unavailable sign-in errors (#9628)
  perf(db): bound deep keyset history pages by the cursor timestamp (#9549)
  feat(cli)!: consistent channels list/get/search output (type, visibility, labels, real created_at) (#9617)
  ...

Signed-off-by: Matthew Boston <mboston@squareup.com>
wpfleger96 added a commit that referenced this pull request Nov 19, 2026
…c-spec-mobile

* origin/main:
  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)
  feat(mobile): add saved channel section filters (#8479)
  feat(relay): support community-scoped NIP-AR artifacts (#9650)
  feat(mobile): add a diagnostics test report and test crash to Settings (#9676)
  fix(pubsub): round the rate-limit retry hint up from PTTL (#9552)
  feat(mobile): add diagnostic reporting module with crash capture (#9613)

Signed-off-by: Will Pfleger <wpfleger@block.xyz>

# Conflicts:
#	mobile/test/features/activity/activity_page_test.dart
cshtdd added a commit that referenced this pull request Nov 19, 2026
…-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>
wpfleger96 added a commit to block/buzz-app that referenced this pull request Nov 20, 2026
Moves the block/buzz revision that `src-tauri` depends on from
`630922a9` to `e21606bf` (current block/buzz `main`).
`scripts/build-buzz-cli.mjs` builds the bundled `buzz` CLI from this
same revision, so the app now ships a CLI with these changes:

- [block/buzz#9738](block/buzz#9738): `channels
add-member` adds many members per event.
- [block/buzz#9752](block/buzz#9752): `users get
--name` leaves out archived users unless `--include-archived` is passed.
- [block/buzz#9653](block/buzz#9653): raw query
and publish commands.
- [block/buzz#9647](block/buzz#9647): verified
identity in `users get`.
- [block/buzz#9617](block/buzz#9617): consistent
`channels list/get/search` output (breaking).
- [block/buzz#9684](block/buzz#9684): shared
stars and mutes.

`Cargo.lock` changes one line: the `buzz-audio-client` source rev. Its
crate is byte-identical between the two revisions, so no other package
or dependency edge moves, and `cargo check --locked` passes in
`src-tauri`.

The new CLI adds a top-level `raw` command, so the desktop's legacy-CLI
guard (`src-tauri/src/legacy_cli_invocation.rs`) now recognizes `raw`
too, with a native regression case (`raw publish` with a private payload
that must not be echoed).

Nothing in this repo parses `buzz channels list/get/search` output. The
bundled-CLI smoke test (`scripts/test-buzz-cli.mjs`) reads only `--help`
command names, and `legacy_cli_invocation.rs` matches only the top-level
`channels` word.

---------

Signed-off-by: Will Pfleger <wpfleger@block.xyz>
Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>

This branch was successfully deployed

1 active deployment
codex-review — 24a8cc6b Deployed Nov 18, 2026 by damienrj via Run Codex Security Review #16135
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex-security-review-current The posted Codex security review matches its recorded range.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants