The .lootattributes file

The .lootattributes file

.lootattributes maps path patterns to visibility. The first matching rule decides, and a path no rule matches is Internal.

loot reads the one at the repo root on every capture. It is versioned like any other file, so the policy travels to every clone.

# comments start with #
.env                restricted=alice
secrets/admin.txt   restricted=alice
secrets/**          restricted=alice,bob
site/**             published
NOTES-next.md       embargoed=1800000000
**.md               internal

Lines

  • A rule is exactly two words: a pattern, whitespace, then a spec. Leading and trailing whitespace is trimmed, and any run of spaces or tabs separates.
  • A line starting with # is a comment, and blank lines are skipped. There are no trailing comments.
  • A line with one word, or with anything after the spec, is refused when you record (below).
  • Line numbers count blanks and comments, as your editor does. Refusals and loot explain cite them.

Patterns

PatternMatchesDoes not match
.env.envconfig/.env
*.mdREADME.mddocs/a.md
**.mdREADME.md, docs/a/b.mdREADME.MD
**/*.mddocs/a.mdREADME.md
docs/**docs/a.md, docs/x/y.pngsrc/docs/a.md
  • A pattern matches the whole path from the repo root, with / separators on every platform. A \ in a pattern is read as /.
  • * matches any run of characters except /. ** matches any run including /, and may match nothing.
  • Every other character is literal: there is no ?, no [...] and no !. Matching is case-sensitive.
  • A pattern ending in / is refused, because it matches no path. Write a directory as docs/**.
  • A pattern starting with /, or holding a ., .. or empty segment (a//b), is refused for the same reason. Patterns are already rooted, so drop a leading /.
  • A pattern can’t contain a space: whitespace ends it, so the line has too many words and is refused. Use * in its place (my*file.txt), which also matches other characters there.

Matching order

Rules are tried top to bottom, and the first pattern that matches decides. Later rules are never consulted, so put narrow rules above broad ones. In the example above, secrets/admin.txt is held by alice alone; swap its two lines and the rule naming bob decides it too. A path no rule matches is Internal.

loot explain <path> prints the rule that decided, its line, and every rule it passed over. It reads only the rules, so you can ask about a path before the file exists. It also names any line loot skips or misreads.

Specs

SpecTierNotes
internalInternalThe same tier as no rule. A rule that names the path, rather than a catch-all such as **, counts as consent for the mis-seal gate.
publicInternalAn older spelling of internal, still accepted. It does not publish.
restricted=<id>[,<id>…]RestrictedIdentity names, comma-separated, no spaces. Empty names between commas are dropped; restricted= alone is refused, and so is a space after a comma.
embargoed=<unix-seconds>EmbargoedA whole number of seconds since 1970 UTC. Anything else is refused.
publishedPublishedWorld-readable at a forge. A path’s first publication needs consent (below).

Restricted names decide your own key, not anyone else’s. When you record the path, loot files the key in your keyring only if your identity name is on the list. Listing a teammate doesn’t send them the key; you deliver it with loot grant. The file is itself Internal unless a rule says otherwise, so everyone with repo access can read the names in it.

What a recording refuses

loot describe and loot new check the rules before they seal anything, and refuse these cases. Read-only verbs keep working.

RefusedOverride
A line loot can’t apply as written: an unknown spec, a pattern no path can match, or a line that isn’t exactly two words. Ignoring it would let the path fall through to Internal, or drop a holder.None: fix the line
A path’s first publication--allow-publish <path>
A restricted= list without your name, which seals the content to no one, permanently--allow-lockout <path>
A secret-shaped name (.env, *.pem, id_rsa and the like) sealed Internal for the first time with no rule naming it--allow-reveal <path>
A rule change that would re-seal content more readably--allow-demote <path>

To change the tier of a path that already has history, see Change a path visibility. Who can read each tier is on the trust matrix.