Sandbox RW path grants not honored by JVM processes spawned from Copilot CLI
还没有人认领这个 Issue。
- 主要语言
- Shell
- 星标
- 11.2k
- 派生
- 1.9k
- 平均合并
- 14 小时 16 分钟
- 30 天内合并 PR
- 6
描述
Describe the bug
Summary
Sandbox path RW grants configured via /sandbox (e.g. ~/.m2/repository) are not honored by JVM/Java processes, even though the same path is fully writable for plain shell commands. Any Java-based tool (Maven, javac-compiled programs, etc.) fails with Operation not permitted on file/directory writes under a granted path, blocking real-world workflows like mvn clean compile.
Environment
• CLI version: 1.0.80
• OS: macOS (Darwin), aarch64
• Granted sandbox path: ~/.m2/repository (Read/Write)
Real-world impact
Running mvn clean compile in a multi-module Maven project fails identically — both the cyclonedx-maven-plugin and Maven core's own DefaultTrackingFileManager/DefaultUpdateCheckManager (writing resolver-status.properties for resolved dependency metadata under ~/.m2/repository/...) throw the same FileSystemException: Operation not permitted, even though the parent directories were freshly, successfully created by shell mkdir moments earlier in the same session.
Suspected root cause
The sandbox's file-access enforcement appears to differ by process/executable type rather than purely by path: shell built-ins (touch, mkdir) inherit the granted RW access, but JVM processes (java, and therefore javac, mvn) invoking sun.nio.fs.UnixFileSystemProvider (NIO FileChannel.open/Files.createDirectory) are denied on the identical path/grant.
Affected version
1.0.80
Steps to reproduce the behavior
-
In /sandbox, confirm ~/.m2/repository (or any path) is granted Read/Write.
-
From the CLI's shell tool, confirm plain shell operations succeed on that path:
mkdir -p ~/.m2/repository/zz-test-dir && echo OK # succeeds
touch ~/.m2/repository/zz-test-dir/file.txt && echo OK # succeeds -
Compile and run a minimal Java program that writes a file under the same granted path via NIO:
mkdir -p ~/.m2/repository/zz-test-dirimport java.nio.channels.FileChannel; import java.nio.file.*; import static java.nio.file.StandardOpenOption.*; public class WriteTest { public static void main(String[] args) throws Exception { Path p = Paths.get(System.getProperty("user.home") + "/.m2/repository/zz-test-dir/javatest.properties"); try (FileChannel ch = FileChannel.open(p, CREATE, WRITE)) { System.out.println("JAVA WRITE OK"); } } }javac WriteTest.java && java WriteTest -
Actual result:
Exception in thread "main" java.nio.file.FileSystemException: .../zz-test-dir/javatest.properties: Operation not permitted
at java.base/sun.nio.fs.UnixFileSystemProvider.newFileChannel
at java.base/java.nio.channels.FileChannel.open
at WriteTest.main(WriteTest.java:7)
Expected behavior
"JAVA WRITE OK" printed.
Additional context
No response
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,在通过 /sandbox 授权的路径下复现 shell 写入与 Java NIO FileChannel.open 示例之间的差异。跟踪 sandbox 对已启动 JVM 进程的文件访问强制机制,并将其与 shell 命令进行比较。当 Java 写入成功,并且 mvn clean compile 可以在 ~/.m2/repository 下写入而不出现 Operation not permitted 时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java, shell
- 领域
- cli, security
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 50/100