Operator Approvals
Hold a risky Docker API request until an operator reviews and approves it, from the sockguard approvals CLI or the admin API.
A hold rule pauses the client's request for operator review. If the operator
approves within approvals.wait, the request proceeds on the original
connection. After the wait ends, the client must retry the same request to use
the approval. All other policy checks still apply.
Use it for the few requests you won't allow all the time and won't deny all the time either, such as one container create a month from a CI runner that should get a second pair of eyes.
Turn it on
Approvals need a dedicated admin listener, because that is the only place the decision endpoints exist.
admin:
enabled: true
listen:
socket: /var/run/sockguard-admin/admin.sock
approvals:
enabled: true
wait: 30s
log:
audit:
enabled: true
rules:
# The client's own version negotiation, which a Docker client makes before
# it creates anything.
- match: { method: GET, path: "/_ping" }
action: allow
- match: { method: HEAD, path: "/_ping" }
action: allow
- match: { method: GET, path: "/version" }
action: allow
- match: { method: POST, path: "/containers/create" }
action: hold
reason: "container creates need a human"
- match: { method: "*", path: "/**" }
action: denyA client can only reach the held route if the rules before it let its other
calls through. Allow what it needs to negotiate and to inspect, and put the
hold rule on the one route a person should look at.
approvals.enabled is required by any hold rule. Startup is refused unless
admin.listen is a unix socket, or TCP with complete mutual TLS and none of the
insecure_* flags. A hold rule on a route whose body Sockguard can't read is
refused at startup the same way an allow rule is. See
Configuration for every approvals.* key and
Admin API for the endpoints.
What the client sees
- The client sends the request. Sockguard decides it as if it were an allow rule first: the body inspectors, admission mutations and read-exfiltration checks run before anyone is asked. A request an inspector refuses is refused with its own reason and never reaches an operator.
- If it passes, Sockguard records an ask and holds the connection for up to
approvals.wait(default30s, at most55s). - If an operator approves inside that window, the request goes through on the
same connection. If not, the client gets
403withreason: approval_pendingand a hold id, and an approval given afterwards is used by the client's next identical request.
{
"message": "sockguard: held for operator approval (hold 0a1b2c3d4e5f60718293a4b5c6d7e8f9).",
"reason": "approval_pending",
"approval": { "id": "0a1b2c3d4e5f60718293a4b5c6d7e8f9", "state": "pending", "expires": "2026-12-01T10:00:00Z" }
}Docker CLI and docker-py show the message and ignore the other fields. Keep
approvals.wait under the client's own timeout. The default 30 seconds is below
docker-py's 60 second default and the Docker CLI sets no timeout on these calls
by default.
Other answers a held request can get:
| Reason code | Meaning |
|---|---|
approval_denied | An operator denied it. The denial is remembered for ask_ttl, so a retry doesn't ask again. |
approval_expired | Nobody answered within ask_ttl. |
approval_cancelled | A policy reload or shutdown canceled the hold. Run the command again. |
approval_stale | The request, or the policy that held it, changed after it was held. Ask again. |
approval_not_holdable | The request can't be shown to an operator in full, so it is refused without an ask. |
429 | The profile is over max_pending open asks or max_new_per_hour new ones, or the registry is at its global cap of 256 pending asks and 512 entries. Retry-After says when to try again. |
Streams, hijacked requests, tar bodies, encoded bodies, bodies that aren't JSON, oversize bodies and bodies the operator view can't show in full aren't holdable in this release.
sockguard validate and sockguard serve at startup warn when a hold rule
matches only streaming or upgrade routes in the known Docker and Podman API
catalog. The warning identifies the rule and leaves its policy unchanged.
What binds an approval
An approval is single use and is bound by a keyed HMAC-SHA-256 fingerprint to
the client, profile, upstream, method, path, query, eligible headers and body.
Changing a bound field creates a new ask. The fingerprint excludes volatile
headers such as X-Request-Id, Traceparent and Baggage, plus Content-Length
and hop-by-hop headers. An approval expires after grant_ttl, and a reload
cancels every pending ask and unused approval.
When the client retries, the request is decided again from its original bytes
and must produce the same forwarded method, path, query and body. It then passes
ownership, visibility, resource limits and rate limits like any other request.
An approval overrides the hold rule's verdict and nothing else.
Review and decide from the CLI
The sockguard approvals commands talk to the admin listener. They read
admin.listen from --config, or you point them at it with --socket or
--address.
sockguard approvals list
sockguard approvals show 0a1b2c3d
sockguard approvals approve 0a1b2c3d --note "ticket 4521"
sockguard approvals deny 0a1b2c3d --note "not from CI"| Command | What it does |
|---|---|
approvals list [--all] [--json] | Pending asks, or with --all the decided ones still held in memory. |
approvals show <id> [--json] | The full rendering of one ask and its digest. |
approvals approve <id> [--note s] [--remember] [--yes] | Fetches the ask, prints it, asks y/N, then approves. |
approvals deny <id> [--note s] | Denies the ask. |
An id can be given as any unique prefix of at least eight characters. A prefix
that matches more than one ask is refused, and a prefix only looks at live
entries: pending asks and decided ones still held in memory. The registry keeps
up to 64 retired consumed, expired or cancelled asks, accessible by full id.
Denied asks are removed when ask_ttl expires.
approve always fetches the ask and prints the rendering before it does
anything, so what you confirm is what you were shown. It then sends the digest
of that rendering back with the decision. If the ask changed in between, the
server answers 422 and nothing is approved. --yes skips only the y/N
prompt, and approve without it needs a terminal on both stdin and stdout, so a
script has to say --yes on purpose. If the rendering can't be written to
stdout, nothing is approved, with or without --yes. --remember is accepted and recorded and has no other
effect in this release.
Everything the server sends is escaped again before it reaches your terminal, so a request can't move the cursor, recolor the screen or hide text.
Reaching the admin listener
| Admin listener | What to pass |
|---|---|
| Unix socket | Nothing, if --config names a config with admin.listen.socket, or --socket <path>. You are identified by your uid. |
| TCP with mutual TLS | --address host:port, --tls-cert, --tls-key, and --tls-ca if the listener's certificate isn't signed by a system root. --tls-server-name overrides the name checked. You are identified by your client certificate. |
The CLI requires TLS 1.3 and a client certificate for TCP. It never sends a credential over plaintext TCP.
What you review
The rendering lists every explicit JSON leaf with its path and an ASCII-escaped
value, including false, 0, and empty arrays and objects. It also reports how
many leaves have zero values. Sockguard refuses the rendering if the request
has more than 256 leaves, a path over 256 bytes, a value over 512 bytes, more
than 32 KiB of output, a repeated or case-variant key, or a malformed query.
Container create and exec create also get risk flags: privileged, added
capabilities, host binds and mounts with their mode, devices, host namespaces,
security options, user, published ports, runtime, volumes-from, unlimited memory
or pids, tty and stdin. Env values show as NAME=<hidden>. Header values are
never shown. Commands are shown in full.
Audit trail
With log.audit.enabled, the audit writer must acknowledge approve_attempted
before Sockguard commits an approval. If the acknowledgment fails or takes
longer than five seconds, the admin API returns 503. A late attempt can still
appear in the log. approved records a committed decision, and approve_failed
records an attempt that did not commit. Outcome and lifecycle records are best
effort under backpressure. Sockguard logs a startup warning if approvals are
enabled without an audit log. See Audit records for the
event fields.
The access log gains approval_id, and these metrics are added:
sockguard_approval_requests_total, sockguard_approvals_pending,
sockguard_approval_grants_unused, sockguard_approval_waiters and
sockguard_approval_decision_seconds.
Limits in this release
- The registry lives in memory. A restart drops every ask and unused approval, and clients ask again.
- The registry keeps up to 64 retired consumed, expired or cancelled asks by
full id. Denials are removed at
ask_ttl. - There is no webhook or chat notification yet. Operators run
approvals listor poll the admin endpoint. --rememberdoes not create a rule.
Admin API
Sockguard's optional admin endpoints — config validation, policy comparison and generation introspection. Deploy on a dedicated listener to keep admin traffic off the Docker-API data plane.
Comparing Docker socket proxies
Compare access controls and check compatibility before moving an existing client to Sockguard.