Skip to content
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
Replace disableSandbox with useSandbox in UtSettings
Although `disableSandbox` is a descriptive name, the inverted logic
makes it harder to use and does not match the naming of other settings.

This commit replaces `disableSandbox` with `useSandbox` and
correspondingly modifies necessary checks.
  • Loading branch information
dtim committed Sep 5, 2022
commit 44596712979791cf4e655fc45f30d601a53d015a
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