You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sandbox blocks output to default plugin output directory when it's under <pkgdir>/.build
The sandbox rules introduced in #3996 made that the entire package directory read-only, but that isn't appropriate when `.build` is inside the package directory. This changes the order of the operations so that the `allow` comes after the `deny`, but still after the temporary directories.
In order to make this more flexible this coalesces the lists of writable and read-only directories into a single `pathRules` list of a new enum type that allows writing or read-only paths, and allows the caller to control the order. Also, writability of temporary directories is pulled into an option on the `default` strictness.
rdar://87417780
Copy file name to clipboardExpand all lines: Sources/Basics/Sandbox.swift
+35-40Lines changed: 35 additions & 40 deletions
Original file line number
Diff line number
Diff line change
@@ -20,32 +20,34 @@ public enum Sandbox {
20
20
///
21
21
/// - Parameters:
22
22
/// - command: The command line to sandbox (including executable as first argument)
23
-
/// - strictness: The basic strictness level of the standbox.
24
-
/// - writableDirectories: Paths under which writing should be allowed.
25
-
/// - readOnlyDirectories: Paths under which writing should be denied, even if they would have otherwise been allowed by either the strictness level or paths in `writableDirectories`.
23
+
/// - strictness: The basic strictness level of the sandbox.
24
+
/// - fileSystemRules: Ordered set of rules that allow reading or writing to particular paths in the file system (last one wins for a particular path).
// Emit rules for paths under which writing should be disallowed, even if they would be covered by a previous rule to allow writing to them. A classic case is a package which is located under the temporary directory, which should be read-only even though the temporary directory as a whole is writable.
Copy file name to clipboardExpand all lines: Sources/Workspace/DefaultPluginScriptRunner.swift
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -361,7 +361,10 @@ public struct DefaultPluginScriptRunner: PluginScriptRunner {
361
361
362
362
// Optionally wrap the command in a sandbox, which places some limits on what it can do. In particular, it blocks network access and restricts the paths to which the plugin can make file system changes. It does allow writing to temporary directories.
0 commit comments