Skip to content

[Bug bounty] Antigravity uninstall silently skips cleanup for apostrophe home paths #254

Description

@aikinley

Stage

uninstall

Coding agent

OpenAI Codex

Coding agent version

Codex desktop; Monk plugin v0.1.54 (2a4f9cf)

Repro steps

  1. Check out v0.1.54 on a POSIX shell where python3 is available and jq is absent, so remove_antigravity_mcp takes its Python fallback.

  2. Set HOME to an isolated path containing an apostrophe, for example .../home/O'Connor.

  3. Create $HOME/.gemini/config/mcp_config.json with both Monk and an unrelated server:

    {
      "mcpServers": {
        "monk": {"serverUrl": "http://127.0.0.1:7419/mcp"},
        "preserved": {"serverUrl": "http://127.0.0.1:9999/mcp"}
      },
      "preserved": {"value": "still here"}
    }
  4. Run scripts/uninstall-monk-agent.sh --yes with MONK_AGENT_HOME and MONK_AGENT_INSTALL_DIR also pointing inside that isolated home.

  5. Inspect the config after the command reports completion.

I reproduced this with a network-free regression that isolates HOME and PATH, forces the Python branch, and asserts that only mcpServers.monk is removed. The current release fails deterministically:

monk-agent uninstall complete.
Traceback (most recent call last):
  File "<string>", line 7, in <module>
AssertionError

The config is unchanged and still contains mcpServers.monk.

Expected behavior

The official uninstaller removes only the Monk-owned MCP entry, preserves unrelated config, and reports completion.

Actual behavior

remove_antigravity_mcp interpolates $mcp_cfg directly into generated Python source:

with open('$mcp_cfg') as f:
...
with open('$mcp_cfg', 'w') as f:

The apostrophe terminates the Python string and produces a SyntaxError. The shell then swallows that failure with 2>/dev/null || true, prints monk-agent uninstall complete., and leaves a dead Monk MCP registration pointing at the removed companion.

I validated the minimal fix locally: pass the config path as a sys.argv value and use that variable in both open calls. The new regression then passes, as do sh -n scripts/uninstall-monk-agent.sh and git diff --check.

Collision check

Severity (your guess)

minor

The uninstall claims success but leaves persistent global host configuration behind. Later Antigravity sessions can keep trying to connect to a server the same uninstall just removed. Installing jq or avoiding an apostrophe in the home path works around it.

OS

Windows 11 with Git Bash for the isolated POSIX regression; the vulnerable shell code is shipped for macOS and Linux.

monkd version

Not involved; this is local plugin cleanup.

Target cloud

None; network-free local source fixture.

Integration

Google Antigravity MCP registration cleanup

Fix PR

#267 adds the current-release red-to-green regression and the validated fix across both shipped POSIX uninstaller mirrors.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions