Skip to content

Replace disableSandbox with useSandbox in UtSettings #857

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
Sep 6, 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
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,15 @@ object UtSettings : AbstractSettings(
var ignoreStaticsFromTrustedLibraries by getBooleanProperty(true)

/**
* Disable sandbox in the concrete executor. All unsafe/dangerous calls will be permitted.
* Use the sandbox in the concrete executor.
*
* If true (default), the sandbox will prevent potentially dangerous calls, e.g., file access, reading
* or modifying the environment, calls to `Unsafe` methods etc.
*
* If false, all these operations will be enabled and may lead to data loss during code analysis
* and test generation.
*/
var disableSandbox by getBooleanProperty(false)

var useSandbox by getBooleanProperty(true)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ inline fun <reified T> withoutConcrete(block: () -> T): T {
* Run [block] with disabled sandbox in the concrete executor
*/
inline fun <reified T> withoutSandbox(block: () -> T): T {
val prev = UtSettings.disableSandbox
UtSettings.disableSandbox = true
val prev = UtSettings.useSandbox
UtSettings.useSandbox = false
try {
return block()
} finally {
UtSettings.disableSandbox = prev
UtSettings.useSandbox = prev
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ChildProcessRunner {
val directory = WorkingDirService.provide().toFile()
val commandsWithOptions = buildList {
addAll(cmds)
if (UtSettings.disableSandbox) {
if (!UtSettings.useSandbox) {
add(DISABLE_SANDBOX_OPTION)
}
add(portArgument)
Expand Down