Skip to content

Answer which named people can read a channel - #9603

Open
morgmart wants to merge 3 commits into
morganm/artifact-assigneesfrom
morganm/who-can-read
Open

morgmart wants to merge 3 commits into
morganm/artifact-assigneesfrom
morganm/who-can-read

Conversation

@morgmart

@morgmart morgmart commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #9602 (assignees). Review only the last three commits; the base branch carries the rest of the stack.

What

The app can ask the relay which people can read a place, instead of guessing from member lists the viewer may not be allowed to read. Part 2 of the task refusals work (the "can't see this task anymore" line) uses this answer.

  • Asking. POST /query with exactly [{"access":"readers","channel":<channel id>,"pubkeys":[...]}]: one lowercase channel ID and 1 to 100 distinct lowercase hex pubkeys. Any other shape is refused with 400.
  • Answer. One {"pubkey","read"} entry per person, in request order. Nobody is left out, so false always means "cannot read".
  • Same check as assignees. Reading is judged by channel_access::can_read, the check a task's assignees meet: member rows, open channels, and the parents under parent_access. A conversation follows its home.
  • Banned people read nothing. Someone banned from the community, or an agent whose owner is, counts as not reading anywhere, open channels included. The rule lives in the shared check, so a banned person also can't be assigned. A timeout doesn't change reading. A banned asker gets the relay's usual blocked: you are banned refusal, the same answer feat(relay): answer what a viewer may do in channels, and say when to ask again #9582 gives.
  • Who may ask. Only a signer who can read the channel. Otherwise the request is refused with 403 not-allowed: the signer cannot read this channel. A missing or deleted channel gets the identical refusal, so it can't be used to probe whether a private channel exists. A refusal is never a list of falses.
  • Disclosure, stated in NOSTR.md as intended. Someone who can read a channel can learn that a named person reads it through a parent the asker isn't in, such as a private project. It answers only for channels the asker can already read, and never says how or why someone can't read.
  • Ban disclosure, also stated as intended. An asker who sees a person in the channel's member list, but is told they can't read it, can infer a ban. The relay never states the reason for someone else.
  • A lookup failure fails the whole request with 503. The answer is a snapshot; ask again after a kind:20004.
  • NIP-11 advertises buzz-channel-readers.

Testing

  • Postgres test a_reader_learns_who_else_can_read_a_place, through POST /query:
    • Everyone named gets an entry in request order: an outsider, a project member, a project guest, a child member and the owner.
    • A child member outside the project gets the same answer, which is the stated disclosure.
    • A task conversation follows its home.
    • parent_access none takes the project's readers away.
    • A removal is seen at once.
    • An outsider and a missing channel get the same 403 body.
    • An asker who loses access between two asks gets the refusal, not falses.
  • Postgres tests a_banned_person_reads_nothing and a_banned_person_cannot_be_assigned:
    • A banned person and their agent read nothing, an open channel included.
    • A timed-out person still reads, may ask, and can be assigned.
    • A banned asker is refused with the ban reason.
    • Lifting the ban restores them.
  • A unit test for the exact request shape.
  • Mutation checks: skipping the asker check, leaving out people who can't read, ignoring the parents, answering an unreadable place with an empty list, and dropping the ban rule each turn a test red.
  • The full relay and database Postgres suite passes (1550). Clippy is clean.

🤖 Generated with Claude Code

morgmart and others added 3 commits November 17, 2026 00:12
POST /query with {"access":"readers","channel":..,"pubkeys":[...]} says,
for up to 100 people, whether each can read the channel, by the check a
task's assignees meet: member rows, open channels, and the parents under
parent_access. Everyone named gets an entry, so false always means
"cannot read".

Only a signer who can read the channel may ask. Otherwise, and for a
missing or deleted channel alike, the request is refused with 403
"not-allowed", never answered with a list of falses. NOSTR.md states the
disclosure this allows: an asker learns that a named person reads the
channel through a parent the asker isn't in. NIP-11 advertises
buzz-channel-readers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
The shared read check, which both the assignee rule and the readers
answer use, now says false for someone banned from the community, or an
agent whose owner is, open channels included. A banned person can no
longer be assigned to a task they can't open, and the readers answer
agrees with the ban refusal they get when they ask for themselves. A
timeout leaves reading alone. NIP-AR and NOSTR.md state the rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
The readers answer now documents, as intended, that a ban can be
inferred by comparing a "can't read" with the channel's member list, and
that the relay never states the reason for someone else. The sentence on
banned askers moves after the missing-channel refusal it was splitting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
@morgmart
morgmart marked this pull request as ready for review November 17, 2026 19:04
@morgmart
morgmart requested a review from a team as a code owner November 17, 2026 19:04

@jedwards27 jedwards27 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 :bot: Jude’s code review agent — blocking finding (GitHub comment review under repository agent-review policy).

Reviewed 2bedcb6a231b36a646f18276d4854ff92b8d86f5..ac63e76f5ed59f43ac60f6e9f7154b46ad6ebe5d at a clean checkout. Risk: high, because this is a newly advertised authorization answer for task readers. Recommended verdict: changes needed.

P1 — Include community admission in the named-reader verdict. crates/buzz-relay/src/handlers/channel_access.rs:152–181,200–215 runs can_read for each named key, checking bans and channel/parent/open access, but not relay admission. On require_relay_membership communities, removing a human from relay_members leaves their channel row intact (crates/buzz-db/src/store/relay_members.rs:285–307). This endpoint then reports read:true for that removed person (and for arbitrary nonmembers of an open channel), although their own /query request fails relay_membership_required at crates/buzz-relay/src/api/bridge.rs:1701–1725 via crates/buzz-relay/src/api/mod.rs:267–327. This defeats the endpoint’s stated “who can read”/task-refusal purpose. Author action: make named-reader results account for effective community admission on closed relays, and add a real POST /query regression for a revoked relay member who retains a private-channel row and an unadmitted key in an open channel. Preserve the request-bound NIP-FI/NIP-OA owner-delegation semantics; a bare agent pubkey is not equivalent to a direct roster row. Verification owner: PR author for fix/regression; reviewer for next-head integration.

Non-blocking: NOSTR.md:387–388 calls the result a “snapshot.” Its entries are concurrent reads, as with the existing multi-channel answer (handlers/channel_access.rs:90–108); this protocol does not promise the atomic/consistent cut that docs/nips/NIP-AR.md:184–198 explicitly requires for sync. Clarifying that this is a re-queryable, non-atomic observation would reduce ambiguity, but a transaction across 100 keys is not required for this PR.

Validation: clean HEAD=ac63e76f5ed59f43ac60f6e9f7154b46ad6ebe5d, git diff --check 2bedcb6a...HEAD passed after Hermit activation. Exact-head CI passed, including PostgreSQL tests, relay E2E, Rust unit/lint, and cross-compile. Source-traced the new HTTP reader route, channel predicate, roster revocation, and request admission. No independent local closed-relay run or native app journey was performed; this diff introduces a relay API and has no changed UI. The missing closed-roster regression is an author-owned defect, not a tooling-only hold. Documented parent/ban inference is accepted design, not an additional privacy finding.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants