Skip to content

Fix disableSandboxForPluginCommands #5855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Build/BuildOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public final class BuildOperation: PackageStructureDelegate, SPMBuildCore.BuildS
additionalFileRules: [FileRuleDescription],
pluginScriptRunner: PluginScriptRunner,
pluginWorkDirectory: AbsolutePath,
disableSandboxForPluginCommands: Bool = false,
disableSandboxForPluginCommands: Bool,
outputStream: OutputByteStream,
logLevel: Basics.Diagnostic.Severity,
fileSystem: TSCBasic.FileSystem,
Expand Down
1 change: 1 addition & 0 deletions Sources/Commands/SwiftTool.swift
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ extension SwiftCommand {
additionalFileRules: FileRuleDescription.swiftpmFileTypes,
pluginScriptRunner: swiftTool.getPluginScriptRunner(),
pluginWorkDirectory: try swiftTool.getActiveWorkspace().location.pluginWorkingDirectory,
disableSandboxForPluginCommands: swiftTool.options.security.shouldDisableSandbox,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we missing a test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's complicated™️

We have a test that's been added in #4283, but it didn't trigger here for two reasons:

  • We are running neither macOS 12 nor installing the concurrency compatibility libs on Swift CI, which leads to plugin tests being skipped on macOS and the sandboxing tests are macOS-only (rdar://100780895)
  • Build commands generated by plugins are running in a sandbox that currently has blanket approval for /private/tmp which also happens to be where we're placing test examples during test execution, so the sandbox is more open than normally during tests. Sandbox for manifests and plugins should provide a unique path specified by TMPDIR instead of allowing /tmp #4307 aims to address that by giving individual plugins unique temporary directories

Copy link
Contributor

@abertelrud abertelrud Nov 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I have rebased that Sandbox TMPDIR PR and revived it.

outputStream: customOutputStream ?? swiftTool.outputStream,
logLevel: customLogLevel ?? swiftTool.logLevel,
fileSystem: swiftTool.fileSystem,
Expand Down