[vault] Signing: the Android grant (v0.19.0) #25

Manually merged
mnovak merged 1 commits from feature/android-grant into main 2026-11-21 08:58:45 +01:00
Owner

Mark, 2026-11-21: "the custos should have pre approved standing aproval for android swigning as well". About a dozen Domi apps are about to ship their first APK. Each would stop on a card that makes its <app>-android key's first signature, then on another to store the standing approval, then again for each new app. A standing approval cannot cover this: it names one repository and one key, and never a key's first signature.

What it adds (core 0.19.0, docs/SIGNING.md "The Android grant", docs/FORMAT.md):

  • signing.android: one grant per vault.

    • repos: 1–64 patterns, each owner/name or owner/*.
    • o, c: the subject of the certificates it makes.
    • uses, lastUsed, and made (the ids of the keys it made).
  • android_key_id(repo): mnovak/Culina → culina-android.

  • android_grant_fits(req): true only when all of these hold:

    • the request is an apk from this PC's pipe (via local), with a run, in the key's scope, pipeline release;
    • the repository is covered by a pattern;
    • the key is that repository's own app key: the id above, role release, scoped to exactly that repository and release;
    • Sign only with a card is not ticked.

    A key's first signature fits.

  • signing_sign(Approval::Standing) uses a standing approval first, then the grant. The outcome is standing, and the use is counted on whichever fitted.

  • android_grant_make_key(repo, pipeline, via) makes the app key for a covered repository, under the same conditions: local, release, not paused, no key under that id yet. It is RSA-4096 with CN=<Name> and the grant's O and C. It writes the new security action android-key-made.

  • android_grant_set / android_grant_revoke write standing-granted / standing-revoked with the grant's words. Setting is refused while Sign only with a card is ticked.

  • grant_ok on load: a grant that android_grant_set could not have written makes the vault Corrupted. That covers bad patterns, duplicates, a bad subject, and bad ids in made.

  • Format: older cores ignore and drop signing.android, so the grant is lost, never widened. A vault in which the grant made a key carries android-key-made and needs core 0.19.0.

Tests:

  • tests/android_grant.rs, 8 tests:
    • the app key's name;
    • make the key, first signature with no card, counts and notes;
    • never make an uncovered key: another repo, another owner, another pipeline, the server runner, not owner/name, made twice, paused, no grant;
    • only the repo's own app key fits: not the server runner, no run, a wider-scoped key, another repo's key, a test key, or another kind;
    • an explicit list, edits, bad patterns, 65 patterns, the subject;
    • pause and revoke (Mark still signs on a card);
    • a standing approval is used first;
    • the grant survives a reopen.
  • Unit test a_broken_android_grant_makes_the_vault_refuse_to_open: 7 edits to the stored grant.
  • Workspace: 269 passed, 0 failed (cargo test --workspace --release). The new tests were written before the code but never run against stubs, so none was seen failing first.

Self-review (adversarial):

  • Someone running programs as Mark on this PC can have an APK of a covered repository signed by its app key with no card, including its first. This is the same risk docs/15 accepted per repository, now for every covered repository at once. That is what Mark asked for, and it is stated where he grants it. They can also make a key for a covered repository that has none, which becomes that app's Android identity if it is ever published. Mitigations:
    • every key made is an android-key-made entry;
    • every signature is a standing audit entry with the file's sha256 and commit;
    • the grant shows its uses and the keys it made;
    • Sign only with a card pauses it, and Remove ends it.
  • A compromised server gains nothing. The fit checks and make_key both refuse via: remote, so it can neither sign nor make keys.
  • Wildcards: *, */* and mnovak/Cu* are refused, and owner/* never matches another owner. Repository names are compared exactly, as the scope check reads them.
  • A key with a wider scope (*), or a key whose id does not follow the repository, is never the grant's, so a hand-made key with a wider scope keeps asking.
  • No secret reaches an error, a note or a Debug output: notes hold ids and repository names only.

Not done here: the app's UI and pipe wiring (Custos repo); which programs may ask is the app's fabrica/ grant, as for standing approvals.

Mark, 2026-11-21: "the custos should have pre approved standing aproval for android swigning as well". About a dozen Domi apps are about to ship their first APK. Each would stop on a card that makes its `<app>-android` key's first signature, then on another to store the standing approval, then again for each new app. A standing approval cannot cover this: it names one repository and one key, and never a key's first signature. **What it adds (core 0.19.0, docs/SIGNING.md "The Android grant", docs/FORMAT.md):** - `signing.android`: one grant per vault. - `repos`: 1–64 patterns, each `owner/name` or `owner/*`. - `o`, `c`: the subject of the certificates it makes. - `uses`, `lastUsed`, and `made` (the ids of the keys it made). - `android_key_id(repo)`: `mnovak/Culina` → `culina-android`. - `android_grant_fits(req)`: true only when all of these hold: - the request is an `apk` from this PC's pipe (`via` local), with a run, in the key's scope, pipeline `release`; - the repository is covered by a pattern; - the key is that repository's own app key: the id above, role release, scoped to exactly that repository and `release`; - *Sign only with a card* is not ticked. A key's first signature fits. - `signing_sign(Approval::Standing)` uses a standing approval first, then the grant. The outcome is `standing`, and the use is counted on whichever fitted. - `android_grant_make_key(repo, pipeline, via)` makes the app key for a covered repository, under the same conditions: local, `release`, not paused, no key under that id yet. It is RSA-4096 with `CN=<Name>` and the grant's O and C. It writes the new security action `android-key-made`. - `android_grant_set` / `android_grant_revoke` write `standing-granted` / `standing-revoked` with the grant's words. Setting is refused while *Sign only with a card* is ticked. - `grant_ok` on load: a grant that `android_grant_set` could not have written makes the vault `Corrupted`. That covers bad patterns, duplicates, a bad subject, and bad ids in `made`. - Format: older cores ignore and drop `signing.android`, so the grant is lost, never widened. A vault in which the grant made a key carries `android-key-made` and needs core 0.19.0. **Tests:** - `tests/android_grant.rs`, 8 tests: - the app key's name; - make the key, first signature with no card, counts and notes; - never make an uncovered key: another repo, another owner, another pipeline, the server runner, not `owner/name`, made twice, paused, no grant; - only the repo's own app key fits: not the server runner, no run, a wider-scoped key, another repo's key, a test key, or another kind; - an explicit list, edits, bad patterns, 65 patterns, the subject; - pause and revoke (Mark still signs on a card); - a standing approval is used first; - the grant survives a reopen. - Unit test `a_broken_android_grant_makes_the_vault_refuse_to_open`: 7 edits to the stored grant. - Workspace: 269 passed, 0 failed (`cargo test --workspace --release`). The new tests were written before the code but never run against stubs, so none was seen failing first. **Self-review (adversarial):** - *Someone running programs as Mark on this PC* can have an APK of a covered repository signed by its app key with no card, including its first. This is the same risk docs/15 accepted per repository, now for every covered repository at once. That is what Mark asked for, and it is stated where he grants it. They can also make a key for a covered repository that has none, which becomes that app's Android identity if it is ever published. Mitigations: - every key made is an `android-key-made` entry; - every signature is a `standing` audit entry with the file's sha256 and commit; - the grant shows its uses and the keys it made; - *Sign only with a card* pauses it, and Remove ends it. - *A compromised server* gains nothing. The fit checks and `make_key` both refuse `via: remote`, so it can neither sign nor make keys. - *Wildcards:* `*`, `*/*` and `mnovak/Cu*` are refused, and `owner/*` never matches another owner. Repository names are compared exactly, as the scope check reads them. - *A key with a wider scope* (`*`), or a key whose id does not follow the repository, is never the grant's, so a hand-made key with a wider scope keeps asking. - No secret reaches an error, a note or a Debug output: notes hold ids and repository names only. **Not done here:** the app's UI and pipe wiring (Custos repo); which programs may ask is the app's `fabrica/` grant, as for standing approvals.
mnovak added 1 commit 2026-11-21 08:58:16 +01:00
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.
mnovak manually merged commit 6588461438 into main 2026-11-21 08:58:45 +01:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mnovak/CustosPublic#25