Policy

A policy is a YAML file. Check it with:

garm policy check garm-policy.yaml
mode: observe            # or enforce (the default)

packs:                   # built-in label packs, see "Label packs"
  - github
  - { pack: filesystem, server: fs }

sources:                 # what results are
  - match: { mcp: postgres, tool: query }
    labels: { confidentiality: confidential, tags: ["pii"] }
  - match: { file: "~/.ssh/**|**/.env" }
    labels: { confidentiality: secret }

sinks:                   # where calls send data
  - match: { mcp: slack, tool: post_message }
    clearance: confidential
    external: false
  - match: { http: { method: "POST|PUT", host: "*" } }
    clearance: public

rules:
  - name: secrets-never-leave
    when: { session.confidentiality: secret, sink.clearance: "< secret" }
    action: block
  - name: redact-pii-to-slack
    when: { session.tags: contains("pii"), sink.mcp: slack }
    action: redact

Matching

Each match has exactly one of:

Values are globs, and | separates alternatives: get_*|list_*.

Sources

labels sets confidentiality, integrity and tags. Parts you leave out default to the bottom (public, trusted). When several sources match, their labels combine. A result no source matches is untrusted and internal.

Sinks

clearance is the most confidential data allowed to go there. external (default true) says whether data sent there leaves your organisation. When several sinks match, the strictest wins. A call no sink matches is a public, external sink.

Rules

Every condition in when must hold:

ConditionExampleMeaning
session.confidentialitysecret, ">= confidential"at least this sensitive
session.integrityuntrusted, "<= partner"at most this trusted
session.tagscontains("pii")the session carries this tag
sink.externaltruethe sink leaves your organisation
sink.clearance"< secret", publiccompares the sink’s clearance
sink.mcpslackthe sink’s server (a glob)

Actions are redact (remove what DLP finds from the arguments, then allow), hold and block. There are no allow rules: the most severe matching rule wins, and the built-in trifecta and clearance rules are always on.

Modes

In observe mode Garm decides every call and logs the decision, but forwards everything. Start there, read garm audit tail for a few days, adjust labels, then switch to enforce.