SplicedockUSER DOCUMENTATIONGitHub
Contents
USER GUIDE

Know every rule that can stop a call.

Every way policy can be applied to a tool call, with a YAML example for each.

On this page

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.

MechanismMatches onApplies toConfigured inResult
Profile tools globsTool nameAll toolsProfile YAMLTool is hidden
server.cli_whitelistExecutableCLIServer YAMLDeny
max_argsArgument countCLITool policyDeny
deny_argsSubstring of one argumentCLITool policyDeny
deny_args_regexRegex on one argumentCLITool policyDeny
deny_argv_regexRegex on the joined argumentsCLITool policyDeny
deny_subcommands, deny_subcommand_pathsSubcommand or pathCLITool policyDeny
allow_subcommands, allow_subcommand_pathsSubcommand or pathCLITool policyDeny if not listed
require_args, require_any_ofRequired argumentsCLITool policyDeny if missing
approval_subcommands, approval_subcommand_pathsSubcommand or pathCLITool policyApproval
Namespace confinementNamespace argumentskubectlThe require_* keysDeny
Built-in hard deniesFixed paths such as gh apighBuilt inDeny
Credential-print deniesCalls that print a credentialghBuilt inDeny
Unknown subcommand checkFirst subcommandCLI with a command tableknown_subcommandsDeny
Strong approvalTool or pathCLIserver.consent, built-in pathsStronger approval
Circuit breakerRate of denialsCLIserver.breakerStrong approval forced
Fixed templateTemplate and parameterscli toolsTool YAMLFixed command only
Profile token requirementBearer tokenAll MCP callsserver.require_profile_tokenDeny
Token lifetimeToken age and last useProfile tokensserver.token_policyExpire or revoke
Shadow observerFeature summary of a decisionCLIserver.shadowLog only
Learned grantsShape of an approved callkubectlEnvironment variablesSkips a human
MCP upstream allowlistHost nameRuntime MCP upstreamsserver.mcp_upstream_allowlistDeny
Policy overridesWhole tool policyCLIAdmin API and WebUIReplaces 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.

  1. The profile must list the tool. Otherwise it is not visible.
  2. The executable must be in server.cli_whitelist.
  3. The argument array is made canonical. The help call accepts command words only.
  4. Credential-print denies. They run before any policy and no approval can override them.
  5. Brokered paths (gh api gives broker_required) and strong-approval paths such as gh repo delete.
  6. The policy is compiled. Invalid regexes and contradictory rules fail here.
  7. The circuit breaker may mark the call as needing strong approval.
  8. 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.
  9. A strong-approval path that the policy did not route to approval is denied.
  10. If the breaker forced approval and the policy allowed the call, a strong approval is demanded.
  11. Every denial is logged. Allowed calls are logged when audit: true is 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.

profile YAML
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

profile YAML
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__* includes gh__run. If you only want help text, list gh__help alone.
  • 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 YAML
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 YAML
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.

tool policy
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

tool YAML
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//dry-run 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_args so 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.

tool policy
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 RegExp syntax with no flags. They are not anchored, so add ^ and $ when you need that.
  • deny_args, deny_args_regex and deny_argv_regex see the argument array exactly as it was sent, even with known_subcommands: enforce. An alias such as gh ext uninstall is not rewritten to extension remove for 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_regex cannot 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_regex and 50 for deny_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

tool YAML
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//dry-run with {"argv": [...]}. It returns {ok: true} or the rule and message that hit.

5. Common mistakes

  • Patterns are not anchored. secret also matches secretary. 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.

deny list
policy:
  deny_subcommands: [delete, exec]
  deny_subcommand_paths:
    - [rollout, undo]
allow list
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

tool YAML
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 is policy: cannot set both allow_subcommand_paths and deny_subcommand_paths.
  • An approval entry that a deny rule already covers fails with is unreachable in 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.

tool policy
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

tool YAML
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 in value_flags or boolean_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

tool YAML
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 -n in 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 --namespace fails 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.

tool policy
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

tool YAML
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

  1. Call kubectl__run with {"args": ["rollout","restart","deploy/web","-n","dev"]}. Expect Approval required.
  2. Approve on /admin/swipe or /admin/approvals.
  3. Call approvals__wait with the approval id.
  4. 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 YAML
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 YAML
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_id or a subdomain of it. Otherwise the load fails with consent origin must be HTTPS and bound to rp_id.
  • rp_id needs origin. Otherwise: consent rp_id requires origin.
  • A built-in strong path such as gh repo delete is denied unless the tool policy routes it to approval. Add approval_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: (credential_print_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 api in 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.

tool policy
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.

tool YAML
known_subcommands: enforce

How 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

tool YAML
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.

tool policy
policy:
  audit: true

How 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

tool YAML
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 YAML
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:

  1. Open. The breaker stays open for cooldown_seconds. The cooldown is not extended by further denials.
  2. 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.
  3. Closed. It closes when at least window_seconds have passed in half open and half_open_probes different 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.
  4. 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 YAML
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. Watch observe first so a noisy tool does not lock you out.
  • A scope must be global, token or profile:.

Learned grants

An approval can be learned and repeated without a person, within strict limits. It is off by default. See Learned grants.

environment
SPLICEDOCK_GRANTS=1
SPLICEDOCK_GRANT_NAMESPACES=staging

MCP 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 YAML
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 YAML
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.

admin API
PUT    /api/v1/policies/kubectl?profile=reader
DELETE /api/v1/policies/kubectl?profile=reader
POST   /api/v1/policies/kubectl/dry-run

The 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

admin API
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 YAML
server:
  require_profile_token: true

How 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 YAML
server:
  require_profile_token: true

3. 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 get Denied 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 YAML
server:
  token_policy:
    max_ttl_seconds: 2592000
    default_ttl_seconds: 604800
    inactivity_days: 30
    inactivity_mode: enforce
    touch_interval_seconds: 60
    sweep_interval_seconds: 3600

How 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 YAML
server:
  token_policy:
    max_ttl_seconds: 2592000
    default_ttl_seconds: 604800
    inactivity_days: 30
    inactivity_mode: observe
    touch_interval_seconds: 60
    sweep_interval_seconds: 3600

3. 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 enforce before 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 YAML
server:
  shadow:
    enabled: true
    sample_rate: 0.5
    queue_max: 1000
    timeout_ms: 300
    retention_days: 30

How 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 YAML
server:
  shadow:
    enabled: true
    sample_rate: 0.5
    queue_max: 1000
    timeout_ms: 300
    retention_days: 30

3. 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_rate must 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.

tool YAML
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...UseWhy
Hide a whole tool from an agentProfile tools globsThe tool is not listed at all.
Allow only a few verbsallow_subcommands or allow_subcommand_pathsAnything new is denied by default.
Block a few verbsdeny_subcommands or deny_subcommand_pathsGood for an open tool with a few dangerous verbs.
Block a flagdeny_argsExact and simple.
Block a patterndeny_args_regex or deny_argv_regexMatches a shape, or a word anywhere in the call.
Force a flag on every callrequire_args or require_any_ofThe call is denied when it is missing.
Keep kubectl in one namespacerequire_args: --namespace=Namespace confinement checks the whole call.
Let a person decide each timeapproval_subcommands or approval_subcommand_pathsA swipe on the phone page approves one call.
Need a hardware key to approveserver.consent with strong_default_toolsWebAuthn consent in the browser.
Stop an agent that keeps probingserver.breakerForces strong approval after many denials.
Try a rule without riskserver.shadowObserves only. It never changes a decision.
Change a rule right nowA policy overrideNo restart. Test it with the dry-run first.
Limit runtime MCP upstream hostsserver.mcp_upstream_allowlistDeny by default.
See every allowed callaudit: trueAllowed 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.

splicedock.yaml
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.

splicedock.yaml
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.

tool policy
policy:
  deny_argv_regex:
    - "\\b(delete|destroy)\\b"
    - "(^| )--force( |$)"

Test it with the dry-run: POST /api/v1/policies//dry-run 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.

splicedock.yaml
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: true

Test 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.

  1. Turn on the breaker in observe mode and the shadow observer.
  2. Turn on audit: true for the tools you care about.
  3. Test each new rule with the dry-run before you save it.
  4. After a week, read the log and the audit page. Fix rules that deny normal work.
  5. Switch breaker.mode and token_policy.inactivity_mode to enforce.
server YAML
server:
  breaker:
    mode: observe
  shadow:
    enabled: true
    sample_rate: 0.5
  token_policy:
    inactivity_mode: observe

Troubleshooting and FAQ

Start with the text the agent got. It tells you which kind of problem this is.

The agent seesIt meansWhat 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_tokenThe call needs approval but has no profile token.Connect with a profile token.
broker_requiredA 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_subcommandThe first word is not a known command.Check the spelling with the help tool.
breaker_unavailableThe breaker could not read its state in enforce mode.Check the gateway storage and logs.
401 profile_token_requiredNo bearer token was sent.Add the profile token to the MCP client.

Why was my call denied?

  1. Read the rule name after Denied by policy..
  2. Look it up in the order of checks above. An earlier rule hides a later one.
  3. Run POST /api/v1/policies//dry-run with the same argv. The answer holds the rule and the full message.
  4. 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.