Skip to content

Commit ece030e

Browse files
committed
Remove the allowNetwork option from SandboxProfile and instead add a comment about wanting to add this functionality in the future (it needs to be done in a more nuanced way).
1 parent 6440584 commit ece030e

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

Sources/Basics/SandboxProfile.swift

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
import Foundation
1212
import TSCBasic
1313

14-
/// A sandbox profile representing the desired restrictions. The implementation can vary between platforms.
14+
/// A sandbox profile representing the desired restrictions. The implementation can vary between platforms. Currently
15+
/// the only control a client has is in the path rules, but in the future there should also be options for controlling
16+
/// blocking of network access and process launching.
1517
public struct SandboxProfile: Equatable {
1618
/// An ordered list of path rules, where the last rule to cover a particular path "wins". These will be resolved
1719
/// to absolute paths at the time the profile is applied. They are applied after any of the implicit directories
@@ -25,14 +27,10 @@ public struct SandboxProfile: Equatable {
2527
case writable(AbsolutePath)
2628
}
2729

28-
/// Whether to allow outbound and inbound network access.
29-
public var allowNetwork: Bool
30-
3130
/// Configures a SandboxProfile for blocking network access and writing to the file system except to specifically
3231
/// permitted locations.
33-
public init(_ pathAccessRules: [PathAccessRule] = [], allowNetwork: Bool = false) {
32+
public init(_ pathAccessRules: [PathAccessRule] = []) {
3433
self.pathAccessRules = pathAccessRules
35-
self.allowNetwork = allowNetwork
3634
}
3735
}
3836

@@ -66,12 +64,6 @@ fileprivate extension SandboxProfile {
6664
// Allow operations on subprocesses.
6765
contents += "(allow process*)\n"
6866

69-
// Optionally allow network access (inbound and outbound).
70-
if allowNetwork {
71-
contents += "(system-network)\n"
72-
contents += "(allow network*)\n"
73-
}
74-
7567
// Allow reading any file that isn't protected by TCC or permissions (ideally we'd only allow a specific set
7668
// of readable locations, and can maybe tighten this in the future).
7769
contents += "(allow file-read*)\n"

Tests/BasicsTests/SandboxTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ final class SandboxTest: XCTestCase {
2020
func testDefaults() throws {
2121
let sandboxProfile = SandboxProfile()
2222
XCTAssertEqual(sandboxProfile.pathAccessRules, [])
23-
XCTAssertEqual(sandboxProfile.allowNetwork, false)
2423
}
2524

2625
func testSandboxOnAllPlatforms() throws {

0 commit comments

Comments
 (0)