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

Function SandboxConfigTab

src/components/sandbox/SandboxConfigTab.tsx:5–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3import { Box, Text } from '../../ink.js';
4import { SandboxManager, shouldAllowManagedSandboxDomainsOnly } from '../../utils/sandbox/sandbox-adapter.js';
5export function SandboxConfigTab() {
6 const $ = _c(3);
7 const isEnabled = SandboxManager.isSandboxingEnabled();
8 let t0;
9 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
10 const depCheck = SandboxManager.checkDependencies();
11 t0 = depCheck.warnings.length > 0 ? <Box marginTop={1} flexDirection="column">{depCheck.warnings.map(_temp)}</Box> : null;
12 $[0] = t0;
13 } else {
14 t0 = $[0];
15 }
16 const warningsNote = t0;
17 if (!isEnabled) {
18 let t1;
19 if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
20 t1 = <Box flexDirection="column" paddingY={1}><Text color="subtle">Sandbox is not enabled</Text>{warningsNote}</Box>;
21 $[1] = t1;
22 } else {
23 t1 = $[1];
24 }
25 return t1;
26 }
27 let t1;
28 if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
29 const fsReadConfig = SandboxManager.getFsReadConfig();
30 const fsWriteConfig = SandboxManager.getFsWriteConfig();
31 const networkConfig = SandboxManager.getNetworkRestrictionConfig();
32 const allowUnixSockets = SandboxManager.getAllowUnixSockets();
33 const excludedCommands = SandboxManager.getExcludedCommands();
34 const globPatternWarnings = SandboxManager.getLinuxGlobPatternWarnings();
35 t1 = <Box flexDirection="column" paddingY={1}><Box flexDirection="column"><Text bold={true} color="permission">Excluded Commands:</Text><Text dimColor={true}>{excludedCommands.length > 0 ? excludedCommands.join(", ") : "None"}</Text></Box>{fsReadConfig.denyOnly.length > 0 && <Box marginTop={1} flexDirection="column"><Text bold={true} color="permission">Filesystem Read Restrictions:</Text><Text dimColor={true}>Denied: {fsReadConfig.denyOnly.join(", ")}</Text>{fsReadConfig.allowWithinDeny && fsReadConfig.allowWithinDeny.length > 0 && <Text dimColor={true}>Allowed within denied: {fsReadConfig.allowWithinDeny.join(", ")}</Text>}</Box>}{fsWriteConfig.allowOnly.length > 0 && <Box marginTop={1} flexDirection="column"><Text bold={true} color="permission">Filesystem Write Restrictions:</Text><Text dimColor={true}>Allowed: {fsWriteConfig.allowOnly.join(", ")}</Text>{fsWriteConfig.denyWithinAllow.length > 0 && <Text dimColor={true}>Denied within allowed: {fsWriteConfig.denyWithinAllow.join(", ")}</Text>}</Box>}{(networkConfig.allowedHosts && networkConfig.allowedHosts.length > 0 || networkConfig.deniedHosts && networkConfig.deniedHosts.length > 0) && <Box marginTop={1} flexDirection="column"><Text bold={true} color="permission">Network Restrictions{shouldAllowManagedSandboxDomainsOnly() ? " (Managed)" : ""}:</Text>{networkConfig.allowedHosts && networkConfig.allowedHosts.length > 0 && <Text dimColor={true}>Allowed: {networkConfig.allowedHosts.join(", ")}</Text>}{networkConfig.deniedHosts && networkConfig.deniedHosts.length > 0 && <Text dimColor={true}>Denied: {networkConfig.deniedHosts.join(", ")}</Text>}</Box>}{allowUnixSockets && allowUnixSockets.length > 0 && <Box marginTop={1} flexDirection="column"><Text bold={true} color="permission">Allowed Unix Sockets:</Text><Text dimColor={true}>{allowUnixSockets.join(", ")}</Text></Box>}{globPatternWarnings.length > 0 && <Box marginTop={1} flexDirection="column"><Text bold={true} color="warning">⚠ Warning: Glob patterns not fully supported on Linux</Text><Text dimColor={true}>The following patterns will be ignored:{" "}{globPatternWarnings.slice(0, 3).join(", ")}{globPatternWarnings.length > 3 && ` (${globPatternWarnings.length - 3} more)`}</Text></Box>}{warningsNote}</Box>;
36 $[2] = t1;
37 } else {
38 t1 = $[2];
39 }
40 return t1;
41}
42function _temp(w, i) {
43 return <Text key={i} dimColor={true}>{w}</Text>;
44}

Callers

nothing calls this directly

Calls 9

isSandboxingEnabledMethod · 0.80
checkDependenciesMethod · 0.80
getFsReadConfigMethod · 0.80
getFsWriteConfigMethod · 0.80
getAllowUnixSocketsMethod · 0.80
getExcludedCommandsMethod · 0.80

Tested by

no test coverage detected