[vault] Standing approvals: a rule Mark grants from a card (repository, key, kind, pipeline, origin; an approval's targets), signed without asking as outcome standing, counted, revocable, paused by card-signing; never a key's first signature or a mailbox release signature; v0.16.0
This commit is contained in:
+5
-2
@@ -142,7 +142,10 @@ member), so these values, new in core 0.12.0, make a vault unreadable for a core
|
||||
written: a `signing` audit entry of kind `approval` (docs/SIGNING.md), a `provision` entry with store `display` or
|
||||
outcome `confirmed`. A vault without them still opens in core 0.11.0. Core 0.14.0 adds two more: a `signing` key
|
||||
of kind `android` and an audit entry of kind `apk` (docs/SIGNING.md); a vault that holds either does not open in a
|
||||
core before 0.14.0.
|
||||
core before 0.14.0. Core 0.16.0 adds the `signing` audit outcome `standing` and the `security` actions
|
||||
`standing-granted` and `standing-revoked` (docs/SIGNING.md, "Standing approvals"): a vault in which a standing
|
||||
approval was ever granted does not open in a core before 0.16.0. The rules themselves (`signing.standing`) are a
|
||||
member older cores ignore and drop.
|
||||
|
||||
### The provision audit (core 0.11.0)
|
||||
|
||||
@@ -206,7 +209,7 @@ an outcome; a code the server then refuses (its exit 10) is not seen by Custos,
|
||||
| `finished` | optional: when that window ended, by *Finish setup*, or `until` once its expiry was noticed |
|
||||
| `ticked` | the checklist items that are ticked: `totp-on-phone`, `hello-approvals`, `narrow-scope`, `rotate-setup`, `no-ssh`, `phone-approves`, and (core 0.13.0) `no-auto-connect`, `no-unattended`, `card-signing` |
|
||||
| `keptScope` | optional: the server scope prefixes *Narrow the server scope* replaced (`ask`, `offer`: at most 64 each, 1–200 characters, no control characters), kept for its undo |
|
||||
| `audit` | `{at, action, item?, auth?, detail?}`; `action` is `setup-started`, `setup-finished`, `setup-expired`, `ticked`, `unticked`, `ssh-connected`, `totp-moved`, or (core 0.13.0) `auto-connected`, `unattended-stored`, `setup-item-removed`, `unattended-signed`, `taken-over`; `item` a checklist item (with `ticked`, `unticked`); `auth` is `hello` or `password` (with `unticked`); `detail` (core 0.13.0, the four notes) names what happened, never a value: 1–500 characters, no control characters |
|
||||
| `audit` | `{at, action, item?, auth?, detail?}`; `action` is `setup-started`, `setup-finished`, `setup-expired`, `ticked`, `unticked`, `ssh-connected`, `totp-moved`, or (core 0.13.0) `auto-connected`, `unattended-stored`, `setup-item-removed`, `unattended-signed`, `taken-over`, or (core 0.16.0) `standing-granted`, `standing-revoked`; `item` a checklist item (with `ticked`, `unticked`); `auth` is `hello` or `password` (with `unticked`); `detail` (core 0.13.0, the four notes; core 0.16.0, the two standing actions) names what happened, never a value: 1–500 characters, no control characters |
|
||||
|
||||
The **level** is computed, never stored:
|
||||
|
||||
|
||||
+58
-2
@@ -1,4 +1,4 @@
|
||||
# Signing keys (core 0.9.0; deploy approvals 0.12.0; Android APKs 0.14.0)
|
||||
# Signing keys (core 0.9.0; deploy approvals 0.12.0; Android APKs 0.14.0; standing approvals 0.16.0)
|
||||
|
||||
Custos signs releases for Fabrica Domi · Artifex without a private key ever leaving the vault. A build asks for a
|
||||
signature over a **digest**; Custos checks who may ask, Mark approves with a match code, and the vault signs and
|
||||
@@ -195,6 +195,51 @@ the digests and answers with placeholder signatures (the signed data does not de
|
||||
Custos's answer, again with a signer that hands each recorded digest its signature, and refuses any digest it did
|
||||
not record. It verifies the result with apksig's verifier before it writes the APK.
|
||||
|
||||
## Standing approvals (core 0.16.0)
|
||||
|
||||
A release key always asks. A **standing approval** is Mark's answer kept: "always allow this, for this repository".
|
||||
It is a rule in `signing.standing`, made only from a request Mark is approving on a card, and a later request that
|
||||
fits it is signed without a card.
|
||||
|
||||
```json
|
||||
"standing": [
|
||||
{ "id": "5b0c1e0f6a2d4c11", "repo": "mnovak/Postea", "key": "postea-android", "keyCreated": 1793750000000,
|
||||
"kind": "apk", "pipeline": "release", "via": "local", "granted": 1794000000000, "lastUsed": 1794100000000, "uses": 3 },
|
||||
{ "id": "9d3e…", "repo": "Aula", "key": "domi-approve", "keyCreated": 1793750000000, "kind": "approval",
|
||||
"pipeline": "deploy", "via": "remote", "targets": ["deploy to nixos-vm"], "granted": 1794000000000, "uses": 0 }
|
||||
]
|
||||
```
|
||||
|
||||
**What a rule is.** Five things, all compared exactly (no `*`, no prefix): the repository and the pipeline as the
|
||||
scope check reads them (an approval's own `repo` and `pipeline`), the key (its id and its `created` time, so a key
|
||||
made later under the same id never inherits a rule), the kind, and `via` (the Domi pipe or the factor service's
|
||||
mailbox). A rule for an `approval` also keeps the targets it was granted for. `id` is the first 16 hex characters
|
||||
of the SHA-256 of `repo`, `key`, `kind`, `pipeline` and `via` joined by newlines, so one rule exists per
|
||||
combination. The trigger and the step are not part of a rule; they are in every audit entry.
|
||||
|
||||
**A request fits a rule** (`standing_rule_for`) when all of these hold:
|
||||
|
||||
- `signing_check` passes: a rule never widens a key's scope, and narrowing the scope afterwards stops the rule;
|
||||
- the request names a run;
|
||||
- repository, pipeline, key (id and `created`), kind and `via` equal the rule's;
|
||||
- for an approval, every target of the request is one of the rule's targets;
|
||||
- `via` is `local`, or the kind is `approval`: a release signature asked through the mailbox never fits a rule;
|
||||
- the checklist item `card-signing` (*Sign only with a card*) is not ticked.
|
||||
|
||||
**A rule is made** (`standing_grant`) only when the request would itself fit the rule being made, the key is a
|
||||
release key (a test key needs none), and **the key has signed before** (an `approved` or `standing` audit entry):
|
||||
a key's first signature is never the one that starts a rule. Granting again for an approval adds its targets to
|
||||
the rule. At most 256 rules. `standing_revoke` removes one. Granting and revoking are written to the security audit
|
||||
(`standing-granted`, `standing-revoked`, with the rule's fields as the detail).
|
||||
|
||||
**Signing with a rule** is `signing_sign(req, Approval::Standing, now)`: it checks the request, finds the rule
|
||||
(refusing with `NeedsApproval` when none fits), signs, records the outcome `standing` with everything an `approved`
|
||||
entry holds, and counts the use on the rule (`uses`, `lastUsed`).
|
||||
|
||||
Never covered by a rule, by construction: another repository, key, kind, pipeline or origin; a request out of the
|
||||
key's scope; a request without a run; a key's first signature; a deploy to a target the rule was not granted for;
|
||||
a release signature the server runner asks for; creating a key.
|
||||
|
||||
## The audit log
|
||||
|
||||
`audit` is append-only: there is no function that edits or removes an entry. Every request a key is named in gets
|
||||
@@ -203,6 +248,7 @@ one entry, whatever happened:
|
||||
| `outcome` | |
|
||||
| :-- | :-- |
|
||||
| `approved` | Mark approved; signed |
|
||||
| `standing` | (core 0.16.0) a standing approval fitted; signed without asking |
|
||||
| `auto` | a test key; signed without asking |
|
||||
| `refused` | Mark refused |
|
||||
| `expired` | nobody answered within 5 minutes |
|
||||
@@ -214,6 +260,11 @@ one entry, whatever happened:
|
||||
(core 0.12.0) is the context's version, absent when empty. The entry is part of the vault, so it survives a reopen
|
||||
and travels with it.
|
||||
|
||||
**Compatibility (core 0.16.0).** A core before 0.16.0 ignores `standing` when it reads and drops it when it saves
|
||||
(the rules are gone and every request asks again). The audit outcome `standing` and the security actions
|
||||
`standing-granted` and `standing-revoked` are values it does not know: once a rule was granted, every Custos that
|
||||
opens the vault must be on core 0.16.0 or later (an older one refuses it as `Corrupted`).
|
||||
|
||||
**Compatibility.** A key of kind `android` and an audit entry of kind `apk` (core 0.14.0) are values a core
|
||||
before 0.14.0 does not know: once the vault holds an Android key, every Custos that opens it must be on core 0.14.0
|
||||
or later (an older one refuses the vault as `Corrupted`; the web vault, which never reads `signing`, is unaffected).
|
||||
@@ -234,9 +285,14 @@ Vault::signing_export_cert(id) -> DER //
|
||||
Vault::signing_minisign_public(id) -> minisign.pub text
|
||||
Vault::signing_check(&request) -> Ok | Refusal // before asking Mark (the clock: now_ms)
|
||||
Vault::signing_check_at(&request, now) -> Ok | Refusal // the same at `now` (an approval's expiry)
|
||||
Vault::signing_sign(&request, Approval::{Mark, Auto}, now) -> Signed // checks again, signs, records
|
||||
Vault::signing_sign(&request, Approval::{Mark, Auto, Standing}, now) -> Signed // checks again, signs, records
|
||||
Vault::signing_refuse(&request, outcome, now) // records refused / expired
|
||||
Vault::signing_audit() -> [AuditEntry]
|
||||
Vault::standing_can_grant(&request, now) -> Ok | why not // may the card offer "always"? (0.16.0)
|
||||
Vault::standing_grant(&request, now) -> StandingRule // before signing the approved request
|
||||
Vault::standing_rule_for(&request, now) -> Option<StandingRule>
|
||||
Vault::standing_rules() -> [StandingRule]
|
||||
Vault::standing_revoke(id, now) -> bool
|
||||
```
|
||||
|
||||
No function returns a `secret`. The views and the audit entries print and serialise without one; there is a test.
|
||||
|
||||
Reference in New Issue
Block a user