[vault] Signing: the Android grant, one answer for every Domi app's release APK and its key on first use; v0.19.0
signing.android: patterns owner/name or owner/*, the certificate's O and C, uses, last used and the keys it made. A request fits when it is an apk from this PC's pipe with a run, pipeline release, a covered repository, and that repository's own app key (<name>-android, scoped to exactly it and release, role release), while card-signing is not ticked; a key's first signature fits. android_grant_make_key makes that key for a covered repository (android-key-made in the security audit). Granting and revoking write standing-granted and standing-revoked. A vault whose grant made a key needs core 0.19.0; older cores drop the grant itself.
This commit is contained in:
+58
-1
@@ -1,4 +1,4 @@
|
||||
# Signing keys (core 0.9.0; deploy approvals 0.12.0; Android APKs 0.14.0; standing approvals 0.16.0; teams 0.18.0)
|
||||
# Signing keys (core 0.9.0; deploy approvals 0.12.0; Android APKs 0.14.0; standing approvals 0.16.0; teams 0.18.0; the Android grant 0.19.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
|
||||
@@ -249,6 +249,57 @@ Never covered by a rule, by construction: another repository, key, kind, pipelin
|
||||
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 Android grant (core 0.19.0)
|
||||
|
||||
A standing approval is one repository's one key, and never a key's first signature. Mark has a dozen Domi apps, each
|
||||
with its own Android key (`<app>-android`), each new: that is a card to make the key's first signature and another to
|
||||
store the rule, per app. **The Android grant** is one answer for all of them: "sign my apps' release APKs, and make
|
||||
each app's key when its first release asks". One grant per vault, in `signing.android`:
|
||||
|
||||
```json
|
||||
"android": { "repos": ["mnovak/*"], "o": "Marek Novak", "c": "CZ", "granted": 1794000000000,
|
||||
"lastUsed": 1794100000000, "uses": 3, "made": ["culina-android"] }
|
||||
```
|
||||
|
||||
- `repos`: 1 to 64 patterns, each `owner/name` or `owner/*` (every repository of that owner, never another
|
||||
owner's); owner and name are 1 to 64 of `A-Z a-z 0-9 . _ -`.
|
||||
- `o`, `c`: the certificate subject's organisation and country for the keys it makes.
|
||||
- `uses`, `lastUsed`: as on a standing approval. `made`: the ids of the keys it made, oldest first (at most 256).
|
||||
|
||||
**An app's key** is named by its repository: `android_key_id("mnovak/Culina")` is `culina-android` (the name in
|
||||
lower case, `.` and `_` as `-`). The grant only ever deals in that key, and only when its scope is exactly that
|
||||
repository and the pipeline `release`, with the role `release`: a key with a wider scope (or `*`) is never the
|
||||
grant's, and a key the grant did not make but that has this shape (`postea-android`) is covered too.
|
||||
|
||||
**A request fits the grant** (`android_grant_fits`) when all of these hold:
|
||||
|
||||
- `signing_check` passes (scope as always: the grant never widens a key's scope);
|
||||
- the kind is `apk` and `via` is `local`: an APK the server runner asks for never fits;
|
||||
- the request names a run;
|
||||
- the pipeline is `release` and the repository matches one of the patterns;
|
||||
- the key is that repository's app key, as above;
|
||||
- `card-signing` (*Sign only with a card*) is not ticked.
|
||||
|
||||
A key's first signature fits too: that is the point of the grant. `signing_sign(req, Approval::Standing, now)` signs
|
||||
a request that fits a standing approval or the grant (a standing approval first), records the outcome `standing`,
|
||||
and counts the use on whichever fitted.
|
||||
|
||||
**Making a key** (`android_grant_make_key(repo, pipeline, via, now)`): the grant covers the repository, the
|
||||
pipeline is `release`, `via` is `local`, `card-signing` is not ticked, and the vault has no key under that id. It
|
||||
makes the RSA-4096 key with the certificate `CN=<Name>` (the repository's name, first letter upper case), `O` and `C`
|
||||
from the grant, named `<Name> Android`, scoped to exactly that repository and `release`, adds the id to `made`, and
|
||||
writes `android-key-made` to the security audit (`<id> for <repo> pipeline release`). It is a key like any other:
|
||||
not exportable, removed only as any key is.
|
||||
|
||||
**Granting** (`android_grant_set(repos, o, c, now)`) stores or replaces the grant (the counts and `made` stay) and
|
||||
writes `standing-granted` with `Android releases: <patterns> pipeline release, keys made on first use`. It is
|
||||
refused while `card-signing` is ticked. `android_grant_revoke` removes it (`standing-revoked`). Neither asks
|
||||
anyone: the app calls them only from Mark's own click.
|
||||
|
||||
Never covered by the grant: another kind, the server runner, a pipeline other than `release`, a repository no pattern
|
||||
matches, a key that is not the repository's app key, a request without a run, anything while *Sign only with a card*
|
||||
is ticked.
|
||||
|
||||
## 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
|
||||
@@ -302,6 +353,12 @@ Vault::standing_grant(&request, now) -> StandingRule //
|
||||
Vault::standing_rule_for(&request, now) -> Option<StandingRule>
|
||||
Vault::standing_rules() -> [StandingRule]
|
||||
Vault::standing_revoke(id, now) -> bool
|
||||
android_key_id(repo) -> Option<String> (core 0.19.0)
|
||||
Vault::android_grant() -> Option<AndroidGrant>
|
||||
Vault::android_grant_set(repos, o, c, now) -> Result<AndroidGrant, Error>
|
||||
Vault::android_grant_revoke(now) -> bool
|
||||
Vault::android_grant_fits(req, now) -> bool
|
||||
Vault::android_grant_make_key(repo, pipeline, via, now) -> Result<String, Error>
|
||||
```
|
||||
|
||||
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