Skip to content

Fix ag-ask slash command shell injection - #82

Closed
study8677 wants to merge 1 commit into
mainfrom
codex/fix-ag-ask-command-shell-injection-vulnerability
Closed

Fix ag-ask slash command shell injection#82
study8677 wants to merge 1 commit into
mainfrom
codex/fix-ag-ask-command-shell-injection-vulnerability

Conversation

@study8677

Copy link
Copy Markdown
Owner

Motivation

  • Close a high-severity command-injection vulnerability where the /antigravity:ag-ask slash command granted Bash and executed a shell line that interpolated raw $ARGUMENTS, allowing shell metacharacters and command substitution to run as the local user.
  • Restore the safer structured call path that passes the question as a structured argument to the Antigravity MCP server rather than via an interpolated shell string.

Description

  • Replaced allowed-tools: ["Bash"] with allowed-tools: ["mcp__plugin_antigravity_antigravity__ask_project"] in commands/ag-ask.md to restrict the command to the MCP tool.
  • Removed the raw Bash invocation AG_ASK_TIMEOUT_SECONDS="${AG_ASK_TIMEOUT_SECONDS:-120}" ag-ask "$ARGUMENTS" --workspace "$PWD" and the related CLI-install guidance from the command definition.
  • Added guidance to prefer the MCP tool and to instruct users to restart the Claude Code/Antigravity MCP server if the tool is unavailable, preserving the command intent without exposing shell expansion.

Testing

  • No automated tests were executed as part of this change.

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 41c7507a01

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread commands/ag-ask.md
---
description: Ask a question about the current project's codebase via the antigravity knowledge hub. / 通过 antigravity 知识库询问当前项目代码。
allowed-tools: ["Bash"]
allowed-tools: ["mcp__plugin_antigravity_antigravity__ask_project"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep a non-MCP execution path for /ag-ask

Restricting allowed-tools to mcp__plugin_antigravity_antigravity__ask_project makes the slash command unusable in installs where ag-mcp is not registered or connected, even though the project currently documents MCP as optional (see README.md and INSTALL.md) and previously supported a CLI fallback. In this state, /ag-ask has no runnable tool in non-MCP environments and the existing packaging expectation (engine/tests/test_plugin_packaging.py::test_slash_commands_run_cli_without_mcp_tools) already fails, so this change introduces a functional regression for users not using MCP.

Useful? React with 👍 / 👎.

Comment thread commands/ag-ask.md
> $ARGUMENTS

Use Bash:
If the MCP tool is not available or not connected, tell the user to restart Claude Code once so the Antigravity MCP server loads, then rerun the command. Do not diagnose missing MCP tools as an LLM key problem.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Replace Claude-only restart guidance with host-agnostic recovery

The new fallback path hard-codes “restart Claude Code” when the MCP tool is missing, but this command is shipped for both Claude and Codex hosts, and missing-tool cases in Codex or in unregistered MCP setups are not resolved by restarting Claude Code. This creates a dead-end troubleshooting path where users can repeatedly retry without ever being directed to a valid setup or fallback route.

Useful? React with 👍 / 👎.

Comment thread commands/ag-ask.md
---
description: Ask a question about the current project's codebase via the antigravity knowledge hub. / 通过 antigravity 知识库询问当前项目代码。
allowed-tools: ["Bash"]
allowed-tools: ["mcp__plugin_antigravity_antigravity__ask_project"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use the configured MCP server name in tool allowlist

The command hard-codes mcp__plugin_antigravity_antigravity__ask_project, which does not match the repo’s documented manual MCP setup where the server is named antigravity (docs/examples/antigravity.mcp.json). For that setup, the callable tool name is mcp__antigravity__ask_project, so users who correctly configure MCP via the documented .mcp.json path will still have this command target a non-existent tool.

Useful? React with 👍 / 👎.

@study8677 study8677 closed this Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant