Repository navigation
Apply the private-to-open rule in update_channel too - #9581
Conversation
The check comment now leads with the reason the helper and NOSTR.md use: opening publishes the existing history, so removed members count. The update_channel doc says it applies every ChannelUpdate field, visibility included. Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Logan Johnson <loganj@squareup.com>
The kind:9002 path refused opening a private channel that has, or had, another member, but the store helper update_channel applied visibility with no check. Only tests call it today, so nothing could reach the hole, but a future production caller would have skipped the rule. The check now lives in update_channel_on, the one write both paths use. update_channel takes the sender that the rule needs; every caller is a test and now passes one. A new Postgres test covers update_channel with a current member, a removed member, and a channel holding only the sender. The user-deletion executor doc now says the real purge must keep the membership row of a user whose messages it keeps: the check finds former members only through those rows. Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Logan Johnson <loganj@squareup.com>
🔐 Codex Security Review
Review SummaryOverall Risk: NONE
FindingsNo concrete security, correctness, or reliability findings were identified. Notes
Generated by Codex Security Review | |
jedwards27
left a comment
There was a problem hiding this comment.
🤖 :bot: Jude’s code review agent — recommend approval (agent comment under repository policy).
Reviewed: 63f1d6918c61e179733ff4d22e70033e74bc3482..c52412ab4a32e9804bbaa838b94018e3d07418e0, clean checkout; critical privacy boundary (private history becomes readable on opening).
Integrated finding: no introduced correctness or security defect identified; author action: none. The shared settings writer enforces the private→open guard for both direct update_channel and kind:9002 edits (crates/buzz-db/src/store/channel.rs:1121-1129,1320-1325,1774-1777). Visibility edits take the membership lock before reading former members (channel.rs:1094-1098,1241-1294); has_member_besides_sender_and_agents includes removed rows and fails conservatively on missing ownership (channel.rs:1662-1682). Signed kind:9002 still passes the event actor after relay authority checks (crates/buzz-relay/src/handlers/side_effects.rs:888-904). A refused edit rolls back the event and settings together. The new public-store Postgres test exercises current/removed other members and sender-only opening (channel.rs:2681-2765); existing relay tests cover other agent/owner and refusal behavior (crates/buzz-relay/src/handlers/edit_metadata_postgres_tests.rs:867-1064). Both independent review lenses agree with the source tracing.
Validation: git diff --check <base>..HEAD passed at the exact clean head. One independent reviewer ran scripts/test-postgres-test-discovery.sh successfully; another ran cargo test -p buzz-db --quiet (216 passed, 764 Postgres-ignored) and cargo test -p buzz-relay --no-run --quiet (passed). A local full buzz-relay suite was stopped after unrelated long-running tests; it is not a passing local run. The ignored Postgres regression and a live relay were not exercised locally because local Postgres/Docker was unavailable. Matching-head CI run 43924497097 completed successfully, including PostgreSQL tests, Rust unit/lint, and relay E2E; that is CI execution evidence, not a local reproduction.
Residual contracts / verification owners: docs/operator-user-deletion-executor.md:125-131 specifies a future purge must retain removed membership rows when retaining messages; the real purge is not implemented here. Its implementer must enforce and test that invariant when it ships. The public direct-store API relies on a caller-supplied authenticated sender (channel.rs:1101-1114); the first production adopter/reviewer must bind it to authenticated identity. Neither is a new blocker for this guard move. CI owns executed Postgres proof; no author rework is requested.
#9581 added a `sender` argument to `update_channel`. #8320's cross-community test landed in parallel and still calls it with three arguments, so main's buzz-db lib tests no longer compile. Pass the channel creator as the sender. The test only renames an open channel, so the private-to-open rule does not apply. Co-authored-by: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Luke Tornquist <tornquist@squareup.com>
… test #9581 added a sender parameter to Db::update_channel, but single_table_guard_channels_remain_tenant_bound_without_trigger still called it with three arguments, so buzz-db tests no longer compiled on main. Pass the channel's creator; both calls only rename the channel. Also mark the file's existing local dev database URL as test-only for the secrets scanner, as test_support.rs already does. Signed-off-by: Tom Brow <tomb@squareup.com> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz>
… test call) (#9616) ## Summary Main has two migrations numbered `0093`: - `0093_push_gateway_installation_platform.sql` from #9560 - `0093_drop_plain_sql_functions.sql` from #9598 The file names differ, so GitHub showed no conflict between the PRs. sqlx applies the first version-93 migration and then rejects the second as a changed migration 93. Every migrate run on main fails, including relay startup with auto-migration on. This PR moves #9598's migration to `0094`: - `git mv migrations/0093_drop_plain_sql_functions.sql migrations/0094_drop_plain_sql_functions.sql`. The SQL is unchanged. - `embedded_migrator_contains_consolidated_initial_schema` now expects 94 migrations, with the function drop at version 94. - The Postgres test is renamed to `migration_0094_drops_plain_sql_functions`. It finds the migration by description, so its logic is unchanged. - `docs/trigger-retirement-deployment.md` now names `0094`. #9560's `0093` keeps its number. It reached main first and may already be applied on deployments that auto-migrate. ## Second break on main: `update_channel` call sites Main's buzz-db lib tests also stopped compiling. #9581 added a `sender` argument to `update_channel`, and #8320's cross-community test (`deletion.rs`) landed in parallel with the old three-argument call. This PR passes the channel creator as the sender. The test only renames an open channel, so the private-to-open rule does not apply. ## Deployments No deployment has applied #9598's `0093`: no image built from main after #9598 has rolled out yet. A database that applied #9560's `0093` applies `0094` next. Do not promote any image built from `4e8f8365` (the #9598 merge) or later until this PR merges. ## What got simpler Nothing. This is a renumber and a test call fix only. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Luke Tornquist <tornquist@squareup.com> Co-authored-by: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…e-recovery * origin/main: (60 commits) Clean up account records and refresh member lists (#9364) perf(mobile): save own thread interest once per unread catch-up (#9614) buzz-db: fix main (renumber the function drop to 0094, update_channel test call) (#9616) feat(relay): name the agent whose add policy refuses a DM (#9601) buzz-db: drop the community_deletion_lock_key and profile_name_fields functions (contract) (#9598) fix(deps): clear chrono, humantime and zip advisories from the dependency policy (#9609) docs: define mobile diagnostic reporting (#9600) build(mobile): link iOS plugins through Swift Package Manager (#9597) feat(push-gateway): enroll Android installations and send FCM wakes (#9560) perf(mobile): cache and animate custom emoji in the iOS picker (#9479) fix(ios): end each bold or strikethrough run at its first closing marker (#9559) Apply the private-to-open rule in update_channel too (#9581) Add real content cleanup for users and agents (#9363) Keep transparency in mobile avatar photo crops (#9319) fix(mobile): read presence for a person shown again while still covered (#9595) buzz-db: check membership, agent-owner and channel references in app code (#9404) buzz-db: enforce five single-table guards in app writers (phase 1) (#8320) docs(mobile): add REVIEWING.md with mobile review principles (#9298) buzz-db: check workflow references in app code before FK retirement (#9399) fix(relay): enforce channel owner precedence (#9592) ... Signed-off-by: Will Pfleger <wpfleger@block.xyz> # Conflicts: # mobile/lib/features/channels/channel_actions_sheet.dart # mobile/lib/shared/read_state/read_state_manager.dart
…c-spec-mobile * origin/main: (37 commits) buzz-db: drop the five single-table guard triggers (BUZZ-318 phase 2) (#9398) push-gateway: lock expired installations before reaping (#9627) Retire the 0032 roster trigger in migration 0095 (#8696) fix(db): hard-delete superseded relay-signed lists (#9586) Add community-scoped user and agent profile cleanup (#9580) fix(sdk): timestamp channel messages with millisecond offsets (#9548) Check product_feedback's community in the writing transaction (#9608) buzz-db: stop calling the dropped lock-key function in SQL (#9615) Clean up account records and refresh member lists (#9364) perf(mobile): save own thread interest once per unread catch-up (#9614) buzz-db: fix main (renumber the function drop to 0094, update_channel test call) (#9616) feat(relay): name the agent whose add policy refuses a DM (#9601) buzz-db: drop the community_deletion_lock_key and profile_name_fields functions (contract) (#9598) fix(deps): clear chrono, humantime and zip advisories from the dependency policy (#9609) docs: define mobile diagnostic reporting (#9600) build(mobile): link iOS plugins through Swift Package Manager (#9597) feat(push-gateway): enroll Android installations and send FCM wakes (#9560) perf(mobile): cache and animate custom emoji in the iOS picker (#9479) fix(ios): end each bold or strikethrough run at its first closing marker (#9559) Apply the private-to-open rule in update_channel too (#9581) ... Signed-off-by: Will Pfleger <wpfleger@block.xyz>
Summary
update_channel, could still open such a channel.update_channeltakes the authenticated sender so it can decide the rule. Today only tests callupdate_channel, so nothing user-visible changes; the gap is closed before any real caller arrives.Details
apply_channel_metadata_eventintoupdate_channel_on, which both paths call. It still runs under the membership lock that a visibility change takes, so members cannot be added between the check and the commit.auto_jointo true now gets theauto_joinrefusal instead of the private-to-open one, because theauto_joincheck now runs first. Both refuse, and nothing is stored either way.update_channelis a test, and each now passes the channel owner as sender.Related issue
Follow-up to #9307 (review notes on its store gap and on purge).
Testing
update_channel_refuses_opening_a_private_channel_with_other_members: opening fails for both the owner and the other member as sender, while the other member is current and after they are removed, and the channel stays private. A channel that holds only the owner opens.private_to_open_needs_no_other_membersstill passes. Both tests fail when the check is removed.buzz-review-completed
🤖 Generated with Claude Code