> ## Documentation Index
> Fetch the complete documentation index at: https://docs.endorlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Coding Agent Governance policies

> Block dangerous commands, restrict file access, and gate MCP server use with allow and deny patterns for AI coding agents.

Coding Agent Governance policies tell hooks how to react to risky agent activity in real time. Most policies combine a template, a set of patterns, and an action. When a matching event arrives, the hook applies the action before the agent runs the operation.

Endor Labs provides more than 50 system policies. Almost all are enabled by default, so enforcement starts as soon as you deploy hooks. They restrict destructive commands, secret and credential access, risky git and publish operations, known-malicious MCP servers, and attempts to bypass the Package Firewall.

These policies also ask before riskier-but-routine actions, such as installing packages or force-pushing a branch. See [Out-of-the-box policies](#out-of-the-box-policies) to review the complete list.

You can change any system policy for your namespace. You can override it with a policy of the same name and a different action, turn it off in the policy list, or author your own from the same templates. See [Policy propagation across namespaces](#policy-propagation-across-namespaces) to scope an override to one namespace.

The following templates are available:

* [**File Access**](#file-access): Control reads, writes, edits, and deletes in the workspace.
* [**Command Execution**](#command-execution): Control the shell commands an agent runs.
* [**Auto Mode**](#auto-mode): Let an AI judge review shell commands, with context about your deployment.
* [**MCP Server Access**](#mcp-server-access): Control which MCP servers and tools an agent calls.
* [**MCP Server Posture**](#mcp-server-posture): Match MCP servers by name or by Endor Labs score.
* [**Skill Access**](#skill-access): Control which skills run, by name or by Endor Labs score.
* [**Session Posture**](#session-posture): Match sessions by user, sandbox, and models.
* [**Malware**](#malware): Check the packages an agent installs against the Endor Labs malware feed.
* [**Secrets**](#secrets): Scan content the agent writes or reads for leaked secrets.
* [**Dependency Risk**](#dependency-risk): Check the dependencies an agent adds for known vulnerabilities. Create it through the REST API, because the policy form doesn't offer it yet.

Hooks evaluate events against the policy snapshot they read from the namespace.

## Manage Coding Agent Governance policies

To open Coding Agent Governance policies:

1. Select **User menu** > **Policies & Rules** from the left sidebar.
2. Select **Agent Governance**.

### View Coding Agent Governance policies

On the **Agent Governance** listing, you can view policies grouped by what they govern:

* **All Policies** for every policy in scope.
* **Coding Agents** for command execution and auto mode policies.
* **MCP Servers** for MCP server and tool access policies.
* **File Access** for file-operation policies.
* **Skills** for skill policies.
* **MCP Server Posture** for policies that match MCP servers by Endor Labs score.
* **Sessions** for session posture policies.
* **Malware** for malware check policies.
* **Secrets** for secrets check policies.

Dependency risk policies have no view of their own. They appear under **All Policies**.

### Create a Coding Agent Governance policy

1. Click **Create Agent Governance Policy**.
2. Under **Define a Policy**, choose a template under **Policy Template**:
   * **File Access** under **Coding Agents**: Control reads, writes, deletes, and edits in the workspace.
   * **Command Execution** under **Coding Agents**: Control the shell commands the agent runs.
   * **Auto Mode** under **Coding Agents**: Let an AI judge review shell commands. This template has no list type or action steps. See [Create an auto mode policy](#create-an-auto-mode-policy) to fill in its fields.
   * **MCP Server Access** under **MCP Servers**: Control which MCP servers and tools the agent can call.
   * **MCP Server Posture** under **MCP Servers**: Match MCP servers by name or by Endor Labs score.
   * **Skill Access** under **Skills**: Control which skills can run, by name or by Endor Labs score.
   * **Session Posture** under **Sessions**: Match sessions by user identity, sandbox, and models.
   * **Malware** under **Secure Coding**: Block installs of known-malicious packages, verified against the Endor Labs malware feed.
   * **Secrets** under **Secure Coding**: Scan file content the agent writes or reads for exposed secrets.
3. Under **List Type**, choose **Allowlist** to permit only matching items, or **Blocklist** to block matching items. The **Malware** and **Secrets** templates don't show **List Type**.
4. Fill in the fields the template exposes. See [Templates and patterns](#coding-agent-governance-templates-and-patterns) to look up the field names and pattern syntax for each template.
5. Under **Choose an Action**, select the action your hook should take when an event matches:
   * **Block** stops the action and returns a deny response to the agent.
   * **Alert** lets the action proceed and records the event under **Policy Violations**.
   * **Ask Permission** pauses the agent until the developer approves or denies, where the agent supports it.
   * **AI Judged** hands the matched command to the AI judge, which decides the action. It appears for **Command Execution** policies and is unavailable when **Intent** is **Governance**. See [AI Judged action](#ai-judged-action) to review how it behaves.
6. Optional: Fill in **User Message**. The developer sees it when the policy fires, if the agent hook response can carry the message. A **Block** policy also sends it to the agent inside a deny response that names the policy category and warns against working around the block. An **AI Judged** policy has no message fields, because the agent sees the judge's reason instead.
7. Optional: For a **Command Execution** policy, choose **Risk** or **Governance** under **Intent**. **Risk** is the default. See [Policy intent](#policy-intent) to choose between them.
8. Optional: Under **Inventory Classification**, choose **Allow** or **Block** to tag the MCP servers or skills the policy matches. **None**, the default, applies no tag. The selector appears for the **MCP Server Posture** and **Skill Access** templates. See [Inventory classification](#inventory-classification) to review how each tag affects inventory.
9. Under **Name Your Policy**, enter a **Name** that describes what the policy does.
10. Click **Create Agent Governance Policy**.

The policy is now active. Local hooks pick it up at the next session start.

Endor Labs stores the **Agent Message** field on the policy but does not currently deliver it to the agent.

The form groups templates by what the agent is doing, while the **Agent Governance** policy listing groups them by what they govern. You can view **File Access** under **Coding Agents** in the form, but its policies appear under **File Access** in the listing.

## Coding Agent Governance templates and patterns

Each template targets one activity type and exposes the fields that activity uses.

All pattern fields use regular expressions, not globs. Anchor with `^` and `$` to match the full string, and escape literal characters such as `.` and `/`.

### File Access

Use this template to govern reads, writes, deletes, and edits in the workspace.

* **File Operation**: Choose **Any**, **Read**, **Write**, **Delete**, or **Edit**.
* **File Name Patterns**: Regex patterns matched against file paths. Add one pattern per row with **+ Add file pattern**.
* **Example blocklist patterns**: `.*\.env$`, `.*\.pem$`, `.*/secrets/.*`.

### Command Execution

Use this template to govern shell commands the agent runs.

* **Custom Command Patterns**: Regex patterns matched against shell commands. Add one pattern per row with **+ Add command**.
* **Example blocklist patterns**: `^rm\s+-rf\s+/`, `^curl\s+.*\|\s*(sh|bash)\b`.

### Auto Mode

Use this template to turn on the AI judge for shell commands. The policy has no patterns, list type, or action.

* **Judge Scope**: Choose which commands the judge reviews: **Off**, **Matched commands only**, or **All commands**.
* **Deployment Context**: Optional facts about your environment, such as which hosts and registries are yours. Separate entries with a blank line.

See [Auto mode and the AI judge](#auto-mode-and-the-ai-judge) to review what each scope does and the limits on deployment context.

### MCP Server Access

Use this template to govern which MCP servers and tools your agents can call.

* **Server Name Patterns**: Regex patterns matched against MCP server names. Add one pattern per row with **+ Add server pattern**.
* **Tool Name Patterns**: Regex patterns matched against MCP tool names. Add one pattern per row with **+ Add tool pattern**.
* **Example blocklist patterns**: `.*-prod$` for any production server, or `.*delete.*` for tool names that include `delete`.

### MCP Server Posture

Use this template to match MCP servers by name, by Endor Labs score, or both. It scores server-level posture rather than individual tool calls, so reach for it when you want to gate on how risky a server is.

* **Server Name Patterns**: Regex patterns matched against MCP server names.
* **Overall score at or below**: Match when the server's Endor Score (`1`-`10`, higher is safer) is at or below this value. Leave blank to ignore the overall score.
* **Per-dimension thresholds**: Optionally match on one dimension instead of the overall score: **Supply Chain & Provenance**, **Authentication & Authorization**, **Operational Hygiene**, or **Input Validation & Injection**.

When you set both a name pattern and a score threshold, a server must match the name and a threshold. See [Endor Score](https://docs.endorlabs.com/agent-governance/endor-score.md) to learn how Endor Labs computes MCP server scores.

### Skill Access

Use this template to control which agent skills can run, by name, by Endor Labs skill score, or both.

* **Skill Name Patterns**: Regex patterns matched against skill names.
* **Overall score at or below**: Match when the skill's Endor Score (`1`-`10`, higher is safer) is at or below this value. Leave blank to ignore the overall score.
* **Per-dimension thresholds**: Optionally match on one dimension: **Instruction Integrity**, **Data Protection**, **Permission Boundaries**, or **External Dependencies**.

When you set both a name pattern and a score threshold, a skill must match the name and a threshold. See [Endor Score](https://docs.endorlabs.com/agent-governance/endor-score.md) to learn how Endor Labs computes skill scores.

### Session Posture

Use this template to match agent sessions by posture: who runs the session, whether it is sandboxed, and which models it uses. Each group is optional, so leave a group empty to ignore it.

* **User name patterns**: Regex patterns matched against the session user, such as `svc-.*` or `.*@example\.com`.
* **Sandbox enabled**: Choose **Yes** or **No** to match sessions whose configuration turns the sandbox on or off at any level. **Any** ignores the setting.
* **Default model patterns**: Regex patterns matched against the session's default model, such as `gpt-.*`.
* **Available model patterns**: Regex patterns matched against the models offered to the session, such as `claude-.*`.

#### Match on more session configuration through the REST API

The policy form exposes the four criteria above. Through the REST API, a session policy can match on more of the session's configuration, read from the agent's config at any level (repository, user, or enterprise). Every group you set must match, and Endor Labs ignores an empty group. Set these fields on the session activity.

* `composer_mode_matchers`: Regex matched against the composer mode, such as `agent`, `ask`, or `edit`.
* `source_matchers`: Regex matched against how the session started, such as `startup`, `resume`, or `clear`.
* `is_background_agent`: Match sessions by whether they run as a background agent.
* `sandbox.fail_if_unavailable`: Match sessions by whether they require the sandbox to be available.
* `sandbox.allowed_host_matchers`: Regex matched against the sandbox's allowed network hosts, to catch overly permissive rules such as `.*`.
* `permissions.default_mode_matchers`: Regex matched against the permission default mode, such as `bypassPermissions`.
* `permissions.bypass_disabled`: Match sessions by whether permission bypass is disabled.
* `permissions.allowed_command_matchers` and `permissions.denied_command_matchers`: Regex matched against the session's allowed and denied command lists.
* `hook.event_name_matchers`: Regex matched against configured hook event names, such as `PostToolUse`.
* `hook.command_matchers`: Regex matched against configured hook command strings, such as `curl .* | bash`.

Manage a policy that uses these fields through the API end to end. Saving a policy from the form rebuilds its activity from the fields the form exposes, which drops any REST-only criteria without warning. The one exception is [sandbox posture](#match-on-sandbox-posture), which the form keeps.

#### Match on sandbox posture

A session policy can match the session's resolved sandbox posture, the same posture the [Sandboxing](https://docs.endorlabs.com/agent-governance/inventory.md#sandbox-posture) tab reports. **Sandbox enabled** reads only the raw configuration. The posture reflects the agent's own rules, such as defaults, precedence, and whether the sandbox can start on the host.

Set `sandbox.postures` on the session activity through the REST API to one or more of the following values. The policy form cannot set it.

* `SESSION_SANDBOX_POSTURE_DISABLED`: The configuration turns the sandbox off for the session.
* `SESSION_SANDBOX_POSTURE_ENABLED`: The configuration turns the sandbox on for the session.
* `SESSION_SANDBOX_POSTURE_UNKNOWN`: The agent evaluated its configuration but could not determine the posture.

A posture policy must be a blocklist, and `sandbox.postures` must be its only session criterion. Endor Labs rejects other combinations because an older hook can't read postures and would enforce the remaining criteria alone.

The form keeps the posture when you edit the policy, and the policy's detail drawer shows it as **Sandbox posture**. If you switch the policy to an allowlist or add other session criteria, the form shows an error instead of saving. See [Session sandbox policies](#session-sandbox-policies) for two ready-made posture policies.

#### Match on developer identity

When you [connect the Anthropic Compliance API](https://docs.endorlabs.com/agent-governance/claude-code/compliance-api.md), session policies can also match the developer's organization identity. Endor Labs resolves each Claude Code session to a synced directory entry by the developer's Claude account email and attaches the roles and groups it finds. Set these criteria on the session activity's `top_level` group through the REST API. The policy form does not expose them yet.

* `role_matchers`: Regex patterns matched against the developer's Anthropic organization role, such as `admin` or `claude_code_user`. Any match counts.
* `group_matchers`: Regex patterns matched against the developer's organization groups, such as `platform` or `security`. Any match counts.

Every identity criterion you set must match, together with any other session criteria on the policy. When the hook cannot resolve a session's identity, it skips policies that use identity criteria, so it never blocks an unresolved session by mistake. Identity matching applies to Claude Code sessions and to session-level events only. See [Connect the Anthropic Compliance API](https://docs.endorlabs.com/agent-governance/claude-code/compliance-api.md) to enroll your organization, learn how the hook resolves the email, and see a full policy example.

### Malware

Use this template to check the packages an agent installs, or adds to a manifest or lockfile, against the Endor Labs malware feed. The policy has no patterns to write. Matching the activity means running the check, and the block or allow verdict comes from the feed.

* **Ecosystems**: Optional list that narrows the check to specific ecosystems. An empty list checks every ecosystem. The valid values are `npm`, `pypi`, `go`, `mvn`, `nuget`, `packagist`, `cargo`, `gem`, `apk`, `debian`, and `rpm`, and Endor Labs rejects any other value when you save the policy. The form doesn't offer Maven, so set `mvn` through the REST API.

Choose **Malware** under **Secure Coding** in the policy form, or create the policy through the REST API. See [Secure coding checks](https://docs.endorlabs.com/agent-governance/secure-coding.md#malware-check) to review what the check inspects, the evidence a violation includes, and a full creation example.

### Secrets

Use this template to scan content the agent writes or reads for secrets, using the Endor Labs secret detection rules. The policy has no patterns to write. Matching the activity means running the scan, and the verdict comes from the detection rules.

* **File Operations**: Optional list of the operations to scan: **Write**, **Edit**, or **Read**. The form selects **Write** and **Edit** by default. Read scanning is opt-in because it reads each file from disk. Through the REST API, an empty `file_operations` list scans writes and edits, and a non-empty list replaces that default.
* **Include File Patterns**: Optional regex list that limits scanning to matching paths. An empty list scans every file the event covers.
* **Exclude File Patterns**: Optional regex list that skips paths such as test fixtures or vendored directories. Exclusions apply after inclusions.
* **Include Rule IDs**: Optional list that limits the policy to specific detection rules, matched exactly against rule IDs such as `aws-access-token`. An empty list acts on every rule in your effective ruleset.
* **Exclude Rule IDs**: Optional list that mutes rules whose matches are false positives in your codebase. Exclusions apply after inclusions.

Choose **Secrets** under **Secure Coding** in the policy form, or create the policy through the REST API. See [Secure coding checks](https://docs.endorlabs.com/agent-governance/secure-coding.md#secrets-check) to review what the scan detects and what a violation includes.

### Dependency Risk

Use this template to check the dependencies an agent adds against Endor Labs vulnerability data. The policy has no patterns to write, and the verdict comes from the advisories that match.

* `ecosystems`: Optional list of ecosystems to check: `npm`, `pypi`, `go`, or `mvn`. An empty list checks every supported ecosystem.
* `min_cvss_severity`: The lowest advisory severity that matches. Unset means `SEVERITY_HIGH`.
* `include_transitives`: Set to `true` to also check the packages each new dependency pulls in. Unset means `false`.
* `include_file_patterns` and `exclude_file_patterns`: Optional regex lists that limit which manifests and lockfiles the check reads.

Create and edit dependency risk policies through the REST API. The policy form does not author them yet. See [Dependency risk check](https://docs.endorlabs.com/agent-governance/secure-coding.md#dependency-risk-check) to review what the check inspects and a full creation example.

## Allowlist or blocklist

Choose **Allowlist** when you want to permit a small, known set of items and block everything else. Use it for sensitive areas, such as production credentials or a curated set of approved MCP servers.

Choose **Blocklist** when you want to permit most activity and block known-dangerous items. Use it for destructive commands, leaked-secret paths, and unapproved MCP servers.

## Actions

Each policy except an auto mode policy applies one of the following actions on a match.


&#x20; \- Action: \*\*Block\*\*
&#x20; Developer machine: The agent stops the action. The developer sees the \*\*User Message\*\*, where the hook response can carry it.
&#x20; Endor Labs: A row appears under \*\*Policy Violations\*\* with the action recorded as \*\*Blocked\*\*.
&#x20; \- Action: \*\*Ask Permission\*\*
&#x20; Developer machine: The agent pauses until the developer confirms or denies, where the agent supports it.
&#x20; Endor Labs: A row appears under \*\*Policy Violations\*\* with the action recorded as \*\*Ask\*\*.
&#x20; \- Action: \*\*Alert\*\*
&#x20; Developer machine: The action proceeds. The developer sees nothing.
&#x20; Endor Labs: A row appears under \*\*Policy Violations\*\* with the action recorded as \*\*Alert\*\*.
&#x20; \- Action: \*\*AI Judged\*\*
&#x20; Developer machine: The AI judge labels the command. The command runs, pauses for confirmation, or stops, and the agent sees the judge's reason.
&#x20; Endor Labs: An ask or block from the judge appears under \*\*Policy Violations\*\* as \*\*Ask\*\* or \*\*Blocked\*\*, or as \*\*Alert\*\* in audit-only mode.
&#x20;&#x20;

**AI Judged** applies to **Command Execution** policies only. See [AI Judged action](#ai-judged-action) to review how each label maps to an outcome.

For **Command Execution** and **File Access** policies, a **Block** or **Ask Permission** message also quotes the text that matched. The quote shows which part of a long command or file path fired the rule, up to 256 characters.

Agents differ in where they can pause for an **Ask Permission** policy. See [Enforcement behavior](https://docs.endorlabs.com/agent-governance/how-it-works.md#enforcement-behavior) to review the per-agent behavior.

## Auto mode and the AI judge

The AI judge is a large language model (LLM) that reviews a shell command and labels it benign, review, or suspicious. Command patterns catch what you anticipated, and the judge weighs what the command actually does in context.

Judging is off by default. Turn it on with an auto mode policy whose **Judge Scope** is not **Off**, or with a **Command Execution** policy that uses the **AI Judged** action. See [How the AI judge reviews commands](https://docs.endorlabs.com/agent-governance/how-it-works.md#how-the-ai-judge-reviews-commands) to review what the hook sends and how judging affects latency.

### How the judge's label decides the outcome

What the judge reviews, and what its label does, depends on how you turned it on.


&#x20; \- Turned on by: AI Judged action
&#x20; Judge reviews: Commands that policy matched
&#x20; Benign: The judge releases the match
&#x20; Review: Ask
&#x20; Suspicious: Block
&#x20; No answer: The judge releases the match
&#x20; \- Turned on by: Auto mode, Matched commands only
&#x20; Judge reviews: Commands that a \*\*Risk\*\* command policy matched
&#x20; Benign: The judge releases the match
&#x20; Review: Ask
&#x20; Suspicious: Block
&#x20; No answer: The policy's own action applies
&#x20; \- Turned on by: Auto mode, All commands
&#x20; Judge reviews: Every command
&#x20; Benign: \*\*Risk\*\* command policies stand down
&#x20; Review: Ask
&#x20; Suspicious: Block
&#x20; No answer: Command policies decide
&#x20;&#x20;

A released match contributes no action, so the command runs unless another policy matches it. Under **All commands**, an ask or block from the judge replaces every **Risk** command match and appears under **Policy Violations** against the auto mode policy. When a review or suspicious label comes back, the agent sees the judge's reason in the ask or block message.

The judge never overrides a **Governance** policy, under any scope. A **Governance** match keeps its own action next to whatever the judge decides. See [Policy intent](#policy-intent) to mark a policy as **Governance**.

The judge reviews shell commands only. File access, MCP, session, malware, and secrets policies keep their own actions.

When audit-only mode is on (`ENDOR_AI_AUDIT_NO_BLOCKING=true`), a suspicious label records an alert instead of blocking. A review label still asks.

### Create an auto mode policy

An auto mode policy chooses which commands the judge reviews and gives it context about your environment.

1. Click **Create Agent Governance Policy**.
2. Under **Define a Policy**, choose **Auto Mode** under **Policy Template**.
3. Under **Judge Scope**, choose which commands the judge reviews:
   * **Off**: The judge rules on nothing by itself. The policy only supplies deployment context to **AI Judged** command policies.
   * **Matched commands only**: The judge rules on commands that a command policy flagged, and its label replaces that policy's action. **Governance** policies keep their action.
   * **All commands**: The judge rules on every command, and command policies no longer decide, except **Governance** policies.
4. Optional: Under **Deployment Context**, enter facts about your environment, such as your internal hosts and registries. Separate the entries with a blank line.
5. Under **Name Your Policy**, enter a **Name**.
6. Click **Create Agent Governance Policy**.

![Auto Mode policy template with the Judge Scope options and the Deployment Context field](https://mintcdn.com/endorlabs-b4795f4f/jrEXBwlTGUeHcNwa/images/agent-governance/policy-form-auto-mode.webp?fit=max\&auto=format\&n=jrEXBwlTGUeHcNwa\&q=85\&s=eeb910824f82033db6a5f29e3b0b72ad)

> [!WARNING]
>
> Under **Matched commands only** or **All commands**, a **Risk** allowlist no longer limits what runs. A command outside the permitted patterns runs if the judge finds it benign. To keep an allowlist final, set its intent to **Governance**.

Keep the following rules in mind when you write auto mode policies:

* Only one auto mode policy applies to each event: the one with the most [scope](#scope-a-policy-by-repository-or-user) fields set, with the alphabetically first name breaking a tie. Other matching auto mode policies stay enabled but do nothing.
* Endor Labs rejects an unscoped auto mode policy with **Judge Scope** set to **Off** and no deployment context, because it does nothing. A scoped policy with the same settings is valid, and it turns judging off for the repositories or users it matches.
* **Deployment Context** holds at most 64 entries, each 4,096 bytes or fewer, and 8,192 bytes in total. In the form, an entry that contains a blank line splits into two entries.

The system policy **Auto mode: judge commands that matched a risk policy** uses **Matched commands only** and ships disabled. Enable it to start judging without writing your own policy.

### AI Judged action

The **AI Judged** action hands a command policy's own matches to the judge, which picks the outcome. Use it for patterns that are too broad to block outright, such as remote access commands, where the context decides whether the command is safe.

The action has the following constraints:

* It applies only to **Command Execution** policies with **Risk** intent. Endor Labs rejects it on a **Governance** policy.
* The form offers **AI Judged** when you create a policy, and when you edit a policy that already uses it. To move an existing policy to **AI Judged**, create a new policy with that action.
* If the judge returns no answer, the hook releases the match, because an **AI Judged** policy has no action of its own to fall back to.
* The judge reads the deployment context of the auto mode policy that applies to the event, if any.
* endorctl versions earlier than v1.7.1173 do not recognize the action and let the matched command run.

## Policy intent

Each **Command Execution** policy has an intent that controls whether the AI judge can override it:

* **Risk**: The policy flags commands that might be dangerous, and the AI judge can override its action. **Risk** is the default.
* **Governance**: The policy enforces an organizational rule, and its action is final. The judge never releases a **Governance** match.

Choose **Governance** for rules that hold regardless of how safe the command looks, such as no direct pushes to `main` or no package publishing from a developer machine. Intent changes nothing until you turn on the judge.

Set the intent under **Intent** when you create or edit a **Command Execution** policy. Through the REST API, set the `intent` field to `POLICY_INTENT_RISK` or `POLICY_INTENT_GOVERNANCE`. Endor Labs rejects an intent on an auto mode policy.

![Command Execution policy form with the AI Judged action and the Intent select](https://mintcdn.com/endorlabs-b4795f4f/jrEXBwlTGUeHcNwa/images/agent-governance/policy-form-command-execution.webp?fit=max\&auto=format\&n=jrEXBwlTGUeHcNwa\&q=85\&s=50e428ebd435f796f379a1bb1c4252c0)

Five of the [command execution policies](#command-execution-policies) ship with **Governance** intent, as the **Intent** column shows. Every command policy in [Package Firewall bypass protection](#package-firewall-bypass-protection) also has **Governance** intent.

## Inventory classification

Besides taking an action, a policy can tag the MCP servers and skills it matches in your inventory. Choose a value under **Inventory Classification** when you create a policy from the **MCP Server Posture** or **Skill Access** template. The tag is independent of the action, so a policy can block and tag, tag only, or act only.

The tag sets the item's review status in your inventory. **Allow** marks the item **Approved**. **Block** marks it **Blocked** (skills show **Unapproved**).

When more than one policy matches the same item, **Block** beats **Allow**. The inventory record keeps the name of the policy that set each tag as evidence. Classification follows your current policy set, so turning a policy off lets the next event reclassify the item. Items no classification policy has matched show **Unreviewed**.

These tags feed the **Blocked** summary cards on the MCP Servers and Skills inventory tabs. See [Review your agent inventory](https://docs.endorlabs.com/agent-governance/inventory.md) to read them.

## Scope a policy by repository or user

Through the REST API, a policy can have a scope that limits which events it applies to. A scope holds two regex lists:

* `scope.repository_matchers`: The event's repository must match at least one pattern.
* `scope.user_matchers`: The event's user must match at least one pattern.

Within a list, any match counts. When you set both lists, both must match. A policy without a scope applies to every event, and an event that misses the scope skips the policy for both allowlists and blocklists.

The policy form does not expose scope fields yet, but editing a scoped policy in the form preserves its scope. Repository scoping does not yet take effect for Claude Code sessions, which report no repository value. User scoping works across agents today.

Scope differs from the **Session Posture** template: a session policy matches session events only, while a scope restricts a policy of any template.

## Out-of-the-box policies

Every namespace inherits these system policies. Most are enabled by default and appear in the **Agent Governance** policy list next to the policies you create, under the exact names shown below.

The tables mark the exceptions, which are disabled by default. These are the auto mode, malware, secrets, dependency risk, and session sandbox policies, plus the environment variable export and recursive-grep policies. Enable a disabled policy to turn it on for a namespace. An override matches on the policy name, so use these names verbatim when you override one.

To change a policy for a namespace, override it instead of deleting it. See [Policy propagation across namespaces](#policy-propagation-across-namespaces) to scope an override.

### MCP server policies

These policies govern MCP server and tool calls.


&#x20; \- Policy: MCP tool call: match dangerous tool patterns
&#x20; What it matches: Database or SQL MCP tools whose input looks like \`delete\` or \`drop\`
&#x20; Action: Ask
&#x20; \- Policy: MCP: blocklist — known-malicious MCP servers
&#x20; What it matches: MCP servers on the known-malicious blocklist (\`mcp-runcmd-server\`, \`mcp-runcommand-server\`, \`mcp-runcommand-server2\`), reported by JFrog as reverse-shell payloads
&#x20; Action: Block
&#x20;&#x20;

### Command execution policies

These policies govern the shell commands an agent runs. Blocked commands stop outright, and Endor Labs records alerted commands as they proceed. Asked commands wait for the developer to confirm, where the agent supports it. The **Intent** column shows whether the AI judge can override the policy. See [Policy intent](#policy-intent) to review what each intent means.


&#x20; \- Policy: CmdLine: block destructive filesystem commands
&#x20; What it matches: \`rm -r\`, \`dd\`, \`mkfs\`, \`shred\`, and \`find\` with \`-delete\` or \`-exec rm\` against system or home directories
&#x20; Action: Block
&#x20; Intent: Risk
&#x20; \- Policy: CmdLine: block privilege escalation commands
&#x20; What it matches: \`sudo\`, \`su\`, \`doas\`, \`chown\`, \`chmod 777\`
&#x20; Action: Block
&#x20; Intent: Risk
&#x20; \- Policy: CmdLine: alert on inline code execution
&#x20; What it matches: \`python -c\`, \`node -e\`, \`bash -c\`, \`sh -c\`, or \`eval\` when the snippet shells out, reaches the network, or evaluates code
&#x20; Action: Alert
&#x20; Intent: Risk
&#x20; \- Policy: CmdLine: block download-and-execute pipelines
&#x20; What it matches: A \`curl\` or \`wget\` download piped into a shell
&#x20; Action: Block
&#x20; Intent: Risk
&#x20; \- Policy: CmdLine: block credential discovery and staging
&#x20; What it matches: \`find\` commands that hunt for credential files (such as \`id\_rsa\` or \`.netrc\`) or walk credential directories (such as \`\~/.aws\` or \`\~/.gnupg\`)
&#x20; Action: Block
&#x20; Intent: Risk
&#x20; \- Policy: CmdLine: ask before dangerous git operations
&#x20; What it matches: \`git commit --no-verify\`, \`git reset --hard\`
&#x20; Action: Ask
&#x20; Intent: Governance
&#x20; \- Policy: CmdLine: ask before direct push to main/master
&#x20; What it matches: \`git push\` to \`main\` or \`master\`
&#x20; Action: Ask
&#x20; Intent: Governance
&#x20; \- Policy: CmdLine: block package and artifact publish commands
&#x20; What it matches: \`npm publish\`, \`yarn publish\`, \`pnpm publish\`, \`cargo publish\`, \`gem push\`, \`twine upload\`, \`docker push\`, \`docker buildx build --push\`, \`helm push\`
&#x20; Action: Block
&#x20; Intent: Governance
&#x20; \- Policy: CmdLine: ask before publishing to a public GitHub location
&#x20; What it matches: \`gh repo create --public\`, \`gh repo edit --visibility public\`, \`gh gist create --public\`, and \`gh gist\` or \`gh release\` commands that upload an image file
&#x20; Action: Ask
&#x20; Intent: Governance
&#x20; \- Policy: CmdLine: block network exfiltration tools
&#x20; What it matches: \`nc\`, \`ncat\`, \`ftp\`, and \`scp\` or \`rsync\` with a remote destination
&#x20; Action: Block
&#x20; Intent: Risk
&#x20; \- Policy: CmdLine: block shell reads of secret files
&#x20; What it matches: \`cat\`, \`xxd\`, and similar commands that read \`.env\`, key material, or other credential files
&#x20; Action: Block
&#x20; Intent: Risk
&#x20; \- Policy: CmdLine: block shell writes to shell profile files
&#x20; What it matches: Shell-side writes to startup files, including redirects (\`>>\`), \`tee\`, \`sed -i\`, \`cp\` or \`mv\` onto a profile, and interpreter one-liners that write one. Reads stay clear
&#x20; Action: Block
&#x20; Intent: Risk
&#x20; \- Policy: CmdLine: ask before force push
&#x20; What it matches: \`git push --force\` or \`--force-with-lease\`
&#x20; Action: Ask
&#x20; Intent: Governance
&#x20; \- Policy: CmdLine: ask before network download or remote access
&#x20; What it matches: \`wget\`, \`ssh\`, and \`curl\` when it uploads or sends a write request (\`-d\`, \`-F\`, \`-T\`, or \`-X POST\`, \`PUT\`, \`PATCH\`, \`DELETE\`)
&#x20; Action: Ask
&#x20; Intent: Risk
&#x20; \- Policy: CmdLine: ask before environment variable export
&#x20; What it matches: \`export\` of a variable whose name looks credential-bearing (contains \`TOKEN\`, \`KEY\`, \`SECRET\`, \`PASSWORD\`, \`PASSWD\`, \`CREDENTIAL\`, or \`AUTH\`). \`GIT\_AUTHOR\_\*\` variables don't match. Values that start with \`/\`, \`\~\`, \`.\`, or \`\$\`, such as a file path or a variable reference, don't match either. Disabled by default
&#x20; Action: Ask
&#x20; Intent: Risk
&#x20; \- Policy: CmdLine: ask before package installation or container commands
&#x20; What it matches: \`npm install\` and \`pip install\` when they name a package to fetch, \`cargo install\`, \`gem install\`, \`docker run\`, \`docker pull\`. An install of only the packages a manifest declares, such as a bare \`npm install\`, \`pip install -r requirements.txt\`, or \`pip install -e .\`, doesn't prompt
&#x20; Action: Ask
&#x20; Intent: Risk
&#x20; \- Policy: CmdLine: ask before recursive grep
&#x20; What it matches: Recursive \`grep -r\`, \`rg\`, or \`rgrep\` that can sweep secret values into the transcript. Disabled by default
&#x20; Action: Ask
&#x20; Intent: Risk
&#x20;&#x20;

### File access policies

These policies guard sensitive paths. Each blocks on a match and covers reads, writes, edits, and deletes, unless noted.


&#x20; \- Policy: FileAccess: block access to env files and secrets
&#x20; Paths it blocks: \`.env\`, \`.dev.vars\`, \`secrets/\`, \`config/database.yml\`, \`.netrc\`, and any file whose name ends in \`secret\`, \`secrets\`, \`credential\`, or \`credentials\`. Reads only
&#x20; \- Policy: FileAccess: block access to TLS/PKI key material
&#x20; Paths it blocks: \`.key\`, \`.pem\`, \`.p12\`, \`.pfx\`, \`.crt\`. Reads only
&#x20; \- Policy: FileAccess: block access to SSH keys and config
&#x20; Paths it blocks: \`\~/.ssh/\`
&#x20; \- Policy: FileAccess: block access to cloud provider credentials
&#x20; Paths it blocks: \`\~/.aws/\`, \`\~/.azure/\`, \`\~/.config/gcloud/\`
&#x20; \- Policy: FileAccess: block access to git credential files
&#x20; Paths it blocks: \`.gitconfig\`, \`.git-credentials\`, \`.git/config\`
&#x20; \- Policy: FileAccess: block access to container and Kubernetes credentials
&#x20; Paths it blocks: \`\~/.docker/config.json\`, \`\~/.kube/\`, \`\~/.config/helm/\`
&#x20; \- Policy: FileAccess: block access to package manager token files
&#x20; Paths it blocks: \`\~/.cargo/credentials\`, \`\~/.cargo/credentials.toml\`, \`.pypirc\`, \`\~/.gem/credentials\`
&#x20; \- Policy: FileAccess: block access to vault and password manager tokens
&#x20; Paths it blocks: \`.vault-token\`, \`\~/.config/op/\` (1Password), \`\~/.config/bw/\` (Bitwarden)
&#x20; \- Policy: FileAccess: block access to shell history files
&#x20; Paths it blocks: \`.bash\_history\`, \`.zsh\_history\`, fish history
&#x20; \- Policy: FileAccess: block access to CI/CD and platform deployment tokens
&#x20; Paths it blocks: \`\~/.config/gh/\`, \`\~/.fly/\`, \`\~/.config/heroku/\`, \`\~/.config/vercel/\`
&#x20; \- Policy: FileAccess: block access to Terraform credentials
&#x20; Paths it blocks: \`.terraformrc\`, \`\~/.terraform.d/\`
&#x20; \- Policy: FileAccess: block access to database credential files
&#x20; Paths it blocks: \`.pgpass\`, \`.my.cnf\`, \`\~/.mongosh/\`
&#x20; \- Policy: FileAccess: block access to cryptocurrency wallet data
&#x20; Paths it blocks: Application data for MetaMask, Electrum, Exodus, Phantom, and Solflare
&#x20; \- Policy: FileAccess: block access to GPG keys and system keychains
&#x20; Paths it blocks: \`\~/.gnupg/\`, macOS \`\~/Library/Keychains/\`
&#x20; \- Policy: FileAccess: block writes to shell profile files
&#x20; Paths it blocks: \`.zshrc\`, \`.zshenv\`, \`.zprofile\`, \`.zlogin\`, \`.bashrc\`, \`.bash\_profile\`, \`.bash\_login\`, \`.profile\`, to prevent persistence. Companion policies block edits and deletes (\`FileAccess: block edits to shell profile files\`, \`FileAccess: block deletes of shell profile files\`)
&#x20; \- Policy: FileAccess: block deletes of GitHub Actions workflows
&#x20; Paths it blocks: Deletes under \`.github/workflows/\`. Companion policies ask before writes and edits instead of blocking (\`FileAccess: ask before writing GitHub Actions workflows\`, \`FileAccess: ask before editing GitHub Actions workflows\`). The policy allows reads
&#x20; \- Policy: FileAccess: block self-modification of Claude configuration (write)
&#x20; Paths it blocks: Writes to \`.claude/settings.json\`, \`.claude/settings.local.json\`, \`.claude/CLAUDE.md\`, \`.claude/hooks/\`. Companion \`(edit)\` and \`(delete)\` policies cover the other operations. The policy allows reads. Stops the agent loosening its own guardrails
&#x20;&#x20;

### Package Firewall bypass protection

These policies stop an agent from bypassing the Endor Labs Package Firewall by changing where a package manager fetches packages. They are enabled by default and block on a match. Every command policy in this group has **Governance** intent, so the AI judge never overrides it.

The table groups the protection by theme. The **Agent Governance** policy list shows the 10 underlying system policies under their own names, each prefixed with `Package Firewall`.


&#x20; \- Policy: Registry override on install
&#x20; What it blocks: A package install that overrides the registry or index, such as \`npm install --registry\` or \`pip install --index-url\`. The policy also blocks installs from a URL, a \`git+\` source, or a local archive (\`.whl\`, \`.tgz\`, \`.tar.gz\`). Covers npm, pnpm, yarn, npx, pip, uv, bun, gem, mvn, and cargo
&#x20; \- Policy: Direct download from registries or mirrors
&#x20; What it blocks: Fetching package content straight from public registries or CDNs (npmjs, PyPI, jsDelivr, unpkg, esm.sh, and similar) with \`curl\`, \`wget\`, or an inline interpreter
&#x20; \- Policy: Package manager config change
&#x20; What it blocks: Config commands or environment overrides that repoint a package manager, such as \`npm config set registry\`, \`pip config set index-url\`, \`go env -w GOPROXY\`, or \`PIP\_INDEX\_URL\`. The policy also blocks any write, edit, or delete of a config file such as \`.npmrc\`, \`pip.conf\`, \`.yarnrc.yml\`, \`bunfig.toml\`, \`uv.toml\`, \`.netrc\`, \`.cargo/config.toml\`, or \`.gemrc\`
&#x20; \- Policy: Package manager cache tampering
&#x20; What it blocks: Populating or writing a package manager cache to stage an offline install (\`npm cache add\`, \`pip install --no-index\`, or writing into the npm or pip cache directories)
&#x20;&#x20;

### Auto mode policy

When enabled, this policy turns on the [AI judge](#auto-mode-and-the-ai-judge) for commands that a **Risk** command policy matched.


&#x20; \- Policy: Auto mode: judge commands that matched a risk policy
&#x20; Judge scope: \*\*Matched commands only\*\*, with no deployment context. Disabled by default
&#x20;&#x20;

### Malware protection

This policy runs the [malware check](https://docs.endorlabs.com/agent-governance/secure-coding.md#malware-check) instead of matching authored patterns.


&#x20; \- Policy: Malware: block installs of known-malicious packages
&#x20; What it matches: A package install, or a manifest or lockfile edit that adds a package, that the Endor Labs malware feed confirms as malicious, in any ecosystem. Disabled by default
&#x20; Action: Block
&#x20;&#x20;

### Secrets protection

These policies run the [secrets check](https://docs.endorlabs.com/agent-governance/secure-coding.md#secrets-check) instead of matching authored patterns.


&#x20; \- Policy: Secrets: block writes that introduce a credential
&#x20; What it matches: A file write or edit whose content holds a secret, detected by the Endor Labs secret rules. Disabled by default
&#x20; Action: Block
&#x20; \- Policy: Secrets: ask before reading a file that holds a credential
&#x20; What it matches: A file read whose content holds a secret, scanned from disk. Disabled by default
&#x20; Action: Ask
&#x20;&#x20;

### Dependency risk protection

This policy runs the [dependency risk check](https://docs.endorlabs.com/agent-governance/secure-coding.md#dependency-risk-check) instead of matching authored patterns.


&#x20; \- Policy: Dependencies: block adding known-vulnerable packages
&#x20; What it matches: A new dependency, or a package it pulls in, with a high or critical advisory. Disabled by default
&#x20; Action: Block
&#x20;&#x20;

### Session sandbox policies

These policies match sessions whose [sandbox posture](#match-on-sandbox-posture) is disabled. Both are disabled by default. Enable the alert policy first to see which sessions would match before you enable the block policy.


&#x20; \- Policy: Session: alert on unsandboxed sessions
&#x20; What it matches: A session whose sandbox posture is disabled. The developer sees "The agent sandbox is disabled for this session." Disabled by default
&#x20; Action: Alert
&#x20; \- Policy: Session: block unsandboxed sessions
&#x20; What it matches: A session whose sandbox posture is disabled. The developer sees "The agent sandbox is disabled for this session, and policy does not allow that." Disabled by default
&#x20; Action: Block
&#x20;&#x20;

Don't enable the block policy for Claude Code developers whose sandbox turns on only through MDM, managed settings, server-managed settings, or the `--settings` flag. Endor Labs doesn't read those sources yet, so it resolves those sessions as disabled and blocks them.

GitHub Copilot and Snowflake Cortex Code can't stop a session at session start, so a match on a session from either agent only records the violation.

## View, edit, or delete a policy

1. Select **User menu** > **Policies & Rules** from the left sidebar, then select **Agent Governance**.
2. Select the policy name to open its full configuration.
3. To change the policy, edit any field and click **Update Agent Governance Policy**.
4. To remove the policy, confirm in the **Delete this Policy?** prompt. Hooks pick up the deletion at the next session start.

Every policy has a shareable URL that includes the namespace and policy name, so you can send a teammate a direct link to a specific policy.

## Local policy cache

When the agent starts a session, [endorctl ai-audit](https://docs.endorlabs.com/developers-api/cli/commands/ai-audit.md) pulls a snapshot of your policies and writes it to `~/.endorctl/aigovernance/endor-policies-<namespace>.jsonl`. The hook evaluates every event in that session against the cached snapshot, so pattern-based enforcement happens without a network call. Malware and dependency risk policies are the exception: a matching install or manifest edit triggers a live lookup, and the action proceeds if the lookup fails. The [AI judge](#auto-mode-and-the-ai-judge) also calls Endor Labs for each command it reviews.

The cache file uses one JSON object per line, each representing a single policy. You do not need to edit it. If the policy download fails at session start, the hook keeps the last snapshot it fetched, so your overrides stay in effect.

> [!NOTE]
>
> Policy edits take effect at the next session start. New and edited policies take effect on a developer's machine the next time the agent starts a session and refreshes the local policy cache. Tell developers to restart the agent (or open a new session) to pick up policy edits.

## Policy propagation across namespaces

Policies you create in a namespace automatically propagate to its sub-namespaces. The policy form always saves with propagation on, so any policy you save in `acme` shows up for `acme.team-a`, `acme.team-a.proj-1`, and every other descendant. Through the REST API, set the `propagate` field to `false` to keep a policy out of sub-namespaces.

When the **Agent Governance** policy list loads for a namespace, it returns:

* Policies authored in that exact namespace.
* Policies authored in any ancestor namespace.
* Built-in system policies from Endor Labs.

If two policies share the same name across these layers, the closest match wins. For namespace `acme.team-a.proj-1`, a policy named `block-rm-rf` saved in `acme.team-a` overrides the same name in `acme` or the system catalog. A copy saved in `acme.team-a.proj-1` itself overrides all three.

Use the closest-match rule to scope a change narrowly:

* To turn a system or inherited policy off in one namespace, toggle it off from the **Agent Governance** policy list. This creates a local override in that namespace and leaves the policy unchanged in ancestors and siblings.
* To change a system or inherited policy, override it: save a policy with the same name in the namespace where you want the change. Use a team's namespace to scope it to that team, or the tenant root to apply it tenant-wide.
* Toggle a system policy off rather than trying to delete it.

## Next steps

Continue with the following pages:

* See [Deploy hooks for Cursor](https://docs.endorlabs.com/agent-governance/cursor.md), [Claude Code](https://docs.endorlabs.com/agent-governance/claude-code.md), [Codex](https://docs.endorlabs.com/agent-governance/codex.md), [GitHub Copilot](https://docs.endorlabs.com/agent-governance/copilot.md), or [Snowflake Cortex Code](https://docs.endorlabs.com/agent-governance/cortex-code.md) to put your policies in front of agent activity.
* See [Triage policy violations](https://docs.endorlabs.com/agent-governance/policy-violations.md) to set your daily review workflow.
* See [Connect the Anthropic Compliance API](https://docs.endorlabs.com/agent-governance/claude-code/compliance-api.md) to match session policies on your developers' organization roles and groups.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.