-
Notifications
You must be signed in to change notification settings - Fork 8.3k
sbx: restructure governance docs and add API reference #25162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
dvdksn
wants to merge
11
commits into
docker:main
Choose a base branch
from
dvdksn:sbx/governance-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7ebd0db
docs: fix MD019 double space in Grafana MCP guide heading (#25137)
lacatoire e9e6a29
sbx: restructure governance docs and add governance API reference
dvdksn 7befec4
sbx: move governance API reference to /reference/api/ai-governance
dvdksn 4a42373
sbx: use linkTitle "API reference" on the new governance API page
dvdksn c2d81f7
sbx: label the governance API sidebar entries as "AI Governance"
dvdksn d0485c3
sbx: point governance cross-refs at /reference/api/ai-governance
dvdksn 814e3fe
sbx: re-vendor governance API spec from upstream
dvdksn 9989c86
sbx: support arbitrary request/response content types in api-reference
dvdksn addcf27
sbx: re-vendor governance API spec from upstream
dvdksn 59700e1
sbx: update governance cross-references to section landing
dvdksn 3862ba2
sbx: point proxy enforcement links at governance section landing
dvdksn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| --- | ||
| title: Governance | ||
| weight: 55 | ||
| description: Control what sandboxes can access, from local developer rules to org-wide enforcement. | ||
| keywords: docker sandboxes, governance, policy, network access, filesystem access, organization policy | ||
| --- | ||
|
|
||
| Sandbox governance covers the policy system that controls what sandboxes can | ||
| access over the network and on the filesystem. It operates at two layers that | ||
| build on each other: | ||
|
|
||
| **Local policy** is configured per machine using the `sbx policy` CLI. It | ||
| lets individual developers customize which domains their sandboxes can reach. | ||
| See [Local policy](local.md). | ||
|
|
||
| **Organization policy** is configured centrally in the Docker Admin Console or | ||
| via the [Governance API](/reference/api/ai-governance/). Rules defined at the org level apply | ||
| uniformly across every sandbox in the organization and take precedence over | ||
| local rules. Admins can optionally delegate specific rule types back to local | ||
| control so developers can extend the org policy with additional allow rules. | ||
| See [Organization policy](org.md). | ||
|
|
||
| > [!NOTE] | ||
| > Organization governance is available on a separate paid subscription. | ||
| > [Contact Docker Sales](https://www.docker.com/products/ai-governance/#contact-sales) | ||
| > to request access. | ||
| ## Learn more | ||
|
|
||
| - [Policy concepts](concepts.md): resource model, rule syntax, evaluation, | ||
| and precedence | ||
| - [Local policy](local.md): configure network and filesystem rules on your | ||
| machine with the `sbx policy` CLI | ||
| - [Organization policy](org.md): centrally manage sandbox policies across | ||
| your organization from the Admin Console | ||
| - [Monitoring](monitoring.md): inspect active rules and monitor sandbox | ||
| network traffic with `sbx policy ls` and `sbx policy log` | ||
| - [API reference](/reference/api/ai-governance/): manage org policies | ||
| programmatically via the Governance API | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| title: AI Governance API | ||
| linkTitle: AI Governance | ||
| description: Programmatic management of Docker AI Governance policies and rules via HTTP+JSON. | ||
| weight: 30 | ||
| build: | ||
| render: never | ||
| sidebar: | ||
| goto: /reference/api/ai-governance/ | ||
| --- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| --- | ||
| title: Policy concepts | ||
| weight: 5 | ||
| description: The resource model, rule syntax, and evaluation logic behind Docker sandbox governance. | ||
| keywords: docker sandboxes, policy concepts, rule syntax, network rules, filesystem rules, precedence, rule evaluation | ||
| --- | ||
|
|
||
| ## Resource model | ||
|
|
||
| Docker sandbox governance is built around two resource types: **policies** and | ||
| **rules**. | ||
|
|
||
| A **policy** is a named collection of rules that controls sandbox access. | ||
| Policies exist at different levels: | ||
|
|
||
| - **Local**: configured per machine using the `sbx policy` CLI. Applies to | ||
| sandboxes on that machine only. | ||
| - **Organization**: configured in the Docker Admin Console or via the | ||
| [Governance API](/reference/api/ai-governance/). Applies uniformly across every sandbox in the | ||
| organization. | ||
| - **Team**: applies to sandboxes used by a specific team within an | ||
| organization. Coming soon. | ||
|
|
||
| When multiple levels are active, organization policies take precedence over | ||
| local policies. See [Precedence](#precedence). | ||
|
|
||
| A **rule** is the unit of access control within a policy. Each rule has: | ||
|
|
||
| - **Name**: a human-readable label | ||
| - **Actions**: the type of access the rule controls | ||
| - **Resources**: the targets the rule matches against | ||
| - **Decision**: `allow` or `deny` | ||
|
|
||
| Rules are grouped by domain: all rules in a policy must share the same domain, | ||
| either `network` or `filesystem`. | ||
|
|
||
| ## Rule syntax | ||
|
|
||
| ### Network rules | ||
|
|
||
| Network rules use the actions `connect:tcp` and `connect:udp`. Resources are | ||
| hostnames, CIDR ranges, or ports. | ||
|
|
||
| **Hostname patterns** | ||
|
|
||
| | Pattern | Example | Matches | | ||
| | ------- | ------- | ------- | | ||
| | Exact hostname | `example.com` | `example.com` only, not subdomains | | ||
| | Single-level wildcard | `*.example.com` | One subdomain level: `api.example.com` | | ||
| | Multi-level wildcard | `**.example.com` | Any depth: `api.example.com`, `v2.api.example.com` | | ||
| | Hostname with port | `example.com:443` | `example.com` on port 443 only | | ||
|
|
||
| `example.com` and `*.example.com` don't cover each other. Specify both if you | ||
| need to match the root domain and its subdomains. | ||
|
|
||
| **CIDR ranges** | ||
|
|
||
| Both IPv4 and IPv6 notation are supported: `10.0.0.0/8`, `192.168.1.0/24`, | ||
| `2001:db8::/32`. | ||
|
|
||
| ### Filesystem rules | ||
|
|
||
| Filesystem rules use the actions `read` and `write`. Resources are host paths | ||
| that sandboxes can mount as workspaces. | ||
|
|
||
| | Pattern | Example | Matches | | ||
| | ------- | ------- | ------- | | ||
| | Exact path | `/data` | `/data` only | | ||
| | Segment wildcard | `/data/*` | `/data/project`, one path segment only, not subdirectories | | ||
| | Recursive wildcard | `/data/**` | `/data/project`, `/data/project/src`, any depth | | ||
|
|
||
| Use `**` when you intend to match a directory tree recursively. A single `*` | ||
| only matches within one path segment and won't cross directory boundaries. | ||
| For example, `~/**` matches all paths under the home directory, while `~/*` | ||
| matches only direct children of `~`. | ||
|
|
||
| ## Rule evaluation | ||
|
|
||
| All rules in a policy are evaluated against every request. The outcome follows | ||
| two principles: | ||
|
|
||
| **Deny wins.** If any rule matches with `decision: deny`, the request is | ||
| denied regardless of any matching allow rules. | ||
|
|
||
| **Default deny.** Outbound traffic is blocked unless an explicit allow rule | ||
| matches. | ||
|
|
||
| These principles apply within each policy level independently. A deny in an | ||
| organization policy can't be overridden by a local allow. | ||
|
|
||
| ## Precedence | ||
|
|
||
| When only local policies are active, local rules determine what sandboxes can | ||
| access. | ||
|
|
||
| When organization governance is active: | ||
|
|
||
| - Organization rules take effect across all developer machines. | ||
| - Local rules are not evaluated by default. | ||
| - Admins can [delegate](org.md#delegate-rules-to-local-policy) specific rule | ||
| types back to local control. Delegated local rules can expand access for | ||
| targets the organization hasn't explicitly denied, but can't override | ||
| organization-level deny rules. | ||
|
Comment on lines
+100
to
+103
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, not supporting delegation for the time being |
||
|
|
||
| Within any level, deny rules beat allow rules regardless of specificity or | ||
| order. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,159 @@ | ||
| --- | ||
| title: Local policy | ||
| weight: 10 | ||
| description: Configure network access rules for sandboxes on your local machine. | ||
| keywords: docker sandboxes, local policy, network access, allow rules, deny rules, sbx policy | ||
| aliases: | ||
| - /ai/sandboxes/security/policy/ | ||
| --- | ||
|
|
||
| The `sbx policy` command manages network access rules on your local machine. | ||
| Rules apply to all sandboxes on the machine when you use the global scope, or | ||
| to a single sandbox when scoped by name. | ||
|
|
||
| Local rules work differently depending on whether your organization uses | ||
| governance: | ||
|
|
||
| - **No org governance**: local rules fully control what sandboxes can access. | ||
| - **Org governance, delegation enabled**: local rules of the delegated type | ||
| are evaluated alongside org rules. You can extend access for domains your org | ||
| hasn't explicitly denied, but org-level denials still take precedence. | ||
| - **Org governance, no delegation**: local rules are inactive. `sbx policy | ||
| allow` and `sbx policy deny` have no effect for that rule type. | ||
|
|
||
| See [Organization policy](org.md) for how admins configure delegation. | ||
|
|
||
| For domain patterns, wildcards, CIDR ranges, and filesystem path syntax, see | ||
| [Policy concepts](concepts.md#rule-syntax). | ||
|
|
||
| ## Default preset | ||
|
|
||
| The only way traffic can leave a sandbox is through an HTTP/HTTPS proxy on | ||
| your host, which enforces access rules on every outbound request. Non-HTTP TCP | ||
| traffic, including SSH, can be allowed by adding a policy rule for the | ||
| destination IP and port (for example, `sbx policy allow network -g | ||
| "10.1.2.3:22"`). UDP and ICMP are blocked at the network layer and can't be | ||
| unblocked with policy rules. | ||
|
|
||
| On first start, and after running `sbx policy reset`, the daemon prompts you | ||
| to choose a network preset: | ||
|
|
||
| ```plaintext | ||
| Choose a default network policy: | ||
|
|
||
| 1. Open — All network traffic allowed, no restrictions. | ||
| 2. Balanced — Default deny, with common dev sites allowed. | ||
| 3. Locked Down — All network traffic blocked unless you allow it. | ||
|
|
||
| Use ↑/↓ to navigate, Enter to select, or press 1–3. | ||
| ``` | ||
|
|
||
| | Preset | Description | | ||
| | ------ | ----------- | | ||
| | Open | All outbound traffic is allowed. Equivalent to adding a wildcard allow rule with `sbx policy allow network -g "**"`. | | ||
| | Balanced | Default deny, with a baseline allowlist covering AI provider APIs, package managers, code hosts, container registries, and common cloud services. | | ||
| | Locked Down | All outbound traffic is blocked, including model provider APIs (for example, `api.anthropic.com`). You must explicitly allow everything you need. | | ||
|
|
||
| The **Balanced** preset's baseline allowlist is a good starting point for most | ||
| workflows. Run `sbx policy ls` to see exactly which rules it includes. | ||
|
|
||
| > [!NOTE] | ||
| > If your organization manages sandbox policies centrally, organization rules | ||
| > take precedence over the preset you select here. See | ||
| > [Organization policy](org.md). | ||
|
|
||
| ### Non-interactive environments | ||
|
|
||
| In non-interactive environments such as CI pipelines or headless servers, the | ||
| interactive prompt can't be displayed. Use `sbx policy set-default` to set the | ||
| preset before running any other `sbx` commands: | ||
|
|
||
| ```console | ||
| $ sbx policy set-default balanced | ||
| ``` | ||
|
|
||
| Available values are `allow-all`, `balanced`, and `deny-all`. | ||
|
|
||
| ## Managing rules | ||
|
|
||
| Use [`sbx policy allow`](/reference/cli/sbx/policy/allow/) and | ||
| [`sbx policy deny`](/reference/cli/sbx/policy/deny/) to add or restrict access | ||
| on top of the active preset. Changes take effect immediately. Pass `-g` to | ||
| apply a rule globally to all sandboxes: | ||
|
|
||
| ```console | ||
| $ sbx policy allow network -g api.anthropic.com | ||
| $ sbx policy deny network -g ads.example.com | ||
| ``` | ||
|
|
||
| Pass a sandbox name to scope a rule to one sandbox: | ||
|
|
||
| ```console | ||
| $ sbx policy allow network my-sandbox api.example.com | ||
| $ sbx policy deny network my-sandbox ads.example.com | ||
| ``` | ||
|
|
||
| Specify multiple hosts in one command with a comma-separated list: | ||
|
|
||
| ```console | ||
| $ sbx policy allow network -g "api.anthropic.com,*.npmjs.org,*.pypi.org" | ||
| ``` | ||
|
|
||
| Remove a rule by resource or by rule ID: | ||
|
|
||
| ```console | ||
| $ sbx policy rm network -g --resource ads.example.com | ||
| $ sbx policy rm network -g --id 2d3c1f0e-4a73-4e05-bc9d-f2f9a4b50d67 | ||
| ``` | ||
|
|
||
| To remove a sandbox-scoped rule, include the sandbox name: | ||
|
|
||
| ```console | ||
| $ sbx policy rm network my-sandbox --resource api.example.com | ||
| ``` | ||
|
|
||
| To inspect which rules are active and where they come from, use | ||
| `sbx policy ls`. See [Monitoring](monitoring.md). | ||
|
|
||
| ### Resetting | ||
|
|
||
| To remove all custom rules and start fresh with a new preset, use | ||
| `sbx policy reset`: | ||
|
|
||
| ```console | ||
| $ sbx policy reset | ||
| ``` | ||
|
|
||
| This deletes the local policy store and stops the daemon. When the daemon | ||
| restarts on the next command, you are prompted to choose a new preset. Running | ||
| sandboxes stop when the daemon shuts down. Pass `--force` to skip the | ||
| confirmation prompt: | ||
|
|
||
| ```console | ||
| $ sbx policy reset --force | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Local rules have no effect | ||
|
|
||
| If rules you add with `sbx policy allow` or `sbx policy deny` don't change | ||
| sandbox behavior, your organization likely has governance enabled without | ||
| delegating that rule type to local control. Run `sbx policy ls` to check: if | ||
| the output starts with a `Governance: managed by <org>` header, org governance | ||
| is active. If your rules appear with `inactive` status, org governance is | ||
| suppressing them. | ||
|
|
||
| To use local rules alongside org rules, ask your admin to enable delegation for | ||
| the relevant rule type in the Admin Console. See | ||
| [Delegate rules to local policy](org.md#delegate-rules-to-local-policy). | ||
|
|
||
| ### A domain is still blocked after adding an allow rule | ||
|
|
||
| If a domain remains blocked after you add a local allow rule, an org-level deny | ||
| rule may be covering it. [Delegation](org.md#delegate-rules-to-local-policy) | ||
| lets local rules expand access, but org deny rules always take precedence. Run `sbx policy ls` to check whether a rule | ||
| with `remote` origin and `deny` decision matches the domain. If so, the block | ||
| can only be lifted by updating the org policy in the Admin Console or via the | ||
| [API](/reference/api/ai-governance/). | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not supporting delegation for now until there's some more product-shaping. cc @smnovick