summaryrefslogtreecommitdiffstats
path: root/README
diff options
context:
space:
mode:
Diffstat (limited to 'README')
-rw-r--r--README38
1 files changed, 25 insertions, 13 deletions
diff --git a/README b/README
index 25aea1e..8b5d9e3 100644
--- a/README
+++ b/README
@@ -23,11 +23,10 @@ Commands
git-authz [--policy PATH] validate [options]
git-authz [--policy PATH] grant <user> <repo> <level> [ref ...]
git-authz [--policy PATH] revoke <user> <repo>
- git-authz [--policy PATH] protect [--repo R] <ref pattern> ...
`check` answers one question and is for humans and scripts. `authorize` is what
git invokes. `validate` asks whether the host is wired to run the policy at all.
-The last three edit the file.
+The last two edit the file.
Exit status is the interface, and it does not change:
@@ -87,15 +86,24 @@ and works out what the update *is* before it asks who may do it:
delete the branch HEAD points at admin
a ref outside refs/heads, refs/tags admin
-`set protected-refs <patterns>` raises the price of the listed refs by one level:
-write needs force, force needs admin. `set protected-refs.<repo>` replaces that
-list for one repository, so a repo with different customs does not inherit
-somebody else's.
+That is the whole of it. A rule says what it says: there is no second list
+somewhere else in the file that can make one ref cost more than another, so the
+answer to "who can move main" is the lines that name main, and nothing else.
+
+Which means an unscoped rule really does cover main:
+
+ dave team admin # every ref in team, main included
+
+and a rule that means to leave main alone has to say so by naming what it covers
+instead:
+
+ bob team write refs/heads/feature/* # main is not named, so not granted
Anything that is not a branch or a tag - `refs/notes`, `refs/merge-requests`,
-whatever a tool invents next - is admin-only. It is the part of the namespace no
-policy was written with in mind, and the safe reading of "not mentioned" is "not
-granted".
+whatever a tool invents next - is admin-only whatever a rule appears to grant
+about it. That is the one price the program raises on its own, and it is the one
+the policy cannot name in advance: it is the part of the namespace no policy was
+written with in mind, and the safe reading of "not mentioned" is "not granted".
Identity
@@ -169,7 +177,6 @@ Editing the file
git-authz grant bob team write refs/heads/feature/*
git-authz revoke bob team
- git-authz protect --repo team refs/heads/release
Each writes the file atomically - a temporary in the same directory, then a
rename, keeping the mode and owner - and preserves everything else in the file,
@@ -200,8 +207,13 @@ Reading this as an operator
Because the message ends with what it would have taken:
- deny: bob has write on team refs/heads/main; it needs force
- (raised from write: refs/heads/main is protected)
+ deny: bob holds write on team, but not on refs/heads/main;
+ that ref needs write
+
+ or, when the ref is covered by a rule but costs more than it looks:
+
+ deny: bob has write on team refs/notes/x; it needs admin
+ (neither a branch nor a tag)
which is the whole design in one line: a refusal that names the level held,
the ref, the level required and why, so the fix is obvious to the person who
@@ -214,7 +226,7 @@ Tests
make test
`tests/unit.c` tests the policy engine directly - matching, normalisation, the
-ladder, `@all`, protection, the sentences - and is the place where the semantics
+ladder, `@all`, scope, the sentences - and is the place where the semantics
are pinned. `tests/run.sh` drives the binary the way git does: an identity in
the environment, `old new ref` lines on stdin, the repository as the working
directory, the hook reached through its own name. It uses no git at all, so it