feat(gmail): add --gmail-no-send flag to block send operations#454
Open
veteranbv wants to merge 1 commit intosteipete:mainfrom
Open
feat(gmail): add --gmail-no-send flag to block send operations#454veteranbv wants to merge 1 commit intosteipete:mainfrom
veteranbv wants to merge 1 commit intosteipete:mainfrom
Conversation
Add a CLI-layer kill switch (--gmail-no-send / GOG_GMAIL_NO_SEND=1) that blocks all send operations in the gmail command group, regardless of OAuth scopes. gmail.modify is the right scope for an agent that needs to read, label, and create drafts, but it also permits send. Google provides no scope that grants modify-level access without send capability. This flag gives agent operators a hard invariant: deploy gog with GOG_GMAIL_NO_SEND=1 and send is impossible, full stop, regardless of what the agent is told or forgets. Blocked paths: send, gmail send, gmail drafts send, gmail autoreply. Enforced centrally in Execute() using the same pattern as enforceEnabledCommands — post-parse, pre-Run(), exit code 2.
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.
Motivation
gmail.modifyis the right OAuth scope for an agent that needs to read, label,and create drafts — but it also permits send. Google provides no scope that
grants modify-level access without send capability. This means there is no way
to give an AI agent read/label/draft access while maintaining a hard block on
send.
A prompt-level guardrail is not sufficient: if safety instructions are compacted
away during a long session, an agent operating on
gmail.modifycould sendemail on behalf of the user. The block needs to live in the binary itself, below
the instruction layer, where context compaction cannot reach it.
Closes #453
Summary
--gmail-no-sendglobal flag andGOG_GMAIL_NO_SENDenv varsend,gmail send,gmail drafts send,gmail autoreplyExecute()using the same pattern asenforceEnabledCommands— post-parse, pre-Run(), exit code 2gog gmail drafts createas thenon-send alternative
Test plan
TestIsGmailSendCommand— unit coverage for all send and non-sendcommand strings
TestGmailNoSendBlocksViaCLI— integration test: all four send pathsblocked via
--gmail-no-sendTestGmailNoSendAllowsNonSendCommands— non-send commands pass throughTestGmailNoSendEnvVar—GOG_GMAIL_NO_SEND=1blocks sendTestGmailNoSendNotSetAllowsSend— without flag, send is not blockedgo test ./...— full suite passes, no regressionsmake lint— clean