

# Security policies

**Note**  
This feature is in public preview. Features and behavior are subject to change.

Every WorkSpace uses two policies that limit what the agent can do: an OS policy and an Agent Harness policy. You write each policy as a JSON document, create it once in the Agentic Catalog, and reuse it across persona configurations and WorkSpaces.

**Note**  
In the WorkSpaces API, these are called workspace-enforced policies (`CreateWorkspaceEnforcedPolicy`) and agent-enforced policies (`CreateAgentEnforcedPolicy`).

## How the two policies differ
<a name="agentic-policies-comparison"></a>

The following table compares the two policy types.


|  | OS policy | Agent Harness policy | 
| --- | --- | --- | 
| Enforced by | Windows, on the WorkSpace | The agent | 
| Controls | Internet access, and which folders the agent can read and change, can only read, or can't access | Which tools the agent has, which actions run without asking, and when the agent asks the user for approval | 
| Also restricts programs that the agent starts | Yes | No | 
| Use it for | Hard limits | Everyday guardrails and approvals | 

Use both. For example, an Agent Harness policy rule that blocks `Read` on a folder stops the agent's file tools, but not a `PowerShell` command that the agent runs. An OS policy denied path stops both.

## OS policy
<a name="agentic-workspace-enforced-policy"></a>

The following table describes the OS policy settings.


| Setting | What it does | If you leave it out | 
| --- | --- | --- | 
| disableInternetAccess | true blocks the agent, and programs that it starts, from reaching the internet. Model requests and MCP connectors keep working because they go through the WorkSpaces gateway. | The agent has no internet access. The agent reaches the internet only when an OS policy explicitly sets disableInternetAccess to false. | 
| writablePaths | Folders the agent can read and change: create, overwrite, rename, and delete, including the user's existing files. There's no add-only option. The agent can't change permissions or take ownership, so removing a folder from the list removes the access. | The agent can write only to its working folder. | 
| readablePaths | Folders the agent can read but not change. | The agent can read only the built-in set of folders. | 
| deniedPaths | Folders that the agent, and programs that it starts, can't read or write. Use a full path such as D:\\Finance, or a path that starts with \~ or %USERPROFILE% to apply it to every user profile. Overrides both writablePaths and readablePaths. | No extra folders are denied. | 

With both `writablePaths` and `readablePaths` empty, the agent starts with these built-in protections: The agent runs under its own Windows account, separate from the user. It can change files only in its working folder (`D:\Users\{{user}}\workspace`). It can read, but not change, a built-in set of folders: the user's Documents, Desktop, and Downloads; common code folders such as `repos`, `src`, `source`, `code`, `projects`, `dev`, and `git`; build caches such as `.cargo`, `.npm`, `.m2`, and `.gradle`; and `.gitconfig`. It can never read credential files, such as `.ssh`, `.aws`, and `.npmrc`, unless a policy names the exact path. It has no internet access unless the OS policy turns it on. The agent runs separately from the user's Windows desktop. It can't see, type into, or capture the user's windows. These protections apply with or without an OS policy. An OS policy changes these defaults.

Each entry in `writablePaths`, `readablePaths`, and `deniedPaths` is a full path (for example `D:\repos`) or a path in the user's profile (`~\repos`, `%USERPROFILE%\repos`); backslashes or forward slashes both work, and backslashes are escaped in JSON. The WorkSpace doesn't accept relative paths such as `.\secrets`, empty entries, or `~` or `%USERPROFILE%` on its own (the whole profile). If any path entry isn't accepted, the WorkSpace doesn't apply `deniedPaths`, `writablePaths`, `readablePaths`, or `disableInternetAccess`. It keeps its previous values for these settings, or fails provisioning if you apply the policy during provisioning.

An unknown setting makes the whole policy invalid. The WorkSpace applies none of it.

These limits apply to the agent, not to programs that the user starts. Whatever the policy says, the agent can never reach the instance metadata service.

## Agent Harness policy
<a name="agentic-agent-enforced-policy"></a>

For each action, the agent applies the first of these that matches:
+ Tool removed (a tool name on its own in `disallowedTools`) – The agent doesn't have the tool.
+ Blocked (a pattern in `disallowedTools`) – The action is refused in every permission mode. The user can't override this.
+ Always asks – Some actions always ask the user, even when `allowedTools` pre-approves them. Examples are writes to protected folders such as `.git`, and deleting critical paths such as a drive root.
+ Pre-approved (`allowedTools`) – The action runs without asking.
+ Permission mode (`permissionMode`) – `acceptEdits` makes file edits in the agent's folders without asking. `plan` makes no changes until the user approves a plan. `auto` lets the classifier approve or block the action.
+ Otherwise – The agent asks the user, who chooses **Approve** or **Deny**.

The following table describes the Agent Harness policy settings.


| Setting | What it does | If you leave it out | 
| --- | --- | --- | 
| disallowedTools | Actions that are always refused. A tool name on its own, such as WebFetch, removes the tool. A pattern, such as PowerShell(git push \*), blocks matching actions. | Nothing is blocked. | 
| allowedTools | Actions that run without asking, such as PowerShell(npm test). This list doesn't limit the agent: other actions still run after the user approves them. | The agent asks before most actions. | 
| permissionMode | default asks before changing files or running commands. acceptEdits also changes files in its folders without asking. plan makes no changes until the user approves a plan. auto runs without routine prompts: before shell commands, network requests, and other actions run, a classifier checks that they match the user's request and blocks those that don't. bypassPermissions and dontAsk aren't supported. | default | 
| workingDirectories | Extra folders, as full paths, where the agent's file tools can work. | Only the user's workspace folder (%USERPROFILE%\\workspace), where chat and terminal sessions start. | 
| allowManagedMcpServersOnly | true allows only the MCP servers that you set up in the Agentic Catalog, and no server that a user adds loads. false lets users add their own servers on top of yours. You can't approve a specific list of extra servers. | false | 

Tool names are `Read`, `Edit`, `Write`, `PowerShell`, `WebFetch`, and `Skill`. The agent runs commands with `PowerShell`. Paths in rules can use Windows form, such as `Read(D:\Finance\**)`.

Keep in mind the following:
+ A blocked action always wins over a pre-approved one.
+ Command rules match the command text, so treat them as a safety net. Use the OS policy for hard limits.
+ Users can't loosen the policy from their own settings files.

## Sample policies
<a name="agentic-sample-policies"></a>

The following samples pair an OS policy with an Agent Harness policy for two common setups.

### Locked-down
<a name="agentic-sample-locked-down"></a>

For sensitive code. The agent can't reach the internet, can't read credential folders or browser profiles, and can't add programs to the Windows Startup folder. It also can't run commands, users can't add MCP servers of their own, and the agent asks before every file change.

OS policy:

```json
{
  "disableInternetAccess": true,
  "deniedPaths": [
    "~\\.aws",
    "~\\.ssh",
    "~\\.midway",
    "~\\AppData\\Local\\Microsoft\\Edge\\User Data",
    "~\\AppData\\Local\\Google\\Chrome\\User Data",
    "~\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup"
  ]
}
```

Agent Harness policy:

```json
{
  "permissionMode": "default",
  "disallowedTools": ["PowerShell", "WebFetch"],
  "allowManagedMcpServersOnly": true,
  "workingDirectories": ["D:\\Projects\\Billing"]
}
```

### Open-dev
<a name="agentic-sample-open-dev"></a>

For everyday development. The agent has internet access, edits files without asking, runs a few common commands without asking, and can't push code.

OS policy:

```json
{
  "disableInternetAccess": false
}
```

Agent Harness policy:

```json
{
  "permissionMode": "acceptEdits",
  "allowedTools": ["PowerShell(git status)", "PowerShell(git diff)", "PowerShell(npm test)"],
  "disallowedTools": ["PowerShell(git push *)"],
  "workingDirectories": ["D:\\Projects"]
}
```

## Create and delete policies
<a name="agentic-create-delete-policies"></a>

Create  
In the Agentic Catalog, choose the **Policies** section. To use the API, use `CreateWorkspaceEnforcedPolicy` or `CreateAgentEnforcedPolicy`. A policy can be up to 1 MB.

Apply  
Choose the policies when you create a persona configuration. To change the policy of an existing WorkSpace, use `AssociateWorkspaceEnforcedPolicy` or `AssociateAgentEnforcedPolicy`. Each WorkSpace has exactly one policy of each type.

Change  
You can't edit a policy. Create a new policy with a new name, associate your WorkSpaces with it, and then delete the old one. You can't delete a policy that a WorkSpace or persona configuration uses.

If a policy is rejected  
For example, because of a misspelled setting name, none of it is applied and the WorkSpace keeps its previous policy.