Skip to content

Repository policies

A repository’s .moat/policy.yaml (at the project’s root, the folder ${project} names) is untrusted input, so by itself it can only make your policy stricter:

The repository’s Applies
deny rules at once, for everyone, as repo:<id>
review rules at once, right after the deny rules
allow rules only after you run openmoat trust on that exact file, or, with require_signed_repo_policy: true, when a key you trusted signed it

Any later change to the file drops it back to deny and review only, until you trust it again. A file that does not parse denies every call in the project until it is fixed. Repository rules apply in the hook, not in the agents’ OS sandboxes. A signed policy pack’s rules show up as pack:<name>:<id>: its deny rules join yours, its review rules come before your allow rules, and its allow rules after yours.

  • Only version, deny, review and allow. (ask, the name before 0.14.0, is still read; a file with both ask and review is invalid.) defaults, executables and sandbox stay yours; any other key makes the file invalid (kernel-error on every call in the project).
  • Its review rules never soften your deny (from 0.16.0): per action the stricter of the two policies wins, so a repository’s review: [{net: ['*']}] leaves the hosts your net: deny default refuses denied.
  • Its review rules come before your allow rules, so a rule you added with openmoat allow --always does not silence a repo: review. openmoat allow --last (that session) does, and so does answering the prompt.
  • Trusted allow rules come after yours, so your deny rules (secrets-paths, kernel-self, …) still win. They can widen your review rules and defaults: read them before you trust.
  • Ids are prefixed (repo:no-prod-config) in messages, the audit log and openmoat show, so a repository rule cannot pose as one of yours.
  • Trust is per checkout and per file. It is kept in ~/.moat/trust.json, never in the repository: a copy of the repository in another folder, or the file after a pull, applies in its tightening-only form until you run openmoat trust there.

Writing one, trusting it and reviewing changes: A repository policy. What you see in a repository that has one: Use it in your projects.