openwork icon indicating copy to clipboard operation
openwork copied to clipboard

[Bug]: agent writes outside authorized folders with no permission prompt

Open pcharasz opened this issue 1 month ago • 1 comments

[Bug]: agent writes outside authorized folders with no permission prompt

Searched existing issues for authorized folder / external_directory. No open issue matches this failure. Related, not duplicates:

  • https://github.com/different-ai/openwork/pull/4276 (closed draft) says the pinned OpenCode 1.18 engine asks before working outside the workspace and authorized folders.
  • https://github.com/different-ai/openwork/pull/4228 (merged) moves authorized-folder rules into the injected engine config.

Summary

On OpenWork 0.18.62 for Windows, a chat can create and edit files outside every authorized folder without an OpenWork permission card. The write tool and a shell copy both succeeded immediately. Pending permission requests were empty, and there was no saved "always allow".

OpenWork's own model says this should not happen: access outside authorized roots is denied by default, and OpenWork shows the engine's permission request. Settings > Permissions is the allow-list for extra folders. Those folders were not granted.

To Reproduce

  1. Open OpenWork 0.18.62 on Windows. Use a workspace whose folder is the only authorized root. Do not add %LOCALAPPDATA% or C:\Program Files under Settings > Permissions.
  2. In a new chat, ask the agent to create a file at an explicit path outside that folder, for example %LOCALAPPDATA%\openwork-perm-test\hello.txt.
  3. Watch for an OpenWork permission card before the file is written.

Observed once, not as a synthetic test:

  1. The opened workspace folder was the only relevant authorized root. server.json authorizedRoots contained only workspace folders. %LOCALAPPDATA% and C:\Program Files were not included.
  2. The agent used the write tool to create files under a directory in %LOCALAPPDATA% that was not an authorized folder.
  3. The agent then started an elevated process to copy a file into a directory under C:\Program Files that was not an authorized folder.
  4. No OpenWork permission card appeared for either step. The only prompt was Windows UAC, and only because the agent explicitly requested elevation. The %LOCALAPPDATA% writes had no prompt at all.
  5. Afterward, the local sidecar had zero pending permission requests and zero saved approvals. This chat was not a session on that sidecar (GET /session/{id} returned 404).

Expected behavior

Before any create, edit, or copy outside an authorized folder, OpenWork shows a permission card (allow once / allow for session / deny), or the tool fails as not authorized. No file changes until the person approves. This matches:

  • ARCHITECTURE.md, Folder Authorization Model: default deny outside allowed roots; OpenCode requests permission; OpenWork displays it.
  • Installed docs, desktop-app/first-task.mdx: "OpenWork only works in folders you authorize."
  • Installed agent guidance: a path that is not authorized should surface "permission denied" or "not authorized", and the person adds the folder in Settings > Permissions.
  • Closed draft PR #4276: with no extra rules, the pinned engine asks before working outside the workspace and authorized folders.

Actual behavior

The write tool and the elevated copy both completed. No OpenWork permission card was shown. The agent cannot choose to show that card; it appears only when the engine marks the call as ask. These calls did not wait.

OW version and desktop info

  • OpenWork version: 0.18.62 (OpenWork.exe FileVersion / ProductVersion)
  • OS: Microsoft Windows [Version 10.0.26300.9711], Windows_NT 10.0.26300, win32 x64
  • Terminal: unavailable; this was the OpenWork desktop chat, not a terminal session
  • Shell: C:\WINDOWS\system32\cmd.exe (ComSpec)
  • Install/channel: release (resources\app-update.yml has releaseType: release, GitHub updater for different-ai/openwork)
  • Agent runtime version reported when the built-in report skill was registered: OpenCode 2.0.26
  • Bundled sidecar: opencode.exe --version and GET /global/health both report 1.18.33. It is serving on 127.0.0.1. This chat is not a session on that sidecar.
  • Active plugins, from the agent runtime snapshot: local OpenWork plugins under %APPDATA%\openwork\opencode-v2\state\:
    • context-plugin
    • gateway-quota-plugin
    • mcp-readiness-plugin
    • mcp-results-plugin
    • provider-filters-plugin
    • provider-sync-plugin
  • Sidecar GET /config permission block: empty, except the openwork agent denies five built-in skills (agent-creator, command-creator, customize-opencode, get-started, plugin-creator). No external_directory rule is present. No policies array.

Additional context

The v2 engine config OpenWork wrote on disk (%APPDATA%\openwork\opencode-v2\state\config\opencode.json) has "permissions": []. Authorized folders are still stored in the older permission.external_directory allow-list shape and in server.json authorizedRoots. Neither list stopped the tools that this chat actually ran.

OpenCode v2 documents that external_directory is allowed unless a rule says ask or deny (https://opencode.ai/v2/docs/permissions/). OpenWork still describes the opposite default. The gap is that this chat's engine does not have OpenWork's folder rule applied on top of that allow-by-default behavior.

A second, separate limit remains even if file edits start asking: OpenWork's own agent-permission docs say that when commands are allowed, a command that writes a file is not covered by the file-edit prompt. In this incident the write tool itself was not asked, so the bug is not only that shell hole.

Frequency: every outside write in this session. Not intermittent.

Workaround tried: none that restores the prompt. Asking the agent in chat is not enforcement.

pcharasz avatar Nov 03 '26 10:11 pcharasz

Still reproduces on OpenWork 0.18.68, in a desktop chat on OpenCode v2.2.6 (opencode2).

  • A directory under %LOCALAPPDATA% was not an authorized folder.
  • The v2 engine config still has no external_directory rule. permissions only asks for Drive, Gmail, and Outlook.
  • The write tool created a file there immediately. No permission card.
  • A non-elevated shell write to the same folder also completed immediately. No permission card.

Any chance for a fix? This bug is a serious issue!

pcharasz avatar Nov 19 '26 08:11 pcharasz