fix(channel): use require_caller in DM gate (dev-mode regression) #41
No reviewers
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_collab!41
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/dm-create-dev-mode-regression"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Closes #40.
PR #32 introduced a dev-mode regression in
channel.createfor DMs. The gate's first line —let caller = input.caller_id.ok_or(RpcError::Unauthenticated)?;— short-circuits before theis_dev_mode()bypass on the workspace-membership probe, and in the typical dev-mode flowcaller_idisNonebecausemain.rs::handle_rpc(the dev-mode shim at lines 491-501) explicitly dropsX-Hero-Userandchat-app.js::startDmdoesn't passcaller_idin params.Symptom: every DM picker click on a
--auth-mode=devinstance logsAuthentication requiredand the DM never creates.Fix
Use
require_callerinstead of the manualok_orshape. It's the canonical helper already used bychannel.rs::member_addfor the same auth-mode-aware gate logic:require_callerreturns:Ok(Some(cid))— caller present, run gateOk(None)— dev mode no caller, skip gate (this is the case the prior code missed)Err(Unauthenticated)— proxy mode no caller, fail closedTruth table
:9988:9997:9997:9988Test plan
-32001 Authentication required(verified via direct rpc.sock POST without header)viewer_test@example.com: 200 OK, DM created withcreated_by=2(verified via curl through:9997)cargo build --release -p hero_collab_server+ reinstall on138.201.206.39Why this is the proper fix
require_caller(one canonical helper, single auth-mode-aware contract) instead of scattering manualis_dev_mode()checks.channel.rs::member_add— no new convention introduced.require_calleronce.🤖 Generated with Claude Code