Gemini CLI path traversal bug: crafted tag could delete files outside checkpoint dir

ManoharPaturi · ghdev · 2026-09-27

A PR (#29521) for google-gemini/gemini-cli fixes a path traversal vulnerability: getCheckpointPath and deleteCheckpoint built the legacy fallback path using the raw tag, and path.join normalizes .. segments away. A tag like x/../../secret could resolve to a file outside the checkpoint directory — /chat delete <tag> would unlink it, and checkpoint load would return its contents.

Fix: a new isInsideCheckpointDir helper ensures the legacy raw path is only used when it still resolves inside the checkpoint directory (path.resolve + prefix check), so traversal tags simply miss with normal ENOENT semantics. Applied at both legacy uses: the load/exists fallback and the backward-compat unlink. Flat legacy tags behave exactly as before. Same bug class as #28699 (a2a-server restore path); closes #29191. Regression tests included; logger suite passes 43/43.

Original post →

More from coding & agent

coding & agent channel →