[PR #3319] [CLOSED] fix(gemini): ignore untrusted workspace settings #5716

Closed
opened 2026-10-31 01:08:53 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/3319
Author: @CmsChase
Created: 10/14/2026
Status: ❌ Closed

Base: main ← Head: fix/gemini-untrusted-workspace-settings


📝 Commits (2)

  • 61c4617 fix(gemini): ignore untrusted workspace settings
  • 69858ce fix(gemini): preserve setup without workspace settings

📊 Changes

2 files changed (+214 additions, -7 deletions)

View changed files

📝 src/application/GeminiClientSettings.ts (+15 -7)
➕ tests/acceptance/setup/geminiWorkspaceTrust.test.ts (+199 -0)

📄 Description

Summary

Fixes #3206. Ignore malformed settings in untrusted Gemini workspaces while preserving setup and doctor success when no workspace settings exist.

Problem and expected behavior

REA parsed workspace settings before checking trust, so malformed excluded settings blocked setup and marked a valid user registration invalid. Trust controls workspace-policy admission; an absent workspace settings file should not trigger an unrelated trustedFolders.json error. Present settings with unresolved or malformed trust must still be rejected.

Change and scope

Probe workspace settings metadata and omit that source only when ENOENT establishes absence. Otherwise retain the existing trust decision before reading or parsing content. Setup and registration diagnostics share this owner. Trust overrides, restricted-mode precedence, settings merge order, and the home-directory exclusion remain unchanged.

Contract and boundary impact

  • Semantic owner and earliest changed stage: GeminiClientSettings.readClientPolicyBlock, workspace policy admission.
  • Contribution scope fit and linked maintainer decision: routine fix within existing configuration boundaries; advance scope decision not applicable.
  • CLI and MCP/tool-catalog contract: corrected setup/doctor diagnostics; no schema or catalog changes.
  • Provider, bridge, target-format, or platform compatibility: no provider/bridge changes; Windows x64 CLI verification.
  • Evidence, artifact, provenance, or reconstruction contract: not applicable.
  • Target selection, authority, upstream behavior, and cleanup: no new execution or mutation capability. Workspace/trust files remain read-only; existing approved setup writes and test-owned cleanup are preserved.
  • Generated metadata, package, or installation impact: no metadata, dependency or package-layout change.

Expected effects of the existing setup workflow:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

The configuration effect is existing approved user registration/skill installation. This fix adds no target interaction.

Evidence and regression coverage

  • Five compiled CLI acceptance tests cover absent settings with valid/malformed trust, materializing settings with malformed trust, implicit/explicit distrust, restricted mode, and trusted malformed/excluded controls.

  • Original #3206 regressions: 3 failed / 1 passed on unchanged production code, then 4 passed with trust-first admission.

  • Added compatibility regression: 1 failed / 4 passed before the absence correction, then all 5 passed.

  • Three-version replay made 75 real CLI calls. No-settings/malformed-trust setup and doctor changed from baseline exit 0 to exit 1 with unconditional trust evaluation, then returned to exit 0. Present-settings/malformed-trust calls retain exit 1; trusted exclusions and conflicting overrides remain rejected.

  • User, trust and workspace bytes were preserved. Unknown metadata errors are not treated as absence; that non-ENOENT branch was reviewed in source, not independently fault-injected.

  • Observed, derived, and inferred claims remain distinguishable.

  • Artifact identity, source provenance, and failed attempts remain preserved.

  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

Windows x64, Node 24.18.0/npm 11.16.0, locked dependencies:

  • npm run test:focused -- tests/acceptance/setup/geminiWorkspaceTrust.test.ts — 5 passed.
  • npm exec --no -- vitest run --project cli-boundary tests/boundary/cli/clientProfiles.test.ts -t Gemini — 10 passed; four unrelated OpenCode cases excluded by selection.
  • npm run check — passed: typecheck, format, lint (0 errors; one additional function-length warning at 101 lines versus 100), knip, metadata, module boundaries and architecture guards.
  • npm run verify:test-discovery — all 1253 test files discovered exactly once.

Previously observed packaging results, not rerun for the compatibility correction: npm pack --dry-run passed; the generic package verifier failed on both original and trust-first source at Windows spawn npm ENOENT; the Windows verifier required the absent source-checkout native manifest. Complete package verification remains unavailable in this environment. Previously recorded unrelated Windows symlink, launcher and OpenCode test failures remain outside this fix.

Compatibility, safety, and release

  • Breaking changes or migration: none intended; restores documented excluded-scope behavior and original no-settings compatibility.
  • Real Hopper/Ghidra, browser, or OS coverage: target-free Windows REA CLI; no native engine, installed Gemini client, POSIX host or live model API claim.
  • Package or release metadata impact: unchanged; full package/CI coverage is not claimed.
  • Security, privacy, process, or containment: no trust is granted. Metadata absence cannot authorize a content read; present or unresolved settings still require the existing trust decision.

Author readiness

Human owner: @CmsChase

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem.
  • The change stays within existing scope and authority boundaries.
  • The PR has one focused outcome and a conventional title.
  • The related issue is linked.
  • Tests cover changed behavior and meaningful failure paths.
  • Existing owning docs already describe the restored behavior; generated metadata is unchanged.
  • Representative CLI outcomes are recorded above.
  • The final diff was checked for secrets, unrelated cleanup, and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/3319 **Author:** [@CmsChase](https://github.com/CmsChase) **Created:** 10/14/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/gemini-untrusted-workspace-settings` --- ### 📝 Commits (2) - [`61c4617`](https://github.com/morluto/rea/commit/61c46172b7a885d47bceaa8e0a0b493502eb2011) fix(gemini): ignore untrusted workspace settings - [`69858ce`](https://github.com/morluto/rea/commit/69858ce79477a9545fad07c4a892109331bd2eb9) fix(gemini): preserve setup without workspace settings ### 📊 Changes **2 files changed** (+214 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `src/application/GeminiClientSettings.ts` (+15 -7) ➕ `tests/acceptance/setup/geminiWorkspaceTrust.test.ts` (+199 -0) </details> ### 📄 Description ## Summary Fixes #3206. Ignore malformed settings in untrusted Gemini workspaces while preserving setup and doctor success when no workspace settings exist. ## Problem and expected behavior REA parsed workspace settings before checking trust, so malformed excluded settings blocked setup and marked a valid user registration invalid. Trust controls workspace-policy admission; an absent workspace settings file should not trigger an unrelated trustedFolders.json error. Present settings with unresolved or malformed trust must still be rejected. ## Change and scope Probe workspace settings metadata and omit that source only when ENOENT establishes absence. Otherwise retain the existing trust decision before reading or parsing content. Setup and registration diagnostics share this owner. Trust overrides, restricted-mode precedence, settings merge order, and the home-directory exclusion remain unchanged. ## Contract and boundary impact - Semantic owner and earliest changed stage: `GeminiClientSettings.readClientPolicyBlock`, workspace policy admission. - Contribution scope fit and linked maintainer decision: routine fix within existing configuration boundaries; advance scope decision not applicable. - CLI and MCP/tool-catalog contract: corrected setup/doctor diagnostics; no schema or catalog changes. - Provider, bridge, target-format, or platform compatibility: no provider/bridge changes; Windows x64 CLI verification. - Evidence, artifact, provenance, or reconstruction contract: not applicable. - Target selection, authority, upstream behavior, and cleanup: no new execution or mutation capability. Workspace/trust files remain read-only; existing approved setup writes and test-owned cleanup are preserved. - Generated metadata, package, or installation impact: no metadata, dependency or package-layout change. Expected effects of the existing setup workflow: - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [x] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. The configuration effect is existing approved user registration/skill installation. This fix adds no target interaction. ## Evidence and regression coverage - Five compiled CLI acceptance tests cover absent settings with valid/malformed trust, materializing settings with malformed trust, implicit/explicit distrust, restricted mode, and trusted malformed/excluded controls. - Original #3206 regressions: 3 failed / 1 passed on unchanged production code, then 4 passed with trust-first admission. - Added compatibility regression: 1 failed / 4 passed before the absence correction, then all 5 passed. - Three-version replay made 75 real CLI calls. No-settings/malformed-trust setup and doctor changed from baseline exit 0 to exit 1 with unconditional trust evaluation, then returned to exit 0. Present-settings/malformed-trust calls retain exit 1; trusted exclusions and conflicting overrides remain rejected. - User, trust and workspace bytes were preserved. Unknown metadata errors are not treated as absence; that non-ENOENT branch was reviewed in source, not independently fault-injected. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed Windows x64, Node 24.18.0/npm 11.16.0, locked dependencies: - `npm run test:focused -- tests/acceptance/setup/geminiWorkspaceTrust.test.ts` — 5 passed. - `npm exec --no -- vitest run --project cli-boundary tests/boundary/cli/clientProfiles.test.ts -t Gemini` — 10 passed; four unrelated OpenCode cases excluded by selection. - `npm run check` — passed: typecheck, format, lint (0 errors; one additional function-length warning at 101 lines versus 100), knip, metadata, module boundaries and architecture guards. - `npm run verify:test-discovery` — all 1253 test files discovered exactly once. Previously observed packaging results, not rerun for the compatibility correction: `npm pack --dry-run` passed; the generic package verifier failed on both original and trust-first source at Windows `spawn npm ENOENT`; the Windows verifier required the absent source-checkout native manifest. Complete package verification remains unavailable in this environment. Previously recorded unrelated Windows symlink, launcher and OpenCode test failures remain outside this fix. ## Compatibility, safety, and release - Breaking changes or migration: none intended; restores documented excluded-scope behavior and original no-settings compatibility. - Real Hopper/Ghidra, browser, or OS coverage: target-free Windows REA CLI; no native engine, installed Gemini client, POSIX host or live model API claim. - Package or release metadata impact: unchanged; full package/CI coverage is not claimed. - Security, privacy, process, or containment: no trust is granted. Metadata absence cannot authorize a content read; present or unresolved settings still require the existing trust decision. ## Author readiness Human owner: @CmsChase - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem. - [x] The change stays within existing scope and authority boundaries. - [x] The PR has one focused outcome and a conventional title. - [x] The related issue is linked. - [x] Tests cover changed behavior and meaningful failure paths. - [x] Existing owning docs already describe the restored behavior; generated metadata is unchanged. - [x] Representative CLI outcomes are recorded above. - [x] The final diff was checked for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:08:53 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#5716
No description provided.