summaryrefslogtreecommitdiffstats
path: root/README
diff options
context:
space:
mode:
Diffstat (limited to 'README')
-rw-r--r--README44
1 files changed, 33 insertions, 11 deletions
diff --git a/README b/README
index 1f6eb30..eee46fa 100644
--- a/README
+++ b/README
@@ -28,14 +28,17 @@ git invokes. `validate` asks whether the policy is one the hook can use.
Exit status is the interface, and it does not change:
0 allowed
- 1 denied
- 3 no usable policy - the host is broken, not this person
+ 1 denied - this person may not
+ 3 the host is broken, not this person
64 usage error
-Three is separate from one on purpose. A push refused because the policy file
-was not mounted produces one line in a log somewhere; a push refused because the
-user is not allowed produces a message to a colleague. They must not sound the
-same, and a monitor must not have to parse prose to tell them apart.
+Three is separate from one on purpose, and it covers two different breakages: a
+policy the hook cannot use says `invalid policy file`, and a hook handed
+something that is not a push - which no real git ever does - says `invalid
+operation`. A push refused because the person is not allowed is theirs, and says
+`permission denied` with the name they came as and the ref they were refused.
+They must not sound the same, and a monitor must not have to parse prose to tell
+them apart - which is also why each of them is one line.
The policy
@@ -167,25 +170,44 @@ Warnings do not stop it; errors do, and `--strict` makes warnings stop it too.
Reading this as an operator
---------------------------
+A refused push says one line, and it says only the input it refused:
+
+ git-authz: permission denied [user=bob, obj=refs/heads/main]
+
+That is the whole of what the person pushing is told, on purpose: the reason is
+a sentence about a file they cannot read, and quoting it at them sends them to
+somebody else's configuration. The reason is here instead:
+
who may write to team?
git-authz check bob team write refs/heads/feature/login
- why was my push refused?
+ why was that push refused?
- Because the message ends with what it would have taken:
+ git-authz check bob team write refs/heads/main
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:
+ git-authz check bob team write refs/notes/x
+
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
- hit it instead of a ticket to whoever set this up.
+ which is the whole design in two lines: the refusal names who and what, the
+ answer names the level held, the ref, the level required and why, so the fix
+ is obvious to whoever owns the policy and the person who hit it is not left
+ guessing either.
+
+`authorize --explain` prints that sentence in the hook's own seat, for when the
+operator is the one standing there. A policy the hook cannot use says `invalid
+policy file` and nothing else at exit 3; `validate` is what says what is wrong
+with it, with the line numbers. Exit 3 has one other cause: `invalid operation`,
+for a hook handed a line that is not an update - three fields, two object ids and
+a ref under `refs/`. No git writes that, so it is the pipe, the wrapper or
+whoever was debugging, and never the person pushing.
Layout