fix: restrict user_mailbox shortcuts to user identity only#802
fix: restrict user_mailbox shortcuts to user identity only#802guo00110211 wants to merge 1 commit intolarksuite:mainfrom
Conversation
user_mailbox.* APIs do not support bot (TAT) access. Six shortcuts incorrectly declared AuthTypes ["user","bot"], causing the Lark API to return a misleading 'param is invalid' error when bot identity was used. Fix by restricting AuthTypes to ["user"] so CheckIdentity rejects bot identity before any API call is made.
|
guoyao.211 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughSix mail shortcuts ( ChangesMail shortcuts user-only authentication
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Six mail shortcuts (
+triage,+messages,+thread,+message,+template-create,+template-update) incorrectly declaredAuthTypes: ["user","bot"]but exclusively calluser_mailbox.*APIs, which only support user identity (UAT). When bot identity was used — via--as botor bot-only strict mode — the Lark server returned a misleadingparam is invaliderror. This PR restrictsAuthTypesto["user"]soCheckIdentityrejects bot identity before any API call is made, producing a clear actionable error.Changes
shortcuts/mail/mail_triage.go:AuthTypes["user","bot"]→["user"]shortcuts/mail/mail_messages.go: sameshortcuts/mail/mail_template_create.go: sameshortcuts/mail/mail_thread.go: sameshortcuts/mail/mail_template_update.go: sameshortcuts/mail/mail_message.go: sameshortcuts/mail/mail_auth_types_test.go: new unit testTestUserMailboxShortcutsRequireUserIdentitycovering all six shortcutsTest Plan
make unit-testpassedccr-config.jsonnot configured in test environmentlark-cli mail +triage --as bot→Error: --as bot is not supported, this command only supports: user(exit 1, no API call made)Related Issues
N/A
Summary by CodeRabbit
Bug Fixes
Tests