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 into
Conversation
|
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)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (5)
📝 WalkthroughWalkthroughSix mail shortcuts (message, messages, template-create, template-update, thread, triage) are restricted to user-only authentication. A new test runs each shortcut with ChangesMail shortcuts user-only authentication
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
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 |
7549ab6 to
86e6bbd
Compare
|
I have read the CLA Document and I hereby sign the CLA |
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.
86e6bbd to
c0c9434
Compare
guo00110211
left a comment
There was a problem hiding this comment.
Reviewed in CodeRabbit Review Stack
guo00110211
left a comment
There was a problem hiding this comment.
Reviewed in CodeRabbit Review Stack
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