MCPcopy Index your code
hub / github.com/codeaashu/claude-code / shouldUseSandbox

Function shouldUseSandbox

src/tools/BashTool/shouldUseSandbox.ts:130–153  ·  view source on GitHub ↗
(input: Partial<SandboxInput>)

Source from the content-addressed store, hash-verified

128}
129
130export function shouldUseSandbox(input: Partial<SandboxInput>): boolean {
131 if (!SandboxManager.isSandboxingEnabled()) {
132 return false
133 }
134
135 // Don't sandbox if explicitly overridden AND unsandboxed commands are allowed by policy
136 if (
137 input.dangerouslyDisableSandbox &&
138 SandboxManager.areUnsandboxedCommandsAllowed()
139 ) {
140 return false
141 }
142
143 if (!input.command) {
144 return false
145 }
146
147 // Don't sandbox if the command contains user-configured excluded commands
148 if (containsExcludedCommand(input.command)) {
149 return false
150 }
151
152 return true
153}
154

Callers 7

runPowerShellCommandFunction · 0.85
bashToolHasPermissionFunction · 0.85
userFacingNameFunction · 0.85
runShellCommandFunction · 0.85

Calls 3

containsExcludedCommandFunction · 0.85
isSandboxingEnabledMethod · 0.80

Tested by

no test coverage detected