github / github/copilot-cli

Sandbox RW path grants not honored by JVM processes spawned from Copilot CLI

Offen
#4,516 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

area:permissions
Vorherrschende Sprache
Shell
Sterne
11.2k
Forks
1.9k
Ø Merge
14 Std. 16 Min.
Gemergte PRs (30 T.)
6

Beschreibung

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
  1. In /sandbox, confirm ~/.m2/repository (or any path) is granted Read/Write.

  2. 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

  3. Compile and run a minimal Java program that writes a file under the same granted path via NIO:

     mkdir -p ~/.m2/repository/zz-test-dir
    
    import 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
    
  4. 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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, den Unterschied zwischen Shell-Schreibvorgängen und dem Java NIO FileChannel.open-Beispiel unter einem über /sandbox freigegebenen Pfad zu reproduzieren. Verfolge die Durchsetzung des Sandbox-Dateizugriffs für gestartete JVM-Prozesse und vergleiche sie mit Shell-Befehlen. Als erledigt gilt die Aufgabe, wenn der Java-Schreibvorgang erfolgreich ist und mvn clean compile unter ~/.m2/repository schreiben kann, ohne Operation not permitted.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java, shell
Bereich
cli, security
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
50/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.