fix: remove sensitive send scope from reply and forward shortcuts#92
Merged
infeng merged 2 commits intolarksuite:mainfrom Mar 30, 2026
Merged
Conversation
Remove mail:user_mailbox.message:send from the required scopes of +reply, +reply-all, and +forward shortcuts. This scope is sensitive and may not be granted, while these shortcuts default to saving drafts and do not strictly require it.
chanthuang
previously approved these changes
Mar 30, 2026
Add validateConfirmSendScope() to check mail:user_mailbox.message:send in the Validate phase when --confirm-send is used, preventing the "draft created but send failed" scenario. Add regression tests for +reply, +reply-all, and +forward.
chanthuang
approved these changes
Mar 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
mail:user_mailbox.message:sendscope is sensitive and maynot be granted
in all environments. Since
+reply,+reply-all, and+forwarddefault to
saving drafts (which only requires
message:modify), this scopeshould not be
a prerequisite for using these shortcuts. When
--confirm-sendisused, the
send scope is now validated dynamically in the Validate phase,
preventing the
"draft created but send failed" scenario.
Changes
mail:user_mailbox.message:sendfrom staticScopesinmail_reply.go,mail_reply_all.go, andmail_forward.govalidateConfirmSendScope()inhelpers.go— when--confirm-sendis set,checks the token for send scope and fails early with a clear
hint if missing
mail_shortcut_test.golark-mail-reply.mdskillreference
+reply,+reply-all,+forwardwith
--confirm-sendwhen token lacks send scopemail_send.goretains the scope as it is explicitly designedfor sending
Test Plan
go test ./shortcuts/mail/...all passedTestConfirmSendMissingScopeReply—+reply --confirm-sendreturns
missing_scopeTestConfirmSendMissingScopeReplyAll—+reply-all --confirm-sendreturnsmissing_scopeTestConfirmSendMissingScopeForward—+forward --confirm-sendreturnsmissing_scope+reply,+reply-all,+forwarddraft mode works without send scope granted
Related Issues
N/A