In the previous chapter, Sandbox Settings Orchestrator, we built the main control panel to turn the sandbox on and off.
But simply flipping a switch isn't enough. If the sandbox is "On," what does that actually mean? Can the code read my passwords? Can it talk to the internet?
Welcome to the Security Configuration Inspector.
Imagine a Security Dashboard for a high-tech building. You don't just want a green light saying "Security Active." You want a screen that tells you:
The Security Configuration Inspector does exactly this for your code. It translates complex, invisible security rules into a simple, human-readable list.
Security rules are usually hidden in deep configuration files (JSON or YAML). If a script crashes because it couldn't write to a file, the user is often left guessing: "Did the script fail, or did the sandbox stop it?"
We provide a visual audit tool (SandboxConfigTab.tsx). It looks at the active policy and displays:
In the sandbox, seeing a file and changing a file are two very different things.
C:/Windows")./tmp, but nothing else").The Inspector separates these clearly so you know your important files are safe from being overwritten, even if they can be read.
By default, a secure sandbox might block all internet access. The Inspector shows you the Allowlist (Allowed Hosts).
google.com, the code can talk to Google.The Inspector is a "Read-Only" component. It doesn't change settings; it only reports what the Sandbox Data Adapter is currently enforcing.
Here is the flow of information:
Let's look at how we build this visualization in SandboxConfigTab.tsx.
When the component loads, we ask the Manager for the specific configuration objects. We don't need the raw database file; we need the processed rules.
// Inside SandboxConfigTab component
const isEnabled = SandboxManager.isSandboxingEnabled();
// Grab the specific rulesets
const fsReadConfig = SandboxManager.getFsReadConfig();
const fsWriteConfig = SandboxManager.getFsWriteConfig();
const networkConfig = SandboxManager.getNetworkRestrictionConfig();
isEnabled is false, we simply show a message saying "Sandbox is OFF" and stop there.
We need to turn an array of strings (e.g., ['/usr/local', '/tmp']) into a friendly UI list.
// If we have denied paths, show them clearly
{fsReadConfig.denyOnly.length > 0 && (
<Box flexDirection="column">
<Text bold color="permission">
Filesystem Read Restrictions:
</Text>
<Text dimColor>
Denied: {fsReadConfig.denyOnly.join(", ")}
</Text>
</Box>
)}
denyOnly has items. If yes, we render a header ("Filesystem Read Restrictions") and join the list of paths with commas. The dimColor helps separate the data from the label.Network rules are critical. A user needs to know instantly if their script can "phone home."
// Check if we have an allowlist or denylist
const hasNetworkRules = networkConfig.allowedHosts.length > 0 ||
networkConfig.deniedHosts.length > 0;
{hasNetworkRules && (
<Box flexDirection="column">
<Text bold color="permission">Network Restrictions:</Text>
<Text dimColor>
Allowed: {networkConfig.allowedHosts.join(", ")}
</Text>
</Box>
)}
allowedHosts contains ['npm.org'], the user sees exactly that. If the list is empty, the section might disappear or show "None," depending on our logic.
Sometimes, the Operating System (like Linux) has limitations that the user must know about. For example, "glob patterns" (like *.txt) might not work perfectly everywhere.
const globWarnings = SandboxManager.getLinuxGlobPatternWarnings();
{globWarnings.length > 0 && (
<Box flexDirection="column">
<Text bold color="warning">β Warning: Globs not supported</Text>
<Text dimColor>
Ignored patterns: {globWarnings.slice(0, 3).join(", ")}
</Text>
</Box>
)}
.slice(0, 3) to avoid flooding the screen if there are 50 warnings.The Security Configuration Inspector is the window into the soul of the sandbox.
By giving the user visibility, we build trust. They don't have to guess why a file access was deniedβthey can see the rule right on the screen.
But what happens if a script tries to do something that isn't on the list? Or what if the configuration fails to load entirely? We need a backup plan.
Next Step: Let's explore how the system handles safety nets in the Fallback Policy Manager.
Generated by Code IQ