Commit Graph

489 Commits

Author SHA1 Message Date
Mahima Shanware df8f1a8f03 fix: address review bot feedback on concurrency and error handling
- Reverted the 'isIdle' guard in AppContainer.tsx to ensure slash commands entered while the agent is busy are correctly processed or queued, preventing them from falling through as regular chat text.
- Enhanced the physical path validation in config.ts to gracefully handle 'mkdirSync' failures (e.g. EACCES). The CLI will now log a warning and return the lexically-validated path instead of throwing a misleading 'Security violation' via 'resolveToRealPath'.
2026-04-07 16:40:31 +00:00
Mahima Shanware 7c0cfd53df fix(core): gracefully degrade global config dir path validation on EACCES
If the user's home directory or global `.gemini` config directory has
restrictive permissions that prevent `realpathSync` from succeeding, the
CLI should not crash. Instead, it now gracefully degrades by omitting
the global config directory from the valid security boundaries for plan
directories, allowing the CLI to continue operating securely within the
project root.
2026-04-07 16:40:31 +00:00
Mahima Shanware 432df7982c fix: address final review feedback on context resets and pre-creation path validation 2026-04-07 16:40:31 +00:00
Mahima Shanware 35fd166bce fix(core): ensure global gemini dir resolution is crash-safe during plan validation 2026-04-07 16:40:31 +00:00
Mahima Shanware e42b762553 fix(core): ensure path validation always executes even if mkdirSync fails 2026-04-07 16:40:31 +00:00
Mahima Shanware 7ab4c3d61f fix(core,cli): resolve TOCTOU, concurrency, and performance regressions in plan resolution 2026-04-07 16:40:31 +00:00
Mahima Shanware ded474c2d0 fix(core): fail-closed security for plan directory TOCTOU
Resolves security review findings:
- Reordered resolveToRealPath before mkdirSync to fully eliminate TOCTOU risks with symlink injection.
- Fail closed by re-throwing 'Security violation' errors instead of swallowing them.
- Replaced lint-disabler with process.stderr.write for legitimate fallback warnings.
- Used direct context string as LRUCache key to avoid collision with an extension potentially named 'default'.
2026-04-07 16:35:24 +00:00
Mahima Shanware 3256b16039 fix(core): mitigate TOCTOU vulnerability in plan directory creation
This change addresses a critical security review finding regarding a Time-of-Check to Time-of-Use (TOCTOU) vulnerability.

Previously, plan directory paths were validated using `isSubpath` before creation. However, an attacker could potentially replace a path component with a symlink pointing outside the project root exactly between validation and creation.

By resolving the physical path *after* `fs.mkdirSync` using `resolveToRealPath` and then verifying it with `isSubpath`, we ensure that the actual directory created on disk resides safely within the workspace. Any violation results in a warning, and the malicious path is prevented from being added to the agent's `workspaceContext`.
2026-04-07 16:35:24 +00:00
Mahima Shanware 5e89760856 perf(core): optimize plan directory resolution with LRUCache and cached project root
This commit addresses the final performance and usability review comments:

- **Performance:** Introduced `LRUCache` for `plansDirCache` and `initializedPlanDirs` to prevent redundant, synchronous filesystem calls to `Storage.getPlansDir` on every turn.
- **Performance:** Cached the resolved `realProjectRoot` in the `Storage` constructor, eliminating expensive synchronous symlink resolution calls during active command routing.
- **Usability:** Replaced hard `throw` with `console.warn` when `fs.mkdirSync` fails (e.g., `EACCES`, `EEXIST`), allowing the CLI to gracefully degrade and continue functioning rather than crashing the entire process.
- **Validation:** Updated `config.test.ts` to verify the exact warning messages emitted during filesystem failures.
2026-04-07 16:35:24 +00:00
Mahima Shanware a5c2bf81f4 fix(core): remove redundant ENOENT fallback in getPlansDir to fix traversal vulnerability
This removes the insecure ENOENT fallback in `Storage.getPlansDir` that could be exploited to bypass the `isSubpath` check via symlinks. The fallback was unnecessary because the underlying `resolveToRealPath` function (via `robustRealpath`) was recently updated to gracefully handle and resolve symlinks for non-existent target paths.
2026-04-07 16:35:24 +00:00
Mahima Shanware b5d92caf89 fix(core): handle plan dir EEXIST safely and rely on mkdir idempotency
This addresses a potential TOCTOU vulnerability and edge case identified during review. The redundant `fs.existsSync` check in `getPlansDir` has been removed, allowing `fs.mkdirSync(..., { recursive: true })` to safely handle directory idempotency.

By relying directly on `mkdirSync`, we ensure that if a non-directory file already exists at the target path, the system will correctly throw an `EEXIST` error rather than silently treating the file as a directory and crashing later during workspace registration.
2026-04-07 16:35:23 +00:00
Mahima Shanware 81c74e1483 perf(core): cache initialized plan directories
Adds caching to getPlansDir to avoid redundant synchronous disk I/O and repeated workspace context registrations.
2026-04-07 16:35:23 +00:00
Mahima Shanware bdf90e9985 feat(core): dynamic MRU plan directory resolution and lazy initialization
Introduces active extension context tracking in config to support dynamic switching of plan directories. Resolves circular dependency in storage by deferring plan directory creation until on-demand use, preventing ENOENT errors on non-existent paths.
2026-04-07 16:34:08 +00:00
Gal Zahavi 65024d4538 fix(core): ensure global temp directory is always in sandbox allowed paths (#24638)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-04-04 00:23:27 +00:00
Jacob Richman 1f5d7014c6 feat(ui): enable "TerminalBuffer" mode to solve flicker (#24512) 2026-04-03 00:39:49 +00:00
Gal Zahavi 1ae0499e5d fix(core): pass includeDirectories to sandbox configuration (#24573) 2026-04-02 23:34:12 +00:00
Sandy Tao 63cc363606 feat(core): scope subagent workspace directories via AsyncLocalStorage (#24445) 2026-04-02 16:33:08 +00:00
joshualitt e0044f2868 feat(core): Land ContextCompressionService (#24483) 2026-04-02 16:22:04 +00:00
Gaurav beff8c91aa fix(browser): handle computer-use model detection for analyze_screenshot (#24502) 2026-04-02 15:05:21 +00:00
Coco Sheng f510394721 Implement background process monitoring and inspection tools (#23799) 2026-04-02 15:01:00 +00:00
Adam Weidman b5f568fefe feat(config): add experimental.adk.agentSessionNoninteractiveEnabled setting (#24439) 2026-04-01 20:41:38 +00:00
Sri Pasumarthi 6b303a13eb fix(acp) refactor(core,cli): centralize model discovery logic in ModelConfigService (#24392) 2026-04-01 18:03:30 +00:00
joshualitt 377e834e03 refactor(core): Unified context management settings schema (#24391) 2026-04-01 17:24:45 +00:00
Emily Hedlund 6a8a0d4faa feat(core): populate sandbox forbidden paths with project ignore file contents (#24038) 2026-04-01 16:27:55 +00:00
Sri Pasumarthi 1b265f343f fix(core): pin AuthType.GATEWAY to use Gemini 3.1 Pro/Flash Lite by default (#24375) 2026-04-01 00:25:59 +00:00
joshualitt fd5c103f99 refactor(core): Centralize context management logic into src/context (#24380) 2026-04-01 00:01:46 +00:00
David Pierce 94f9480a3a fix(core): resolve Plan Mode deadlock during plan file creation due to sandbox restrictions (#24047) 2026-03-31 22:06:50 +00:00
Sandy Tao c8d18eb2ac fix(config): disable JIT context loading by default (#24364) 2026-03-31 20:31:22 +00:00
ruomeng 07e2053e12 feat(plan): promote planning feature to stable (#24282) 2026-03-31 16:10:13 +00:00
Adib234 d0d3639e16 feat(plan): support Plan mode in untrusted folders (#17586) 2026-03-31 03:33:55 +00:00
Sandy Tao 46d6b119b6 feat(core): add project-level memory scope to save_memory tool (#24161) 2026-03-31 01:32:15 +00:00
joshualitt dfba0e91e2 feat(core): Unified Context Management and Tool Distillation. (#24157) 2026-03-30 22:29:59 +00:00
Adam Weidman 3eebb75b7a feat(core): agnostic background task UI with CompletionBehavior (#22740)
Co-authored-by: mkorwel <matt.korwel@gmail.com>
2026-03-28 21:27:51 +00:00
Abhijit Balaji afc1d50c20 feat(core): implement tool-based topic grouping (Chapters) (#23150)
Co-authored-by: Christian Gunderman <gundermanc@google.com>
2026-03-28 01:28:25 +00:00
Sandy Tao 4034c030e7 feat(context): add configurable memoryBoundaryMarkers setting (#24020) 2026-03-27 21:51:32 +00:00
joshualitt 320c8aba4c feat(core): Land AgentHistoryProvider. (#23978) 2026-03-27 19:22:35 +00:00
Emily Hedlund 535667baf6 feat(core): add forbiddenPaths to GlobalSandboxOptions and refactor createSandboxManager (#23936) 2026-03-27 16:57:26 +00:00
Sehoon Shon c92ae8a359 feat(core): define TrajectoryProvider interface (#23050) 2026-03-26 19:24:06 +00:00
Adib234 9762bf2965 fix(plan): after exiting plan mode switches model to a flash model (#23885) 2026-03-26 18:45:03 +00:00
christine betts 3ada29fb51 feat(core,ui): Add experiment-gated support for gemini flash 3.1 lite (#23794) 2026-03-25 20:28:49 +00:00
Tommaso Sciortino 1b052df52f feat(core): implement Windows sandbox dynamic expansion Phase 1 and 2.1 (#23691) 2026-03-25 17:54:45 +00:00
cynthialong0-0 466671eed4 feat(browser): add maxActionsPerTask for browser agent setting (#23216) 2026-03-24 21:40:48 +00:00
Abhi 055ff92276 revert: chore(config): disable agents by default (#23672) 2026-03-24 20:14:48 +00:00
Adib234 dcedc42979 fix(plan): sandbox path resolution in Plan Mode to prevent hallucinations (#22737)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-24 13:19:29 +00:00
Gal Zahavi 36e6445dba feat(sandbox): dynamic macOS sandbox expansion and worktree support (#23301) 2026-03-24 04:48:13 +00:00
Jarrod Whelan 271908dc94 feat(ui): implement refreshed UX for Composer layout (#21212)
Co-authored-by: Keith Guerin <keithguerin@gmail.com>
2026-03-24 02:30:48 +00:00
Abhi b2d6dc4e32 chore(config): disable agents by default (#23546) 2026-03-23 19:24:16 +00:00
Abhi c7d44e339b fix(core): ensure subagent tool updates apply configuration overrides immediately (#23161) 2026-03-23 00:24:24 +00:00
cynthialong0-0 e8fe43bd69 feat(browser): add sensitive action controls and read-only noise reduction (#22867) 2026-03-20 22:34:04 +00:00
Jerop Kipruto 5a3c7154df feat(worktree): add Git worktree support for isolated parallel sessions (#22973) 2026-03-20 14:10:51 +00:00