Skip to content

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

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

waleedlatif1 wants to merge 7 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, then reuse the existing encrypted grants across chats and app restarts.
  • Reuse previously approved VFS folders and add File → Folder Access controls. Concurrent requests for the same folder share one allow or deny decision; approved reads continue independently.
  • Revalidate pending calls, cancellation, canonical containment, and folder identity. Enumerate verified directory descriptors and reject replacements. Sign-out and server changes clear remembered access.

Type of Change

  • Bug fix

Testing

  • Rebased onto current staging and reviewed the consent, persistence, revocation, and native directory boundaries again.
  • Full root test suite and all workspace type checks; 876 desktop tests passing.
  • Real Electron E2E covers shared allow/deny decisions, recursive access across chats, imports, restart persistence, revocation, sign-out, cancellation, and symlink or replaced-folder denial. Screenshot artifact supports DESKTOP_LOCAL_FILES_REPORT_PATH.
  • The duplicate-denial and cancellation-takeover regressions each failed before their fixes. Earlier regression checks also failed with pending-call, persistence, revocation, path, and folder-identity guards removed independently.
  • Lint, block-registry audit, all 58 repository audits, and docs-manifest check.

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 Oct 5, 2026 11:26pm 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 with permission checks.

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

Summary

The PR requires folder consent for native file reads and imports, reuses encrypted grants, and adds native folder-management controls.

  • Adds pending-call revalidation, cancellation handling, and descriptor-based directory enumeration.
  • The latest change lets a valid caller take over consent after the caller owning a shared prompt expires.
Diagram
sequenceDiagram
  participant Caller as Native file caller
  participant Shell as Electron shell
  participant Server as Sim server
  participant User
  Caller->>Shell: Read or import request
  Shell->>Server: Verify pending tool call
  Shell->>Shell: Check remembered folder grant
  alt No valid grant
    Shell->>User: Request folder consent
    User-->>Shell: Allow or deny
  end
  Shell->>Server: Revalidate pending call
  Shell->>Shell: Resolve and verify approved path
  Shell-->>Caller: Bounded result or refusal
Loading

Reviews (7) · Last reviewed commit: "fix(desktop): preserve consent for remai..."

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

@waleedlatif1
waleedlatif1 force-pushed the codex/desktop-local-file-consent branch from ce6f05b to f524997 Compare October 5, 2026 23:13
@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 Oct 5, 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/src/main/local-file-permissions.ts Outdated

@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

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.

Fix all with cubic | Re-trigger cubic

Comment thread apps/desktop/src/main/menu.ts Outdated
Comment thread apps/desktop/src/main/ipc.ts
Comment thread apps/desktop/package.json
@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 Oct 5, 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 — b56f8e7f Deployed Oct 5, 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