This page lists each place where policy is applied, what it matches, which tools it covers, and where it sits in the evaluation order.
All mechanisms at a glance
Policy is applied in several places. Most of it works on CLI passthrough tools, because Splicedock can read their argument array before it starts a process. MCP and HTTP tools are covered only by the profile tool globs and the MCP upstream allowlist.
| Mechanism | Matches on | Applies to | Configured in | Result |
|---|---|---|---|---|
Profile tools globs | Tool name | All tools | Profile YAML | Tool is hidden |
server.cli_whitelist | Executable | CLI | Server YAML | Deny |
max_args | Argument count | CLI | Tool policy | Deny |
deny_args | Substring of one argument | CLI | Tool policy | Deny |
deny_args_regex | Regex on one argument | CLI | Tool policy | Deny |
deny_argv_regex | Regex on the joined arguments | CLI | Tool policy | Deny |
deny_subcommands, deny_subcommand_paths | Subcommand or path | CLI | Tool policy | Deny |
allow_subcommands, allow_subcommand_paths | Subcommand or path | CLI | Tool policy | Deny if not listed |
require_args, require_any_of | Required arguments | CLI | Tool policy | Deny if missing |
approval_subcommands, approval_subcommand_paths | Subcommand or path | CLI | Tool policy | Approval |
| Namespace confinement | Namespace arguments | kubectl | The require_* keys | Deny |
| Built-in hard denies | Fixed paths such as gh api | gh | Built in | Deny |
| Credential-print denies | Calls that print a credential | gh | Built in | Deny |
| Unknown subcommand check | First subcommand | CLI with a command table | known_subcommands | Deny |
| Strong approval | Tool or path | CLI | server.consent, built-in paths | Stronger approval |
| Circuit breaker | Rate of denials | CLI | server.breaker | Strong approval forced |
| Fixed template | Template and parameters | cli tools | Tool YAML | Fixed command only |
| Profile token requirement | Bearer token | All MCP calls | server.require_profile_token | Deny |
| Token lifetime | Token age and last use | Profile tokens | server.token_policy | Expire or revoke |
| Shadow observer | Feature summary of a decision | CLI | server.shadow | Log only |
| Learned grants | Shape of an approved call | kubectl | Environment variables | Skips a human |
| MCP upstream allowlist | Host name | Runtime MCP upstreams | server.mcp_upstream_allowlist | Deny |
| Policy overrides | Whole tool policy | CLI | Admin API and WebUI | Replaces the file policy |
Evaluation order
A CLI call goes through these steps in this order. The first step that refuses the call ends it. Approval is always last, so a deny rule always beats an approval rule.
- The profile must list the tool. Otherwise it is not visible.
- The executable must be in
server.cli_whitelist. - The argument array is made canonical. The help call accepts command words only.
- Credential-print denies. They run before any policy and no approval can override them.
- Brokered paths (
gh apigivesbroker_required) and strong-approval paths such asgh repo delete. - The policy is compiled. Invalid regexes and contradictory rules fail here.
- The circuit breaker may mark the call as needing strong approval.
- The policy runs in this order:
max_args,deny_args,deny_args_regex,deny_argv_regex, unknown subcommand check, built-in hard denies,deny_subcommands,deny_subcommand_paths,allow_subcommands,allow_subcommand_paths, namespace confinement,require_args,require_any_of, then approval. - A strong-approval path that the policy did not route to approval is denied.
- If the breaker forced approval and the policy allowed the call, a strong approval is demanded.
- Every denial is logged. Allowed calls are logged when
audit: trueis set.
If the flag layout of a call is ambiguous, the call is refused with ambiguous_argv. Declare the flags with value_flags and boolean_flags to remove the ambiguity.
Profile tool globs
A profile lists the tools its token can see, as exact names or globs. This limits visibility only. It does not look at arguments. It applies to every tool type.
profiles:
reader:
tools: ["gh__*", "kubectl__help"]How to use it
1. When to use it
Use it to give each agent only the tools it needs. It is the first and cheapest limit. It hides tools. It never reads arguments.
2. Example
profiles:
reader:
tools: ["gh__*", "kubectl__help"]
operator:
tools: ["gh__*", "kubectl__*"]3. What the agent sees
A tool outside the profile is not listed. A direct call to it fails as an unknown tool. There is no denial text, because the tool does not exist for that token.
4. How to verify it
Connect with a reader token and list the tools. You should see gh__help, gh__run and kubectl__help, and no kubectl__run.
5. Common mistakes
- A glob such as
gh__*includesgh__run. If you only want help text, listgh__helpalone. - Globs do not look at arguments. Use a tool policy for that.
Executable whitelist
The command of a CLI tool must match an entry in server.cli_whitelist. A call that fails this check is refused before any policy runs.
server:
cli_whitelist: [kubectl, gh]How to use it
1. When to use it
Use it as a fixed list of programs the gateway may start. Every CLI tool needs its command listed here.
2. Example
server:
cli_whitelist: [kubectl, gh, terraform]3. What the agent sees
A command that is not listed is refused before any policy runs. The tool cannot run.
4. How to verify it
Remove a command from the list, restart, and call the tool. It must fail. Add it back and the call is judged by the tool policy.
5. Common mistakes
- Adding a tool but forgetting its command here.
- The entry is the bare program name, not a path.
Argument count and substrings
max_args caps the number of arguments (1 to 10000, default 256). deny_args denies a call when any single argument contains one of the listed strings. The match is a plain substring test on one argument.
policy:
max_args: 64
deny_args: ["--token", "--insecure-skip-tls-verify"]How to use it
1. When to use it
Use max_args to stop very long calls. Use deny_args to ban an exact flag that is always unsafe.
2. Example
tools:
- type: cli_passthrough
name: kubectl
description: kubectl for the reader profile
command: kubectl
policy:
max_args: 64
deny_args: ["--token", "--insecure-skip-tls-verify"]3. What the agent sees
The call returns an error result with the text Denied by policy.max_args. The agent gets the rule name only. The longer message goes to the gateway log and to the dry-run answer.
A banned argument gives Denied by policy.deny_args.
4. How to verify it
Call kubectl__run with {"args": ["get","pods","--token=x"]}. Expect Denied by policy.deny_args. You can also test without running anything. Send POST /api/v1/policies/ with {"argv": [...]}. It returns {ok: true} or the rule and message that hit.
5. Common mistakes
- Writing only the long form of a flag. A short alias needs its own entry.
- Setting
max_argsso low that normal calls fail. Count a typical call first.
Regex rules
deny_args_regex tests each argument on its own. deny_argv_regex tests all arguments joined with single spaces. A match denies the call.
policy:
deny_args_regex:
- "^--(token|as)(=|$)"
deny_argv_regex:
- "\\bsecrets?\\b"Rules of use:
- Regex rules only deny. They never allow or request approval.
- They apply to CLI passthrough tools only. Splicedock does not regex-check the JSON arguments of MCP or HTTP tools.
- Patterns use JavaScript
RegExpsyntax with no flags. They are not anchored, so add^and$when you need that. deny_args,deny_args_regexanddeny_argv_regexsee the argument array exactly as it was sent, even withknown_subcommands: enforce. An alias such asgh ext uninstallis not rewritten toextension removefor them. Only the subcommand rules and the unknown subcommand check use canonical names. Write a pattern for every spelling you want to block, or use a subcommand path rule.deny_argv_regexcannot tell a space between two arguments from a space inside one argument.- An invalid pattern is rejected when the config loads or an override is saved. Limits: 200 patterns for
deny_args_regexand 50 fordeny_argv_regex. - Avoid nested quantifiers such as
(a+)+. A pattern that backtracks badly can stall the gateway. - The deny message shows a redacted preview of the matching text.
How to use it
1. When to use it
Use deny_args_regex for a shape of one argument. Use deny_argv_regex for a pattern across the whole call, such as a word that may appear anywhere.
2. Example
tools:
- type: cli_passthrough
name: kubectl
description: kubectl without secrets
command: kubectl
policy:
deny_args_regex:
- "^--(token|as)(=|$)"
deny_argv_regex:
- "\\bsecrets?\\b"3. What the agent sees
The call returns an error result with the text Denied by policy.deny_args_regex. The agent gets the rule name only. The longer message goes to the gateway log and to the dry-run answer.
The call returns an error result with the text Denied by policy.deny_argv_regex. The agent gets the rule name only. The longer message goes to the gateway log and to the dry-run answer.
4. How to verify it
Call with {"args": ["get","secrets","-n","dev"]}. Expect Denied by policy.deny_argv_regex. Call {"args": ["get","pods","--as=admin"]} and expect Denied by policy.deny_args_regex. You can also test without running anything. Send POST /api/v1/policies/ with {"argv": [...]}. It returns {ok: true} or the rule and message that hit.
5. Common mistakes
- Patterns are not anchored.
secretalso matchessecretary. Add anchors or\\b. - Inside YAML double quotes a backslash must be doubled. Single quotes need no doubling.
- An invalid pattern stops the load with
policy.deny_args_regex: invalid regex "(": .... The same text is returned when an override is saved.
Deny and allow subcommands
A subcommand rule matches the first command word. A path rule matches a sequence of command words. Deny rules win over allow rules. You cannot set both an allow list and a deny list of the same kind. With an allow list, anything not listed is denied.
policy:
deny_subcommands: [delete, exec]
deny_subcommand_paths:
- [rollout, undo]policy:
allow_subcommands: [get, describe, logs]
# or, for finer control:
# allow_subcommand_paths:
# - [rollout, status]
# - [get]How to use it
1. When to use it
Use an allow list for a read-only tool. It is safer, because anything new is denied. Use a deny list only to remove a few verbs from an otherwise open tool.
2. Example
tools:
- type: cli_passthrough
name: kubectl
description: Read-only kubectl
command: kubectl
policy:
allow_subcommands: [get, describe, logs]3. What the agent sees
The call returns an error result with the text Denied by policy.allow_subcommands. The agent gets the rule name only. The longer message goes to the gateway log and to the dry-run answer.
A deny list gives Denied by policy.deny_subcommands. A path rule gives Denied by policy.deny_subcommand_paths or Denied by policy.allow_subcommand_paths.
4. How to verify it
Call {"args": ["get","pods"]} and expect success. Call {"args": ["delete","pod","x"]} and expect Denied by policy.allow_subcommands.
5. Common mistakes
- Setting both lists of one kind fails with
policy: cannot set both allow_subcommands and deny_subcommands. For paths the text ispolicy: cannot set both allow_subcommand_paths and deny_subcommand_paths. - An approval entry that a deny rule already covers fails with
is unreachablein the message, because deny always wins.
Required arguments
require_args lists arguments that must all be present. require_any_of is a list of groups. Every group needs at least one match, so put alternatives inside one group. An entry for a flag that takes a value must be written as --flag=value. A bare flag name is rejected when the policy is compiled.
policy:
allow_subcommands: [get]
require_any_of:
- ["--namespace=dev", "--namespace=staging"]This allows get pods --namespace=dev and get pods -n staging. It refuses other namespaces, -A and calls with no namespace.
How to use it
1. When to use it
Use it to force an argument to be present on every call, for example a namespace.
2. Example
tools:
- type: cli_passthrough
name: kubectl
description: kubectl confined to dev or staging
command: kubectl
policy:
allow_subcommands: [get]
require_any_of:
- ["--namespace=dev", "--namespace=staging"]3. What the agent sees
The call returns an error result with the text Denied by policy.require_args. The agent gets the rule name only. The longer message goes to the gateway log and to the dry-run answer.
The call returns an error result with the text Denied by policy.require_any_of. The agent gets the rule name only. The longer message goes to the gateway log and to the dry-run answer.
4. How to verify it
Call {"args": ["get","pods","-n","dev"]} and expect success. Call {"args": ["get","pods"]} and expect a Denied by policy.require_any_of denial.
5. Common mistakes
- A bare value flag fails the load with
policy.require_any_of: bare requirement "--namespace" names a value-taking flag and can never be satisfied; use "--namespace=." - Alternatives go inside one group. Two groups mean both are needed.
- A flag the gateway cannot read is refused as
ambiguous_argv. Declare it invalue_flagsorboolean_flags.
Namespace confinement (kubectl)
For kubectl, a --namespace=name entry in require_args or require_any_of also works as a boundary. The call must name a namespace in the set you wrote. The example in the previous section shows it.
How to use it
1. When to use it
Use it to keep kubectl inside named namespaces. You set it with the same require_args key, so no extra setting is needed.
2. Example
tools:
- type: cli_passthrough
name: kubectl
description: kubectl for dev only
command: kubectl
policy:
allow_subcommands: [get, describe, logs]
require_args: ["--namespace=dev"]3. What the agent sees
The call returns an error result with the text Denied by policy.require_args. The agent gets the rule name only. The longer message goes to the gateway log and to the dry-run answer.
The log message says why. Flags that move the request elsewhere are refused too, such as another server, context, identity or kubeconfig.
4. How to verify it
Call {"args": ["get","pods","-A"]} and {"args": ["get","pods","-n","prod"]}. Both must be denied. Call {"args": ["get","pods","-n","dev"]} and expect success.
5. Common mistakes
- Writing
-nin the policy. The load fails with"-n" sets the namespace; spell it "--namespace=." - A bad name fails with
does not name a valid namespace (lowercase RFC 1123 label). - A bare
--namespacefails with the bare requirement error shown above.
Approval rules
approval_subcommands and approval_subcommand_paths send a match to a person instead of running it. Approval is the last step, so every deny and require rule still applies first. Without an approval hook, a match is denied. The caller needs an authenticated profile token. See Request and consume approval.
policy:
approval_subcommands: [apply]
approval_subcommand_paths:
- [rollout, restart]How to use it
1. When to use it
Use it when a verb is useful but risky, such as apply or pr merge. A person decides each time, on the phone page /admin/swipe or in /admin/approvals.
2. Example
tools:
- type: cli_passthrough
name: kubectl
description: kubectl with approval for rollout restart
command: kubectl
policy:
allow_subcommands: [get, describe, rollout]
approval_subcommand_paths:
- [rollout, restart]3. What the agent sees
The first call returns an error result like this:
Approval required: {...payload...}. Retry the SAME argv within 300s after approval (approval id: ID).The number of seconds is the time left. A caller with no profile token gets Denied by policy.approval_requires_profile_token.
4. How to verify it
- Call
kubectl__runwith{"args": ["rollout","restart","deploy/web","-n","dev"]}. ExpectApproval required. - Approve on
/admin/swipeor/admin/approvals. - Call
approvals__waitwith the approval id. - Send the SAME call again, with the same argv, cwd and token. It runs once.
5. Common mistakes
- Changing the argument array on retry. A different array is a new request.
- Putting the verb in the approval list but not in the allow list. The allow list is checked first, so the call is denied.
- Expecting approval to beat a deny rule. Deny always wins.
Strong approval
A strong approval needs a WebAuthn confirmation. A tool in strong_default_tools always needs it. Some built-in paths need it, for example gh repo delete. The circuit breaker can also force it.
server:
consent:
rp_id: example.com
origin: https://splicedock.example.com
strong_default_tools: [gh]How to use it
1. When to use it
Use it for actions where a swipe is not enough. A person must confirm with a hardware key or passkey (WebAuthn). Use it for deletes, or for every approval of a sensitive tool.
2. Example
server:
consent:
rp_id: example.com
origin: https://splicedock.example.com
strong_default_tools: [terraform]3. What the agent sees
The same Approval required: ... result as any approval. The phone swipe is not enough. A browser must complete the WebAuthn check.
4. How to verify it
Call a tool that needs strong approval. Approve it in the admin page with your key. Call approvals__wait, then retry the same call.
5. Common mistakes
- The origin must be HTTPS and its host must be
rp_idor a subdomain of it. Otherwise the load fails withconsent origin must be HTTPS and bound to rp_id. rp_idneedsorigin. Otherwise:consent rp_id requires origin.- A built-in strong path such as
gh repo deleteis denied unless the tool policy routes it to approval. Addapproval_subcommand_paths: [[repo, delete]].
Built-in denies
Some rules are built into the tool profile and cannot be turned off. gh api is never allowed, even if you list it in allow_subcommands. Credential-print denies refuse calls that would print a credential. They run before your policy, and approval cannot override them. The deny rule ends with credential_print_denied:id.
How to use it
1. When to use it
These need no setup. Know them so you are not surprised. They protect you even when your own policy is loose.
2. Example
No setting is needed.
3. What the agent sees
A credential-print deny returns Denied: . The ids are gh_auth_token, gh_auth_status_show_token, gh_jq_env and gh_api_template_env. A gh api call returns the plain text broker_required.
4. How to verify it
Call gh__run with {"args": ["auth","token"]}. Expect Denied: `gh auth token` prints a credential (credential_print_denied:gh_auth_token). Call gh__run with {"args": ["api","user"]}. Expect broker_required.
5. Common mistakes
- Trying to allow
gh apiin a policy. It is never run through a gh tool.
Flag declarations
Policy has to know which flags take a value to find the real subcommand. When two readings of a call disagree, it is refused as ambiguous_argv. List the flags of your tool to remove the doubt.
policy:
value_flags: ["--output-dir"]
boolean_flags: ["--dry"]Unknown subcommands
For tools with a known command table, a first subcommand that is not in the table is refused as unknown_subcommand. Set known_subcommands to off only for a tool you cannot describe this way.
known_subcommands: enforceHow to use it
1. When to use it
Keep it on for tools with a command table such as gh and kubectl. It catches typos and unknown verbs early.
2. Example
tools:
- type: cli_passthrough
name: gh
description: GitHub CLI
command: gh
known_subcommands: enforce
policy:
allow_subcommands: [pr, issue]3. What the agent sees
The call returns an error result with the text Denied by policy.unknown_subcommand. The agent gets the rule name only. The longer message goes to the gateway log and to the dry-run answer.
4. How to verify it
Call gh__run with {"args": ["not-a-command"]}. Expect Denied by policy.unknown_subcommand.
5. Common mistakes
- Putting the setting inside
policy. It belongs on the tool.
Audit
Denials are always logged. Set audit to log allowed calls too.
policy:
audit: trueHow to use it
1. When to use it
Turn it on while you tune a policy, or for tools you want a full trail of. Denials are logged either way.
2. Example
tools:
- type: cli_passthrough
name: kubectl
description: Audited kubectl
command: kubectl
policy:
audit: true
allow_subcommands: [get]3. What the agent sees
Nothing changes for the agent. The effect is on the operator side.
4. How to verify it
Run an allowed call. The gateway log then has a line cli_passthrough audit accept. The log holds the argument count, not the values. The admin audit page filters by decision: allow, deny or approval.
5. Common mistakes
- Looking for allowed calls without
audit: true. They are not logged then.
Circuit breaker
The breaker counts denials per scope in a time window. When the count reaches deny_threshold inside window_seconds, it opens. While it is open, a call that policy would allow needs strong approval. In observe mode (the default) it only records what it would have done. Commands in read_allowlist are exempt. If its storage fails in enforce mode, calls are refused.
server:
breaker:
enabled: true
mode: enforce
window_seconds: 60
deny_threshold: 10
cooldown_seconds: 1800
half_open_probes: 3
scopes: [global]
read_allowlist:
- tool: kubectl
argv: [get, pods]How it closes again:
- Open. The breaker stays open for
cooldown_seconds. The cooldown is not extended by further denials. - Half open. After the cooldown, the next call moves it to half open. It still forces strong approval. Any denial in this state opens it again and the cooldown restarts.
- Closed. It closes when at least
window_secondshave passed in half open andhalf_open_probesdifferent strong approvals have been used. Each probe must be a WebAuthn approval for a CLI call by an authenticated token. Calls that are not approved do not count. - An operator can also open or close a scope by hand from the admin side. Every transition is written to an audit table.
scopes takes global, profile:name or token. The breaker keeps no argument values.
How to use it
1. When to use it
Use it as a safety net. An agent that keeps hitting denials is probably lost or probing. The breaker then forces strong approval until things calm down.
2. Example
server:
breaker:
enabled: true
mode: observe
window_seconds: 60
deny_threshold: 10
cooldown_seconds: 1800
half_open_probes: 3
scopes: [global]
read_allowlist:
- tool: kubectl
argv: [get, pods]3. What the agent sees
While the breaker is open, a call that policy would allow needs strong approval. If its storage fails in enforce mode, the call returns the text breaker_unavailable.
4. How to verify it
Start in observe mode. Send ten denied calls inside a minute and read the gateway log for what the breaker would have done. Then set mode: enforce and repeat.
5. Common mistakes
- Going straight to
enforce. Watchobservefirst so a noisy tool does not lock you out. - A scope must be
global,tokenorprofile:.
Learned grants
An approval can be learned and repeated without a person, within strict limits. It is off by default. See Learned grants.
SPLICEDOCK_GRANTS=1
SPLICEDOCK_GRANT_NAMESPACES=stagingMCP upstream allowlist
MCP upstreams created at runtime may only point at hosts on this list. An entry is an exact host name or *.suffix, which matches subdomains but not the bare domain. Upstreams written in YAML are not checked.
server:
mcp_upstream_allowlist:
- mcp.example.com
- "*.internal.example.com"How to use it
1. When to use it
Use it when operators can add MCP upstreams at runtime. It limits which hosts those may point at.
2. Example
server:
mcp_upstream_allowlist:
- mcp.example.com
- "*.internal.example.com"3. What the agent sees
This is an admin API call, not an agent call. A host that is not listed gets HTTP 403 with the code host_not_allowed.
4. How to verify it
Create a runtime upstream with a listed host and expect success. Use an unlisted host and expect 403 host_not_allowed.
5. Common mistakes
- Expecting this to check upstreams written in YAML. Only runtime ones are checked.
- Leaving the list empty. It denies every runtime upstream.
Policy overrides
An operator can replace the policy of a CLI tool at runtime, for all profiles or for one. The override is stored in the database. It replaces the file policy completely and is not merged with it. A profile override beats an all-profiles override, which beats the file policy. Invalid regexes and contradictory rules are rejected when it is saved.
PUT /api/v1/policies/kubectl?profile=reader
DELETE /api/v1/policies/kubectl?profile=reader
POST /api/v1/policies/kubectl/dry-runThe dry-run call tests an argument array against the current or a draft policy without running anything. The tool page in the WebUI offers the same. Overrides exist only for CLI tools.
How to use it
1. When to use it
Use it to change a tool policy without a restart, for one profile or for all. Good for a quick tighten during an incident.
2. Example
PUT /api/v1/policies/kubectl?profile=reader
{
"policy": {
"allow_subcommands": ["get"],
"require_args": ["--namespace=dev"]
},
"updated_by": "ops"
}3. What the agent sees
Agents see the new policy with the same denial texts as before. The API answers 400 invalid_policy for a bad body, 404 not_found for an unknown tool and 404 unknown_profile for an unknown profile.
4. How to verify it
Send the draft to POST /api/v1/policies/kubectl/dry-run with {"argv": ["get","pods","-n","dev"], "policy": {...}} before you save. Add ?profile=reader to test a profile.
5. Common mistakes
- An override replaces the file policy. It is not merged. Copy the rules you want to keep.
- A profile override beats an all-profiles override.
- A contradictory policy returns the same compile errors as in the file.
Profile token requirement
server.require_profile_token is true by default. A call to the MCP endpoint then needs a valid profile token as a bearer token, and the ?profile= query is ignored. Approval also needs an authenticated token. Setting it to false brings back the old unauthenticated ?profile= selection. Splicedock logs a warning at start when it is off.
server:
require_profile_token: trueHow to use it
1. When to use it
Keep it on (the default). Approval needs an identity, and a bearer token is the only safe one.
2. Example
server:
require_profile_token: true3. What the agent sees
The MCP endpoint answers HTTP 401 with {"error":"profile_token_required"} when no bearer is sent, or {"error":"invalid_profile_token"} for a bad one.
4. How to verify it
Call the MCP endpoint with no Authorization header and expect 401 profile_token_required.
5. Common mistakes
- Setting it to
false. Callers with no token cannot be approved, and they getDenied by policy.approval_requires_profile_token.
Token lifetime and inactivity
server.token_policy sets how long profile tokens live. A new token gets default_ttl_seconds and an admin cannot ask for more than max_ttl_seconds. Both are at most 30 days (2592000 seconds), and the default may not exceed the maximum. A background sweep, every sweep_interval_seconds, looks for tokens not used for inactivity_days days. In observe mode (the default) it only counts them. In enforce mode it revokes them. touch_interval_seconds limits how often the last-used time is written.
server:
token_policy:
max_ttl_seconds: 2592000
default_ttl_seconds: 604800
inactivity_days: 30
inactivity_mode: enforce
touch_interval_seconds: 60
sweep_interval_seconds: 3600How to use it
1. When to use it
Use it so profile tokens have a maximum life and unused ones are caught.
2. Example
server:
token_policy:
max_ttl_seconds: 2592000
default_ttl_seconds: 604800
inactivity_days: 30
inactivity_mode: observe
touch_interval_seconds: 60
sweep_interval_seconds: 36003. What the agent sees
A token the gateway rejects gets the 401 invalid_profile_token.
4. How to verify it
Start with inactivity_mode: observe and look at which tokens would be hit. Then switch to enforce.
5. Common mistakes
- A default longer than the maximum fails the load.
- Switching to
enforcebefore you looked at the observe results.
Shadow observer
server.shadow is off by default. When on, it passes a small feature summary of each CLI decision to an observer model and logs whether the model would have agreed. It never changes a decision and nothing waits for it. It sees tool and profile names, the argument count and a read, write or other class of the first word. It does not see argument values. A full queue drops new items, and a slow model is cut off after timeout_ms. Rows older than retention_days are deleted. Set SPLICEDOCK_SHADOW=off in the environment to stop it at once, whatever the YAML says.
server:
shadow:
enabled: true
sample_rate: 0.5
queue_max: 1000
timeout_ms: 300
retention_days: 30How to use it
1. When to use it
Use it to watch decisions without risk before you tighten rules. It never changes a decision.
2. Example
server:
shadow:
enabled: true
sample_rate: 0.5
queue_max: 1000
timeout_ms: 300
retention_days: 303. What the agent sees
Nothing. It is silent for the agent.
4. How to verify it
Make a few calls and read the gateway log. Set SPLICEDOCK_SHADOW=off to switch it off at once.
5. Common mistakes
- Expecting it to block anything. It only observes.
- A
sample_ratemust be between 0 and 1.
Fixed-template cli tools
A tool of type cli is not a passthrough. It runs one command with a fixed argument template, and the caller only fills the named parameters. There are no argument rules for it: the template is the control. The command must be in server.cli_whitelist and must be a bare executable name. The process starts with no shell, a reduced environment (only PATH, HOME and the variables listed in env), a timeout and a 10 MiB output cap per stream. A parameter value replaces its {name} placeholder as one single argument, so it cannot add flags by containing spaces. It can still start with a dash, so do not use a parameter as the only content of an argument when that matters.
tools:
- type: cli
namespace: demo
name: version
description: Read the Node.js version
command: node
args: ["--version"]Need caller-chosen arguments with rules? Use cli_passthrough with a policy.
Choosing a mechanism
Start from what you want to happen, then pick the row.
| I want to... | Use | Why |
|---|---|---|
| Hide a whole tool from an agent | Profile tools globs | The tool is not listed at all. |
| Allow only a few verbs | allow_subcommands or allow_subcommand_paths | Anything new is denied by default. |
| Block a few verbs | deny_subcommands or deny_subcommand_paths | Good for an open tool with a few dangerous verbs. |
| Block a flag | deny_args | Exact and simple. |
| Block a pattern | deny_args_regex or deny_argv_regex | Matches a shape, or a word anywhere in the call. |
| Force a flag on every call | require_args or require_any_of | The call is denied when it is missing. |
| Keep kubectl in one namespace | require_args: --namespace= | Namespace confinement checks the whole call. |
| Let a person decide each time | approval_subcommands or approval_subcommand_paths | A swipe on the phone page approves one call. |
| Need a hardware key to approve | server.consent with strong_default_tools | WebAuthn consent in the browser. |
| Stop an agent that keeps probing | server.breaker | Forces strong approval after many denials. |
| Try a rule without risk | server.shadow | Observes only. It never changes a decision. |
| Change a rule right now | A policy override | No restart. Test it with the dry-run first. |
| Limit runtime MCP upstream hosts | server.mcp_upstream_allowlist | Deny by default. |
| See every allowed call | audit: true | Allowed calls are logged too. |
Recipes
Five complete setups. Each one is copy and paste, then adapt the names.
Recipe 1: read-only gh, with approval for pr merge
The agent can look at pull requests and issues. A person must approve each merge. The merge path is in the allow list too, because approval is the last step and a call that is not allowed never gets that far.
tools:
- type: cli_passthrough
name: gh
description: GitHub CLI
command: gh
policy:
allow_subcommand_paths:
- [pr, list]
- [pr, view]
- [pr, diff]
- [pr, checks]
- [issue, list]
- [issue, view]
- [repo, view]
- [pr, merge]
approval_subcommand_paths:
- [pr, merge]
audit: true
profiles:
agent:
tools: ["gh__*"]Test it. {"args": ["pr","list"]} runs. {"args": ["pr","close","12"]} returns Denied by policy.allow_subcommand_paths. {"args": ["pr","merge","12"]} returns Approval required: .... Approve it, call approvals__wait, then send the same merge call again.
Recipe 2: kubectl in one namespace
The agent may read, but only in dev.
tools:
- type: cli_passthrough
name: kubectl
description: kubectl for dev only
command: kubectl
policy:
allow_subcommands: [get, describe, logs]
require_args: ["--namespace=dev"]
deny_args_regex:
- "^--(token|as)(=|$)"Test it. {"args": ["get","pods","-n","dev"]} runs. {"args": ["get","pods","-A"]} and {"args": ["get","pods","-n","prod"]} are denied. A bare --namespace in the policy fails the load, so write --namespace=dev.
Recipe 3: stop dangerous writes with deny_argv_regex
gh api is already refused by a built-in rule, so use this pattern on a tool where it is not. Here a shell-style tool may not touch a delete verb or a force flag anywhere in the call.
policy:
deny_argv_regex:
- "\\b(delete|destroy)\\b"
- "(^| )--force( |$)"Test it with the dry-run: POST /api/v1/policies/ and {"argv": ["rm","--force","x"]}. The answer names the rule deny_argv_regex.
Recipe 4: phone approval for terraform apply
Planning is free. Applying needs a person. Add the tool to strong_default_tools if a swipe is not enough.
server:
cli_whitelist: [terraform]
tools:
- type: cli_passthrough
name: terraform
description: Terraform with approval for apply
command: terraform
policy:
allow_subcommands: [init, validate, plan, apply]
approval_subcommands: [apply]
audit: trueTest it. {"args": ["plan"]} runs. {"args": ["apply"]} returns Approval required: ... and a push message reaches the phone. Swipe to approve on /admin/swipe, call approvals__wait, then repeat the same apply call.
Recipe 5: roll out gradually with shadow mode, then enforce
Go in small steps. Turn on the observers first, look at what they say, then enforce.
- Turn on the breaker in
observemode and the shadow observer. - Turn on
audit: truefor the tools you care about. - Test each new rule with the dry-run before you save it.
- After a week, read the log and the audit page. Fix rules that deny normal work.
- Switch
breaker.modeandtoken_policy.inactivity_modetoenforce.
server:
breaker:
mode: observe
shadow:
enabled: true
sample_rate: 0.5
token_policy:
inactivity_mode: observeTroubleshooting and FAQ
Start with the text the agent got. It tells you which kind of problem this is.
| The agent sees | It means | What to do |
|---|---|---|
Denied by policy. | A policy rule denied the call. The name after the dot is the rule. | Run the same argv in the dry-run to read the full message. |
Approval required: ... | A person must approve, then the agent retries. | Approve on /admin/swipe or /admin/approvals. Retry the SAME argv. |
Denied by policy.approval_requires_profile_token | The call needs approval but has no profile token. | Connect with a profile token. |
broker_required | A gh api call. It is never run through a gh tool. | Use a normal gh command instead. |
credential_print_denied: | The call would print a credential. | Do not print the token. Use the tool as it is. |
Denied by policy.unknown_subcommand | The first word is not a known command. | Check the spelling with the help tool. |
breaker_unavailable | The breaker could not read its state in enforce mode. | Check the gateway storage and logs. |
401 profile_token_required | No bearer token was sent. | Add the profile token to the MCP client. |
Why was my call denied?
- Read the rule name after
Denied by policy.. - Look it up in the order of checks above. An earlier rule hides a later one.
- Run
POST /api/v1/policies/with the same argv. The answer holds the rule and the full message./dry-run - Check for an override. An override replaces the file policy. Use
?profile=on the dry-run to test a profile.
How do I read the audit log?
Denials are always logged. Allowed calls are logged only when audit: true is set. The gateway log has a line cli_passthrough audit accept for each allowed call, with the argument count and no values. The admin audit page can be filtered by decision: allow, deny or approval. Each row shows the rule.
Why does the approved call still fail?
- The retry used a different argument array, cwd or token. Send the exact same call.
- The approval is used up. It works once.
- The approval expired. Ask for a new one.
- A deny rule also matches. Deny always beats approval.
Why is a tool missing from the list?
The profile of the token does not list it. Check the tools globs of that profile.
Can I allow gh api?
No. It is refused as broker_required and as a hard deny. Use specific gh commands instead.
Limits to remember
- Only CLI passthrough tools have argument rules. Splicedock does not inspect the JSON arguments of MCP or HTTP tools.
- Regex rules deny only, and they are CLI only.
- Deny always beats approval. Approval is always the last step.
- Profile globs limit visibility, not arguments.
- An override replaces the file policy. Copy the rules you want to keep.
- The shadow observer never changes a decision.
- An allow list is a safer base than a deny list.