8000 fix(commands): keep /login to direct messages, as documented by geminixiang · Pull Request #192 · geminixiang/mikan · GitHub
[go: up one dir, main page]

Skip to content

fix(commands): keep /login to direct messages, as documented - #192

Merged
geminixiang merged 1 commit into
mainfrom
fix/login-dm-only
Oct 18, 2026
Merged

geminixiang merged 1 commit into
mainfrom
fix/login-dm-only

Conversation

@geminixiang
@geminixiang geminixiang commented Oct 18, 2026 •
Copy link
Copy Markdown
Owner

Problem

/login is documented as DM only (commands.mdx: "Open a 15-minute login/vault link. DM only."; the refusal text says the same; the Slack command description says "Store credentials in your private vault"). A Slack slash command typed in a channel bypassed that:

  1. Slack routes /pi-login from a channel as private_command, so its reply is ephemeral (slack/bot.ts).
  2. isPrivateConversation counts private_command as private, and /login checked only that.
  3. The link it opened targeted the vault of the channel's office (vaultConversationId is never set, so the conversation ID is used), which every caller in that channel shares, while the link labelled it "your vault".

So a person following the description in a channel would put personal credentials into a vault the whole channel's agent uses.

Fix

CommandContext gains directConversation (event.conversationKind === "direct"), and /login checks it instead of privateConversation. privateConversation keeps its meaning for choosing a private reply.

/pi-login typed in Before After
a DM link to the DM office's vault same
a channel (slash command) ephemeral link to the channel office's vault ephemeral refusal: use a DM
a channel (mention) refusal same
Discord / Telegram DM link same

Channel office development keys (ADR 0013) stay editable through the Admin portal. /login shared … and /login copy follow the same DM-only rule they were documented with.

Existing data

Existing vault contents are left alone.

Verification

  • New test refuses a slash command in a channel, whose reply is private but whose vault is the channel's fails on main (a link token is created) and passes here.
  • lint, fmt:check, knip, typecheck, build, full test suite (2,064 passed), duplication guard.
  • Slack E2E on this branch: run 39111022729 passed. It does not drive slash commands; Slack's chat.command needs a client token the QA users do not have, so the channel case was not reproduced on the real platform and is covered by the unit test.

CommandContext gains a required field; an embedder that builds contexts itself must set it.

A Slack slash command in a channel is typed private_command so its reply
is ephemeral, and /login treated that as private: the link it opened
wrote to the channel office's vault, which every caller there uses.
/login now checks that the conversation is direct.
@geminixiang
geminixiang merged commit 3fb851c into main Oct 18, 2026
6 checks passed
@geminixiang
geminixiang deleted the fix/login-dm-only branch October 18, 2026 17:14
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.

1 participant

0