Skip to content

fix(desktop): require folder permission for native file tools - #8345

Open
waleedlatif1 wants to merge 5 commits into
stagingfrom
codex/desktop-local-file-consent
Open

waleedlatif1 wants to merge 5 commits into
stagingfrom
codex/desktop-local-file-consent

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Ask once for folder access before native file reads and imports, and remember the approval across chats and app restarts using the existing encrypted grant store.
  • Reuse folders already approved for VFS access; add File → Folder Access controls to add or forget folders. Approved reads continue while unrelated permission prompts are open.
  • Revalidate pending calls and enforce canonical paths, folder identity, and revocation. Enumerate directories through a verified descriptor to prevent path-swap races. Sign-out and server changes clear remembered access.

Type of Change

  • Bug fix

Testing

  • Desktop suite: 870 tests passing; Sim app, desktop, and desktop-bridge type-checks passing.
  • Electron E2E covers consent, recursive access across chats, import reuse, restart persistence, revocation, sign-out, cancellation during consent and after file opening, revoked VFS reads, and symlink or replaced-folder denial. A deterministic ancestor-swap test reproduces the old directory-name leak and passes with descriptor-based enumeration. Screenshot artifact supports DESKTOP_LOCAL_FILES_REPORT_PATH.
  • Verified regression failures by removing pending-call, persistence, revocation, path and folder-identity guards independently. Existing encrypted folder approvals migrate without prompting again.
  • Lint, block-registry check, all 51 repository audits, and docs-manifest check passing.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 26, 2026 10:59pm UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 8 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/desktop/src/main/local-file-permissions.ts Outdated
@greptile-apps

greptile-apps Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[High risk] Adds native file system access control with new permission checks.

The PR appears safe to merge; no new actionable issue or outstanding previous finding remains.

Summary

The PR requires remembered folder consent for native file reads and imports, shares grants with VFS access, and adds File → Folder Access controls.

  • Pending calls, folder identity, and revocation are rechecked during access.
  • Directory listings use a verified descriptor and reject a directory replaced during enumeration.
  • New tests cover consent, persistence, cancellation, revocation, and path replacement.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Call[Pending native file call] --> Check[Server authorization]
  Check --> Grant{Approved folder?}
  Grant -->|No| Consent[Native consent dialog]
  Consent --> Store[Encrypted grant store]
  Grant -->|Yes| Verify[Revalidate call and folder]
  Store --> Verify
  Verify --> Open[Open and verify descriptor]
  Open --> Result[Bounded read or import]
Loading

Reviews (5) · Last reviewed commit: "fix(desktop): reject replaced directory ..."

Comment thread apps/desktop/src/main/local-file-permissions.ts Outdated
Comment thread apps/desktop/src/main/local-file-permissions.ts Outdated
Comment thread apps/desktop/e2e/local-files.spec.ts Outdated
@waleedlatif1
waleedlatif1 force-pushed the codex/desktop-local-file-consent branch from d43d45a to 6ca8a97 Compare September 26, 2026 22:07
@waleedlatif1 waleedlatif1 changed the title fix(desktop): ask before accessing local files fix(desktop): require folder permission for native file tools Sep 26, 2026
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 13 files

Tip: instead of fixing issues one by one fix them all with cubic

Re-trigger cubic

Comment thread apps/desktop/src/main/local-filesystem-grant-store.ts
Comment thread apps/desktop/src/main/local-filesystem.ts
Comment thread apps/desktop/src/main/local-file-permissions.ts Outdated
Comment thread apps/desktop/src/main/local-files.ts
Comment thread apps/desktop/src/main/ipc.ts
Comment thread apps/desktop/src/main/local-files.ts
@waleedlatif1
waleedlatif1 force-pushed the codex/desktop-local-file-consent branch from 6ca8a97 to b5ae75a Compare September 26, 2026 22:31
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 15 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

Comment thread apps/desktop/src/main/local-files.ts Outdated
Comment thread apps/desktop/src/main/ipc.ts
@waleedlatif1
waleedlatif1 requested a review from a team as a code owner September 26, 2026 22:51
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

Comment thread apps/desktop/native/directory.cc
Comment thread apps/desktop/src/main/local-files.ts

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 20 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/desktop/src/main/local-files.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 20 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Re-trigger cubic

This branch was previously deployed

1 inactive deployment
Preview — ce6f05bd Deployed Sep 26, 2026 by vercel[bot]
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