fix(windows): validate PLUGIN_DATA using Windows ACLs - #22
Conversation
Follow-up test on Codex Desktop / WindowsI tested the ResultThe patch moves past the original Bun/POSIX
The actual inherited allow entries on the Codex-managed plugin-data directory are:
There are no ImpactAfter the restart, Codex discovers the MCP tools, but QuestionShould This looks like a compatibility gap in the Windows allowlist rather than a broad-permission problem. A Codex-specific regression test or documented ACL guidance would help. |
Update: local workaround validatedFollowing up on my earlier test, I added a temporary local-only allowlist entry for the machine-local With that narrow workaround, on Codex Desktop / Windows with Bun 1.3.14:
This confirms that the original Bun/POSIX A supported accommodation, host-specific ACL guidance, or Codex regression test would make this work without a local patch. The workaround is temporary and may be overwritten by a plugin update. |
|
Thanks for the detailed follow up. You were right. I checked the current Codex Windows sandbox implementation, and I updated the PR to resolve the exact SID of the local group and allow it only when every allow ACE stays within read and execute. Modify, write, delete, permission changes, ownership changes, and full control still fail closed. If the group does not exist or cannot be resolved, no exception is added. I also added Windows regression coverage for inherited RX on the config, manifest, transaction journal, and backups, including the status, validation, preview, and installation flow. Locally, all 34 MCP tests pass and the repository validator passes. Thanks again. Your workaround identified the compatibility gap exactly. |
Summary
PLUGIN_DATA, existing state files, and backups on Windows through native owner and ACL SIDs instead of Bun's POSIX mode projectionconfig.json,managed-files.json, andtransaction.jsonbefore reading them.bakfiles before reusing the backup store and verify generated backups after exclusive creationfsyncdurability on Windows by opening directories withr+SystemRoot/WINDIRfirst, with drive-based fallbacksPLUGIN_DATApath itself, so cross-drive roots and junction ancestors are validated correctlyRoot cause
Bun projects Windows file permissions as POSIX mode bits. A private Windows directory can therefore appear as mode
0666, causing the MCP server to reject a validPLUGIN_DATAdirectory before setup can start.The fix uses Windows PowerShell 5.1 to inspect native security descriptors while leaving the Linux and macOS code path unchanged.
Security follow-up
Windows authorizes each file from its own security descriptor; the parent directory ACL is not sufficient when a caller can bypass traverse checking and knows the exact child path. The same owner/DACL policy is now enforced on every pre-existing state file before it is read. Backups are checked before reuse, and a newly copied backup is removed if its post-copy ACL verification fails.
References:
User impact
Sol Advisor setup can now run with a correctly private Windows
PLUGIN_DATAdirectory. Unsafe owners, null DACLs, broad grants such as Everyone, Users, or Authenticated Users, and permissive pre-existing state files fail closed.Validation
bun test plugins/sol-advisor/mcp/server.test.ts— 33 passed, 0 failed, 166 assertionsconfig.json,managed-files.json,transaction.json, and.bakfilesgit diff --check— passedbun run validateremains blocked on Windows by pre-existing CRLF-sensitive schema/frontmatter checksHosted CI
The fork workflow passed on commit
4ac08e6: validation, Ubuntu MCP, macOS MCP, and Windows MCP are all green. The upstream pull-request workflow still reportsaction_requireduntil a maintainer authorizes contributor Actions.Resumo (pt-BR)
Esta PR corrige a validação de privacidade do
PLUGIN_DATAno Windows usando proprietário e ACLs nativas, estende a mesma política aos arquivos de estado e backups, preserva o comportamento POSIX no Linux/macOS e adiciona regressões específicas para os caminhos apontados na revisão de segurança.Fixes #20