In the previous chapter, the Security Configuration Inspector, we learned how to visualize the strict rules guarding our computer.
But what happens when those rules are too strict?
Imagine you are trying to run a critical script, but the sandbox blocks it because it needs to access a specific system file. You are stuck. The code won't run.
This is where the Fallback Policy Manager comes in. It acts as the "Emergency Override" switch for your environment.
Think of the sandbox like a Fire Door in a building.
The Fallback Policy Manager (SandboxOverridesTab.tsx) allows you to decide: Do you want that emergency push bar to exist?
Security is a trade-off.
We give the user a choice between Strict Sandbox Mode and Unsandboxed Fallback.
Before the user can change anything, the Manager checks if it's allowed to. In corporate environments, a "Higher Priority Policy" might force Strict Mode on everyone. If the policy is Locked, the user cannot use the escape hatch.
This isn't just an On/Off switch; it's a philosophy change.
The Fallback Policy Manager sits between the User and the configuration database. Here is what happens when a user interacts with it:
Let's explore SandboxOverridesTab.tsx to see how this logic is implemented.
First, we must respect authority. If a higher-level administrator has locked the settings, we disable the controls.
// Inside SandboxOverridesTab
const isLocked = SandboxManager.areSandboxSettingsLockedByPolicy();
if (isLocked) {
return (
<Text color="subtle">
Override settings are managed by a higher-priority configuration.
</Text>
);
}
SandboxManager if we are locked. If true, we render a static text message instead of the interactive menu.We need to know if the "Emergency Push Bar" is currently active so we can show it to the user.
// Get the current boolean value (true/false)
const currentAllowUnsandboxed = SandboxManager.areUnsandboxedCommandsAllowed();
// Convert boolean to a UI mode string
const currentMode = currentAllowUnsandboxed ? "open" : "closed";
true/false, but our UI logic thinks in terms of modes (open vs closed). We map the data to the UI state here.
We present the choices to the user. Note how we visually highlight the (current) option.
const options = [
{
label: currentMode === "open"
? "Allow unsandboxed fallback (current)"
: "Allow unsandboxed fallback",
value: "open"
},
{
label: currentMode === "closed" ? "Strict sandbox mode (current)" : "Strict sandbox mode",
value: "closed"
}
];
When the user makes a choice, we don't just update the UI; we persist the security policy to disk.
const handleSelect = async (value: string) => {
const mode = value as OverrideMode;
// Save the new policy preference
await SandboxManager.setSandboxSettings({
allowUnsandboxedCommands: mode === "open"
});
onComplete("Policy updated successfully");
};
SandboxManager to re-write the configuration file. From this moment on, if a command fails, the system checks this setting to decide whether to retry or give up.The Fallback Policy Manager gives users agency over their security. It recognizes that sometimes, operational needs outweigh strict security rules.
Now that we have our Settings, our Rules, and our Fallback Policy, we need to ensure the system creates a healthy environment to enforce them.
Next Step: Let's learn how to detect and fix broken environments in Environment Health Diagnostics.
Generated by Code IQ