REFERENCE

Publishing your own apps from CI

Your build pipeline produces a Windows installer, and you want each release tested and rolled out by Attestree without storing a secret in CI.

UPDATED

Your own apps can reach Attestree from the pipeline that builds them. The job signs in with the short-lived OIDC token its CI system issues for the run, so no secret is stored in GitHub Actions or Azure Pipelines, and your instance accepts the token only from the pipeline you bound. The version then waits for review when it needs one, and for the update pipeline, which takes it once your update grant covers the app. With a detonation host attached, it is then detonated and attested like any other version. Your own apps covers claiming the package-id prefix, the review and delivery to endpoints; this page covers the pipeline side.

The tools are public, under the Apache-2.0 licence, at github.com/attestree/publish:

  • The GitHub Action, attestree/publish@v1.
  • The Azure Pipelines task, Attestree publish (AttestreePublish@1), on the Visual Studio Marketplace.
  • The attestree-publish command-line tool that both run, for Windows x64, Linux x64, Linux arm64 and macOS arm64, from that repository’s cli-v{version} releases. The Action and the task check its SHA-256 against the hashes they carry before they run it.

Bind the pipeline

A binding sits on a prefix you have claimed. In the Manifest sources section of Settings › Catalog policy on Community Edition, or /admin/settings/manifest-sources on a dedicated instance, choose Bind a pipeline… (in the console since platform 26.11.100). It takes the catalog.sources.manage permission, and saving takes a typed confirmation and a reason.

  • Which CI system: GitHub (github.com), GitHub Enterprise Server or Azure DevOps. A repository on github.com, Enterprise Cloud included, takes a GitHub binding.
  • What it may publish: one package id, or every id under the prefix. For a narrower prefix, claim it as a prefix of its own and bind the pipeline there.
  • Changing a pin is a new binding. Changing the repository, its ids, the workflow, the branch or tag, or the Azure DevOps subject replaces the binding. Versions the old binding published that are not attested yet stop, and read binding-removed.

What each binding checks

Every token must be signed with RS256 by a key its issuer publishes, and must carry an expiry; 60 seconds of clock skew are allowed. A token from an issuer no binding names is refused without a request to that issuer.

GitHub and GitHub Enterprise Server

Claim Must be
issuer (iss) https://token.actions.githubusercontent.com, or for Enterprise Server https://{host}/_services/token
audience (aud) attestree:{instance-id}. The instance id is random, made once on the instance’s first start, and the binding screen shows the whole audience
repository_id, repository_owner_id The numbers you bound. gh api repos/{owner}/{repo} --jq '.id, .owner.id' prints both
job_workflow_ref (or workflow_ref) The workflow file you bound, {owner}/{repo}/.github/workflows/{file}.yml, compared without its @ref
ref Exactly the branch you bound, such as refs/heads/main; or a tag under the prefix you bound, such as refs/tags/v, with ref_protected "true"
event_name Anything but pull_request, pull_request_target or dynamic

The job needs permissions: id-token: write. Anyone who can push to the bound branch can publish what the binding allows, so branch protection there is what limits who can publish. A tag pin is only as strong as your tag protection rules. An Enterprise Server binding pins a branch, never a tag: Enterprise Server does not say whether a tag is protected. It is checked against the claims GitHub documents for Enterprise Server, and has not yet been tried against a real one.

Azure DevOps

The binding pins an issuer and a subject, copied from the service connection’s Workload Identity federation details:

Issuer Audience Subject
https://login.microsoftonline.com/{tenant-id}/v2.0 fb60f99c-7a34-4190-8149-302f77469936 /eid1/c/pub/t/…
https://vstoken.dev.azure.com/{organization-id}, accepted until Azure DevOps retires it on 2027-07-01 api://AzureADTokenExchange sc://{organization}/{project}/{connection}

The audience is fixed by Microsoft and never names your instance, so the issuer and subject are what tie a token to your binding. The token names no project and no branch:

  • To limit publishing to a branch, add a Branch control check on the service connection in Azure DevOps. Attestree cannot see the branch.
  • Use the connection only for Attestree, with no Azure role assignments. Microsoft Entra ID accepts the same token for any app that trusts the connection, so a connection that can also deploy to Azure lets an Attestree publish token do that too.

One token, one publish. A token the instance accepts is tied to the id and version it first published. The same token is refused for any other version, and accepted again for the same one, so a retried step works.

Sample workflows

Since 26.11.1500 a publish also takes the inputs silent, silent-with-progress and custom-switches, and since 26.11.1600 sbom. The review shows “Published by” and “Run” rows with the run’s commit.

These come from the attestree/publish README and its Azure Pipelines README, which list every input.

GitHub Actions, publishing to your instance:

permissions:
  id-token: write
  contents: read

steps:
  - uses: attestree/publish@v1
    with:
      instance: https://attestree.example.com
      audience: attestree:{instance-id}
      package-id: Contoso.Tool
      version: 1.2.0
      installers: |
        x64=dist/tool-x64.msi
        arm64=dist/tool-arm64.msi
      wait: true

Azure Pipelines, with a workload-identity federation service connection:

- task: AttestreePublish@1
  inputs:
    serviceConnection: attestree-publish
    instance: https://attestree.example.com
    packageId: Contoso.Tool
    version: $(Build.BuildNumber)
    installers: |
      x64=$(Build.ArtifactStagingDirectory)/tool-x64.msi
      arm64=$(Build.ArtifactStagingDirectory)/tool-arm64.msi
    wait: true

GitHub Actions, for an instance with no inbound route. The job commits the version’s manifests to a GitHub repository of yours and attaches each installer to a release there, with the job’s own token. Nothing is sent to the instance, which reads that repository as the prefix’s repository source, so this needs a source on the prefix instead of a binding:

permissions:
  contents: write

steps:
  - uses: attestree/publish@v1
    with:
      to-repository: contoso/winget
      package-id: Contoso.Tool
      version: 1.2.0
      installers: |
        x64=dist/tool-x64.msi
      publisher: Contoso
      installer-type: msi

One installer per architecture. A manifest input can point at a winget manifest whose installer type, scope and switches the version uses; the instance takes those fields only, and its answer lists every other field it ignored. Pin the Action to a full version, such as attestree/publish@v1.0.0, or to a commit, to fix exactly which build runs.

Reaching your instance

The runner must reach the instance over HTTPS. On Community Edition, a bound pipeline publishes through the console’s own address. The public listener that off-network endpoints use can also take the publish route, from the Manifest sources section, but that is off by default, and the console is never on that listener. If no runner can reach the instance, publish into your own repository instead, as above.

The publish API

The tools wrap five routes. Four are authenticated by the pipeline’s token alone, and the capability read takes no token:

  • POST /api/v1/publish/{packageId}/{version} names every installer by architecture and SHA-256, and may carry the manifest. The answer gives an upload slot for each installer. Since platform 26.10.3000 an installer can instead be named by an https URL, which the instance fetches under the network rules of the binding’s prefix.
  • PUT /api/v1/publish/{packageId}/{version}/installers/{architecture} streams one installer into its slot, with the slot’s single-use upload token in the X-Wep-Upload-Token header.
  • GET /api/v1/publish/{packageId}/{version} reads the version’s status.
  • PUT /api/v1/publish/{packageId}/{version}/sbom streams the build’s SBOM into the slot its publish declared, with the same X-Wep-Upload-Token header. Since platform 26.11.1600.
  • GET /api/v1/publish/capabilities answers what the instance takes ({"takes":["switches","sbom"]}), so the tools can tell an older instance apart. Since platform 26.11.1500.

A token that proves nothing, because it is expired, badly signed or from an unbound issuer, gets 401. A verified token the binding does not allow, such as one from another branch or a pull request, gets 403. Each refusal carries a reason, and a token missing a claim a pin needs is refused naming that claim. Only refusals of verified tokens are written to the audit log, naming the pipeline and its run. Too many requests from one address get 429.

Publish status

Status What it means wait ends with exit code
received Recorded; nothing has run yet, and installers may still be arriving keeps waiting
waiting-for-review An admin must confirm its install fields first keeps waiting
waiting-for-admission Approved; waits for the update pipeline to take it keeps waiting
detonating Queued for the sandbox, or running there keeps waiting
attested Attested 0
refused Refused at review, by its sandbox run or by the vulnerability gate; the reason says which 2
superseded A newer version of the app goes through the update pipeline instead 10
not-admitted The update pipeline will not take it until an admin acts: the app’s subscription, the update grant or its firing switch is missing, and the reason names the first one 11
binding-removed The binding that published it was removed or re-pinned before it was attested 12
halted Its update flight is halted or stalled, and waits on an operator; see update halts 14

Since 26.11.502 approving an app’s first version also subscribes the app, so a new pipeline app no longer stops at not-admitted for want of a subscription. Later versions never subscribe it again, and since 26.11.700 a push spelled in another letter case is not taken for a first version. A status read for a version the instance has no record of answers 404. Without wait, a step exits 0 as soon as the publish is accepted. With wait, the default timeout is 60 minutes, and a wait that ends without a final state exits 15. The tools also define 13, source removed, which no status of the instance produces.

409 and other refusals

Publishing the same id and version again with the same installers and manifest is accepted, and answers the version’s current status, so a step can be re-run. Anything else under an existing id and version is refused:

Refusal Status Why
manifest-differs 409 The version was published with another manifest, with one where the first publish had none, or with none where it had one. A changed manifest is a new version
installer-set-differs 409 The version was published with other installers. A changed build is a new version
version-exists 409 The version arrived another way: an upload, a repository source or another binding. Since 26.11.502 a version the catalog already holds, in any letter case, is refused too, and the message names the existing row
removed-from-catalog 409 The version was removed from the catalog. Its record stays, so the same id and version never come back
request-switches-differ 409 A repeat names other install switches in its request than the version was published with. Changed switches are a new version
sbom-differs 409 A repeat declares another SBOM, one where the first push had none, or none where it had one. A changed SBOM is a new version
upload-in-flight 409 Another upload into the same slot is running; retry once it ends
publish-not-receiving 409 The version no longer waits for that installer: it expired, or the installer’s bytes already arrived
manifest-fields-disagree 400 The manifest’s installers declare different types, scopes or switches. A version holds one set of install fields
request-and-manifest-switches 400 The push names install switches in its request and its manifest sets switches too. A version holds one set: name them in one place
request-switches-disagree 400 The request’s installers name different install switches. Every installer that names switches names the same ones
sbom-refused 400 The SBOM could not be read or is over the size limit, so the version is refused with it. The same build can be pushed again with a valid SBOM or none
manifest-package-name-refused 400 The manifest’s PackageName is over 512 characters, or carries a control, line-break or bidirectional formatting character

The first six end the tools with exit code 3. Exit code 1 means the inputs, a file or the manifest could not be used and nothing was sent, 2 a refusal, and 4 a fault that may pass on a retry, such as the network or a rate limit.

Where this stops

  • OIDC only. A pipeline cannot sign in with a stored secret, and the tools mint a token only on GitHub Actions and Azure Pipelines. Another CI system can still publish into your own GitHub repository with the command-line tool’s repository mode, given a GitHub token in GITHUB_TOKEN that can write to it.
  • GitHub Enterprise Server is checked on paper. Its binding follows the token shape GitHub documents, has not been tried against a real Enterprise Server, and pins a branch only.
  • No branch pin on Azure DevOps. Use a Branch control check on the service connection.
  • The instance must be reachable for a direct publish. On Community Edition the public listener does not take publishes until you turn that on.
  • A publish is not a rollout. The version still waits for review when it needs one, then for the update pipeline, which takes it only once your update grant covers the app. Without a detonation host nothing is attested.