Repository navigation
fix(security): bind /approve plan execution to verified comment and prune excess MCP tools - #541
Merged
DavidAPierce merged 7 commits intoNov 19, 2026
Conversation
…rune excess MCP tools - Verify @gemini-cli /approve comments deterministically in action.yml (scripts/resolve-approved-plan.mjs) before launching Gemini CLI with contents: write, requiring explicit comment ID/URL binding, verifying approver association and bot authorship, rejecting un-hashed edits and post-approval mutations, and writing .gemini/approved_plan.json. - Exclude mutable issue title/description from plan-execute context.json, migrate shipped .github/commands/gemini-{invoke,plan-execute}.toml templates from !{echo $...} shell interpolation to @{.gemini/...}, and configure .geminiignore and .git/info/exclude safely. - Remove push_files, delete_file, fork_repository, issue_read, list_issues, and search_issues from plan-execute MCP includeTools and automatically prune them from .gemini/settings.json for @v0 consumers. - Pin action references to commit hashes in modified workflows, synchronize examples via generate-examples.sh, and add 29 Vitest security tests plus .github/workflows/ci.yml.
elberthc-byte
requested review from
ChrisGe4,
bdmorgan,
cocosheng-g and
haroonc
November 17, 2026 22:49
…pat, and symlink checks
- Use local './' action with default_branch checkout in self-hosted gemini-{invoke,plan-execute}.yml and update generate-examples.sh so post-merge runs use the repo's own action.yml without checking out untrusted fork PR trees on review events.
- Synthesize .gemini/context.json from legacy env vars in prepareContextAndGeminiIgnore for existing @v0 gemini-invoke consumers.
- Harden segment-by-segment/dangling symlink checks, git worktree info/exclude support, fail-closed comment.issue_url and dot-segment slug checks, excludeTools fallback (including merge_pull_request), Vitest v4 maxWorkers config, and add unit/E2E tests.
… and symlink guards
…xample generator rule
DavidAPierce
approved these changes
Nov 18, 2026
ivanporty
approved these changes
Nov 18, 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
Hardens the
@gemini-cli /approveplan-execution flow against Time-of-Check to Time-of-Use (TOCTOU) comment substitution, post-plan issue-body injection, and over-privileged MCP tool grants:action.yml+scripts/resolve-approved-plan.mjs): Replaces LLM-driven"find a latest plan titled 'AI Assistant: Plan of Action'"comment lookup with a deterministic verification step inaction.ymlbeforegemini --yolostarts. Approval now requires binding to a specific plan comment ID or URL (@gemini-cli /approve <comment-url-or-id>), verifies approver association (OWNER,MEMBER,COLLABORATOR), verifies bot authorship (EXPECTED_PLAN_AUTHORwith@v0App/PAT fallback), rejects edited comments and post-approval comments, fetches the target comment directly (GET /repos/{owner}/{repo}/issues/comments/{comment_id}), verifiescomment.issue_url, and writes.gemini/approved_plan.json(failing closed before Gemini CLI runs if any check fails).DESCRIPTION) Injection: Excludes mutabletitleanddescription(issue.body) from.gemini/context.jsonduringgemini-plan-execute(retaining routing fieldsevent_name,is_pull_request,issue_number, andrepositoryonly), migrates shipped.github/commands/gemini-{invoke,plan-execute}.tomltemplates from!{echo $...}shell expansion to@{.gemini/context.json}/@{.gemini/approved_plan.json}, and updates.geminiignoreso.gitignoreentries for.gemini/do not hide those files from Gemini CLI.push_files,delete_file,fork_repository,issue_read,list_issues, andsearch_issuesfrommcpServers.github.includeToolsingemini-plan-execute.yml(both.github/workflows/andexamples/workflows/), and automatically prunes those tools (plusmerge_pull_requestand dottedissue_read.*, populatingexcludeTools) from.gemini/settings.jsonat action runtime for existing@v0consumers.Verification
actionlint,yamllint,zizmor,ratchet,shellcheck).github/andexamples/workflows/gemini-assistant/templatesnpm testin.github/workflows/ci.yml), isolated from ambient GitHub Actions runner environment variablesexamples/workflows/gemini-assistant/README.md)