Skip to content

fix(core): handle nested plan files by resolving paths correctly#24854

Draft
mahimashanware wants to merge 1 commit intoworktree-con-plan-bugfrom
fix/nested-plan-files-v2
Draft

fix(core): handle nested plan files by resolving paths correctly#24854
mahimashanware wants to merge 1 commit intoworktree-con-plan-bugfrom
fix/nested-plan-files-v2

Conversation

@mahimashanware
Copy link
Copy Markdown
Contributor

Summary

This fixes a bug where path.basename was incorrectly stripping directory structures from plan files (e.g., trying to write to plans/nested/file.md would incorrectly write to plans/file.md). By using path.resolve and verifying with isSubpath, nested files are now handled securely and correctly.

Details

  • Replaced path.basename logic in edit.ts, write-file.ts, and planUtils.ts with proper path resolution.
  • Updated the path boundary validations to ensure malicious paths still fail securely.

This fixes a bug where path.basename was incorrectly stripping directory structures from plan files (e.g., trying to write to plans/nested/file.md would incorrectly write to plans/file.md). By using path.resolve and verifying with isSubpath, nested files are now handled securely and correctly.
@gemini-cli
Copy link
Copy Markdown
Contributor

gemini-cli bot commented Apr 7, 2026

Hi @mahimashanware, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this.

We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines.

Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed.

Thank you for your understanding and for being a part of our community!

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

🧠 Model Steering Guidance

This PR modifies files that affect the model's behavior (prompts, tools, or instructions).

  • ⚠️ Consider adding Evals: No behavioral evaluations (evals/*.eval.ts) were added or updated in this PR. Consider adding a test case to verify the new behavior and prevent regressions.
  • 🚀 Maintainer Reminder: Please ensure that these changes do not regress results on benchmark evals before merging.

This is an automated guidance message triggered by steering logic signatures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant