Dog grants
A dog talks to the shepherd over a connection of its own, and by default it may ask for anything the CLI can. Grants list what it may ask instead, so an honest dog stays in bounds and what it asks is attributable.
Granting
$ shep adopt ~/.cargo/bin/shep-otel --name otel otel declares these permissions: flock.read (required): reads the flock to report on it events:process. (optional): hears when a sheep exits Grants keep otel's requests in bounds and do not confine it: it runs as you and can do anything you can. adopt otel and grant it these? [y/N] y # shep.toml [daemon.dog_grants.otel] granted = ["flock.read", "events:process."]
- A no leaves the dog adopted and disabled with nothing granted. The first
shep enableasks again. --yesgrants everything declared. With no terminal and no--yes, nothing changes and the exit is 2.- A dog with no manifest prompts
declares nothing, runs with full access, and a yes records no entry. - An unknown required permission refuses the command. An unknown optional one is dropped with a warning.
- The built-in dogs ask too.
metricsdeclaresflock.read,events:channel.metricandevents:process.;barkdeclaresflock.read,events:process.and an optionalevents:log.for log rules. A built-in enabled before grants existed is granted its list at upgrade, marked not reviewed.
The shepherd reads the list at boot. A name it cannot read stops the boot, and shep adopt and shep enable refuse it too, so a typo never silently grants nothing.
Changing one
$ shep dogs revoke otel events:process. $ shep dogs grant otel events:process.
- Both write
shep.tomland reach a running dog with no restart. grantaccepts only a permission the dog's manifest declares.- A dog with no
dog_grantsentry is refused:shep enableasks for its list first.
Upgrading
shep keeps the record in the same table. The shepherd still reads granted alone.
# shep.toml [daemon.dog_grants.otel] granted = ["flock.read"] waiting = ["events:process."] reviewed = false
- The first shep with grants writes an enabled dog's declared list as
granted, withreviewed = false. That coversmetricsandbarktoo. - A dog with no manifest stays undeclared, with full access.
- A rebuilt dog that declares more puts the new permissions in
waiting, and runs ongrantedmeanwhile. shep enableasks about what waits. A no, or no terminal without--yes, changes nothing.shep dogs grantapproves the one permission it names and clearsreviewed = false.shep lookoutticks the same record:eon a settings dog row opens its grants checklist, and a tick runs the same check as the two verbs.- shep notices a rebuild at the next boot, reload,
enableorgrant.
shep dogs and the Dogs table of shep flock show an ACCESS column for this machine's dogs: undeclared, not reviewed or waiting. --format json adds access to each dog row, and the schema version does not move.
Permissions
| Permission | Lets the dog |
|---|---|
flock.read | look at the flock and its configuration |
flock.control | start, stop, restart and signal sheep |
flock.edit | add and delete sheep and change their configuration |
logs.read | read the end of a sheep's log |
logs.manage | reopen and flush logs |
events:<prefix> | subscribe to topics that begin with the prefix |
secrets.read:<scope> | read a sheep's dog settings with secrets resolved, in the environment the scope names |
secrets.write:<namespace> | push values into that namespace |
dogs.control | enable, disable and configure other dogs |
dogs.trigger:<name> | send an action to the named dog |
shepherd.control | stop the shepherd |
- A dog always keeps its own
dogs.tomlsection and its own sheep settings, whatever it was granted. Another dog'sconfig.dog.<name>needsevents:config.dog.<name>. events:dog.<name>covers the events that dog publishes and no other dog's. Publishing takes no grant: the kind has to be in the dog's manifest.- A subscription is judged on the part of each topic before its first glob character:
events:process.coversprocess.*andevents:process.exitdoes not.
A refusal
A dog granted only flock.read that asks to stop a sheep gets this back:
dog `otel` was refused `stop`: it needs `flock.control`, which was not granted to it
A launched sheep
A sheep sandboxed by a dog gets a link of its own, opened before it drops to its user. The link reads only that sheep's table for the dog and hears only that sheep's config.sheep.<dog> events. Anything else is forbidden, naming the request. The control socket still refuses the sheep.
Older shepherds
A shepherd older than protocol 12 records grants and enforces nothing. shep adopt and shep enable say so when they reach one.