Skip to content

appitool attestation ​

Verifies build provenance attestations and manages the keys that sign them: the private key that flow --attest --attest-key signs with, and the public key that attestation verify --key checks against.

Synopsis ​

bash
appitool attestation verify -f <file> [options]
appitool attestation keys create [options]

appitool attestation verify ​

Verifies any file's GitHub artifact attestation with sigstore-swift. --repo, --signer-workflow, and --predicate-type set which repository, signing workflow, and predicate type the attestation must come from. Their defaults match appitool's own release attestations, so with no options the command checks an appitool release archive (e.g. appitool-darwin-arm64.tar.gz) the same way self-update does before installing.

Unlike self-update, attestation verify does not cross-check with the GitHub CLI. To cross-check, run gh attestation verify yourself (see Examples).

How It Works ​

  1. Computes the file's SHA256 digest.
  2. Fetches the attestation bundles for that digest from the repository's public attestations API (/repos/<repo>/attestations/sha256:<digest>; no gh auth login required for public repositories), or reads them from --bundle.
  3. At least one bundle must verify against Sigstore's trusted root, fetched over TUF (public-good, or GitHub's instance with the TUF root embedded in appitool). TUF metadata is cached in ~/.sigstore/root for one day. The bundle must:
    • be an in-toto statement for the file's digest with the --predicate-type predicate (default SLSA provenance v1, https://slsa.dev/provenance/v1);
    • be signed in GitHub Actions (issuer https://token.actions.githubusercontent.com) by the --signer-workflow workflow (certificate SAN https://github.com/<signer-workflow>@…; default <repo>/.github/workflows/release.yml);
    • come from --repo (certificate source repository https://github.com/<repo> and owner https://github.com/<owner>).
  4. With --build-type, --bundle-id, --package-name, or --distribution, the verified SLSA provenance must also say what was built (see Checking what was built).

The command exits with a non-zero status when the file has no attestation, no attestation verifies, or a TUF repository is unreachable.

NOTE

Only files the signing workflow attested verify. appitool's release workflow attests the appitool-*.tar.gz archives only, so checksums.txt, install.sh, and the extracted binary do not.

TIP

If you hit GitHub API rate limits, or the repository is private, export GITHUB_TOKEN (or GH_TOKEN) or configure GITHUB_TOKEN in .env.

Options ​

OptionDefaultDescription
-f, --file <path>RequiredPath to the file to verify.
--bundle <path>—Sigstore bundle file (one JSON document or JSON Lines) to verify instead of fetching the file's attestations from GitHub, e.g. from gh attestation download.
--repo <owner/name>appibara-ltd/appitoolRepository the file must have been built from; attestations are fetched from it.
--signer-workflow <workflow><repo>/.github/workflows/release.ymlWorkflow that must have signed the attestation, as owner/repo/.github/workflows/<file>.yml (a github.com/ or https://github.com/ prefix and an @ref suffix are accepted and ignored).
--predicate-type <uri>https://slsa.dev/provenance/v1In-toto predicate type the attestation must have.
--build-type <uri>—Build type (buildDefinition.buildType) the SLSA provenance must have. Implied by --bundle-id and --package-name.
-b, --bundle-id <id>—Bundle ID the provenance must name; implies the appitool iOS build type.
--package-name <name>—Package name the provenance must name; implies the appitool Android build type.
-d, --distribution <method>—Distribution the provenance must name: adhoc, development, or appstore. Needs an appitool build type.
--key <key>—ECDSA P-256 public key (file path, Base64, or inline PEM as --key=<pem>) the attestation must be signed with, as made by flow --attest --attest-key. Needs --bundle; --repo and --signer-workflow are not checked. See Key-signed attestations.

Key-signed attestations ​

appitool flow --attest --attest-key signs with a private key instead of a GitHub Actions certificate. Verify those with --key and the matching public key: the bundle must be signed by that key, carry an RFC 3161 timestamp that verifies against Sigstore's public trusted root, and be an attestation for the file's sha256 with the --predicate-type predicate. These attestations are not stored on GitHub, so --bundle is required, and there is no workflow certificate, so --repo and --signer-workflow do not apply. The provenance options below work the same way.

Checking what was built ​

The provenance options check the contents of the SLSA provenance, after its signature and signer have verified:

  • buildDefinition.buildType must equal --build-type. -b, --bundle-id implies the appitool iOS build type (https://appitool.appibara.com/buildtypes/ios/v1) and --package-name the Android one (https://appitool.appibara.com/buildtypes/android/v1).
  • buildDefinition.externalParameters must name the given bundleId / packageName and distribution, as strings.
  • For appitool's build types, external parameters their spec does not define are rejected.

--bundle-id and --package-name cannot be combined, a --build-type must match the one they imply, --distribution needs an appitool build type, and these options require the SLSA provenance predicate type. The build types are specified in appitool iOS build type, v1 and appitool Android build type, v1.

Examples ​

bash
# Verify a downloaded appitool release archive
appitool attestation verify -f ~/Downloads/appitool-darwin-arm64.tar.gz

# Verify against a bundle file saved with `gh attestation download`
appitool attestation verify -f appitool-linux-x86_64.tar.gz --bundle sha256:<digest>.jsonl

# Verify another project's artifact, signed by its build workflow
appitool attestation verify -f tool.zip --repo octo-org/octo-tool --signer-workflow octo-org/octo-tool/.github/workflows/build.yml

# Verify that an IPA was built by appitool for com.acme.myapp, for the App Store, by acme/myapp's CI
appitool attestation verify -f MyApp.ipa --bundle MyApp.ipa.sigstore.json --repo acme/myapp \
  --signer-workflow acme/myapp/.github/workflows/release.yml -b com.acme.myapp -d appstore

# Verify a key-signed attestation (flow --attest --attest-key)
appitool attestation verify -f MyApp.ipa --bundle MyApp.ipa.sigstore.json --key attest-key.pub.pem -b com.acme.myapp -d adhoc

# Check any other build type
appitool attestation verify -f tool.zip --repo octo-org/octo-tool --build-type https://actions.github.io/buildtypes/workflow/v1

# Cross-check an appitool release archive with the GitHub CLI
gh attestation verify appitool-darwin-arm64.tar.gz --repo appibara-ltd/appitool --signer-workflow appibara-ltd/appitool/.github/workflows/release.yml

appitool attestation keys create ​

Creates an ECDSA P-256 key pair with swift-crypto (no OpenSSL needed):

  • <name>.pem: the private key (PKCS #8 PEM), written with mode 600 so only you can read it. Keep it secret: store it as a CI secret such as APPITOOL_ATTEST_KEY and never commit it.
  • <name>.pub.pem: the public key, which you share with whoever verifies your attestations.

The command also prints the public key and its hint, the value bundles signed with this key carry in verificationMaterial.publicKey.hint. It never uploads the key anywhere.

Options ​

OptionDefaultDescription
-o, --output <dir>.Directory to write the key files to (created if missing).
-n, --name <name>attest-keyBase name of the key files: <name>.pem and <name>.pub.pem.
--forcefalseOverwrite existing key files. Without it, the command fails if either file exists.

Examples ​

bash
# Create attest-key.pem and attest-key.pub.pem in ./keys
appitool attestation keys create -o ./keys

# Store the private key as a GitHub Actions secret, then delete the local copy
gh secret set APPITOOL_ATTEST_KEY < ./keys/attest-key.pem
rm ./keys/attest-key.pem

# Verify an attestation signed with it
appitool attestation verify -f MyApp.ipa --bundle MyApp.ipa.sigstore.json --key ./keys/attest-key.pub.pem -b com.acme.myapp -d adhoc

Released under the MIT License.