From 5fa18d7171f2cc1ca91e10ad66045d06381f4faf Mon Sep 17 00:00:00 2001 From: Ronen Slavin Date: Mon, 26 Oct 2026 14:23:23 +0200 Subject: [PATCH 1/3] attest: add a kms input for KMS signing Pass a KMS key URI (HashiCorp Vault transit: vault://) to sign with a key held in Vault. The input is forwarded as --kms to both attest generate-and-sign and, when the sbom input is set, attest sbom. include-timestamp and timestamp-server-url are forwarded with it when include-timestamp is true (as with sign-key), and the signed provenance is uploaded as an artifact. Requires cimon v1.0.28 or later. Co-Authored-By: Claude Opus 5.5 --- attest/README.md | 40 ++++++++++++++++++++++++++++++++-------- attest/action.yml | 8 ++++++-- attest/index.js | 20 ++++++++++++++------ 3 files changed, 52 insertions(+), 16 deletions(-) diff --git a/attest/README.md b/attest/README.md index b97ed08..b69af65 100644 --- a/attest/README.md +++ b/attest/README.md @@ -58,8 +58,8 @@ to the provenance, by passing it through the `sbom` input: ``` Accepted SBOM formats: CycloneDX (JSON or XML) and SPDX 2.x (JSON, YAML or -tag-value). The SBOM is signed with the same `sign-key` / `keyless` -settings as the provenance. Verify it with: +tag-value). The SBOM is signed with the same `sign-key` / `kms` / +`keyless` settings as the provenance. Verify it with: ```bash cimon attest verify --client-id "$CIMON_CLIENT_ID" --secret "$CIMON_SECRET" \ @@ -92,18 +92,41 @@ If your environment cannot submit to the public Sigstore transparency log (e.g. customers in the USA / EU with data-residency requirements), use one of: -- **KMS signing**: `--kms vault://` (HashiCorp Vault transit). - The signature stays in your control. Vault transit is the only KMS - backend implemented today. +- **KMS signing**: `kms: vault://` (HashiCorp Vault transit). + The private key never leaves Vault; cimon sends the digest and receives + the signature. Vault transit is the only KMS backend implemented today, + and it requires cimon v1.0.28 or later. - **Keyed signing with checked-in private key**: `sign-key: private-key.pem`. - **Private Sigstore**: deploy your own Fulcio + Rekor and pass `fulcio-server-url` + `rekor-server-url`. See the inputs section below for the full list. +### KMS signing with HashiCorp Vault transit + +cimon reads the Vault connection from the standard Vault environment +variables (`VAULT_ADDR`, `VAULT_TOKEN`, and optionally `VAULT_NAMESPACE` +and `VAULT_CACERT`). The transit engine must be mounted at `transit/`, and +the key must support signing (for example `ecdsa-p256` or `rsa-3072`): + +```yaml +- uses: cycodelabs/cimon-action/attest@v1 + env: + VAULT_ADDR: https://vault.example.com:8200 + VAULT_TOKEN: ${{ secrets.VAULT_TOKEN }} + with: + subjects: dist\my-app.msi + kms: vault://cimon-signing + fail-on-error: true +``` + +Verifiers need the key's public half, which Vault returns from +`transit/keys/`: +`cimon attest verify --key public-key.pem --signed-prov provenance.intoto.jsonl.sig`. + ### Timestamping key-based signatures -A signature made with `sign-key` carries no time anchor unless you add an +A signature made with `sign-key` or `kms` carries no time anchor unless you add an RFC 3161 timestamp, which lets a verifier show it was made before the key was rotated or revoked. Request one explicitly; `timestamp-server-url` accepts a Sigstore timestamp authority or a standard RFC 3161 service: @@ -134,12 +157,13 @@ releases accept these inputs and produce no timestamp. | `source-path` | Path to the source checkout recorded in the attestation. Unset means automatic discovery (subject paths, run-id directory, workspace). Requires cimon v1.0.24 or later | — | | `skip-source-tree-check` | Skip verifying the source tree matches the recorded commit | `false` | | `sign-key` | Path to a private ECDSA/RSA/ED25519 PEM key | — | +| `kms` | KMS key URI for signing. HashiCorp Vault transit: `vault://`, configured through `VAULT_ADDR` and `VAULT_TOKEN`. Requires cimon v1.0.28 or later | — | | `keyless` | Use keyless (Sigstore) signing | `false` | | `tlog-upload` | **Keyless only.** Upload signature to Rekor transparency log | `true` | -| `include-timestamp` | Request an RFC 3161 timestamp and embed it in the signature. Applies to `keyless` and `sign-key` signing | `false` | +| `include-timestamp` | Request an RFC 3161 timestamp and embed it in the signature. Applies to `keyless`, `sign-key` and `kms` signing | `false` | | `fulcio-server-url` | **Keyless only.** Fulcio server URL | `https://fulcio.sigstore.dev` | | `rekor-server-url` | **Keyless only.** Rekor server URL | `https://rekor.sigstore.dev` | -| `timestamp-server-url` | RFC 3161 timestamp server URL: a Sigstore timestamp authority or a standard RFC 3161 service. With `sign-key`, forwarded only when `include-timestamp: true` | — | +| `timestamp-server-url` | RFC 3161 timestamp server URL: a Sigstore timestamp authority or a standard RFC 3161 service. With `sign-key` or `kms`, forwarded only when `include-timestamp: true` | — | | `allow-submit-data-to-public-sigstore` | **Keyless only.** Required when using public Sigstore | `false` | | `provenance-output` | Path for unsigned provenance | `provenance.intoto.jsonl` | | `signed-provenance-output` | Path for signed provenance | `provenance.intoto.jsonl.sig` | diff --git a/attest/action.yml b/attest/action.yml index 4c07389..141ea11 100644 --- a/attest/action.yml +++ b/attest/action.yml @@ -43,6 +43,10 @@ inputs: description: Input path to a private ECDSA/RSA/ED25519 key used to sign provenance statement required: false default: '' + kms: + description: 'KMS key used to sign the provenance statement (and the SBOM attestation when sbom is set), as a provider URI. HashiCorp Vault transit: vault://, with the Vault address and token in the VAULT_ADDR and VAULT_TOKEN environment variables. Requires cimon v1.0.28 or later.' + required: false + default: '' keyless: description: Allow keyless signature if no signing key is provided required: false @@ -52,7 +56,7 @@ inputs: required: false default: 'true' include-timestamp: - description: 'Request an RFC 3161 timestamp of the artifact signature from a timestamping authority. Applies to keyless and sign-key signing.' + description: 'Request an RFC 3161 timestamp of the artifact signature from a timestamping authority. Applies to keyless, sign-key and kms signing.' required: false default: 'false' fulcio-server-url: @@ -64,7 +68,7 @@ inputs: required: false default: 'https://rekor.sigstore.dev' timestamp-server-url: - description: 'RFC 3161 timestamp server URL: a Sigstore timestamp authority or a standard RFC 3161 service. With sign-key, forwarded only when include-timestamp is true.' + description: 'RFC 3161 timestamp server URL: a Sigstore timestamp authority or a standard RFC 3161 service. With sign-key or kms, forwarded only when include-timestamp is true.' required: false allow-submit-data-to-public-sigstore: description: 'Keyless signing only: agree to submit data to an immutable public transparency log (needed for public Sigstore). Ignored unless keyless is true.' diff --git a/attest/index.js b/attest/index.js index dc845e9..f1d2e29 100644 --- a/attest/index.js +++ b/attest/index.js @@ -131,6 +131,7 @@ function getActionConfig() { subjects: core.getInput('subjects'), imageRef: core.getInput('image-ref'), signKey: core.getInput('sign-key'), + kms: core.getInput('kms'), keyless: core.getBooleanInput('keyless'), tlogUpload: core.getBooleanInput('tlog-upload'), includeTimestamp: core.getBooleanInput('include-timestamp'), @@ -169,12 +170,19 @@ function backendArgs(config) { return args; } -// signingArgs returns the key / keyless / Sigstore / timestamp flags shared -// by `attest generate-and-sign` and `attest sbom`, so both attestations are -// signed the same way. +// keyBasedSigning reports whether the attestations are signed with a key file +// or a KMS key rather than keyless. +function keyBasedSigning(config) { + return config.attest.signKey !== '' || config.attest.kms !== ''; +} + +// signingArgs returns the key / KMS / keyless / Sigstore / timestamp flags +// shared by `attest generate-and-sign` and `attest sbom`, so both +// attestations are signed the same way. function signingArgs(config) { const args = []; if (config.attest.signKey !== '') args.push('--key', config.attest.signKey); + if (config.attest.kms !== '') args.push('--kms', config.attest.kms); if (config.attest.keyless) { args.push('--keyless'); @@ -195,8 +203,8 @@ function signingArgs(config) { `--timestamp-server-url=${config.attest.timestampServerUrl}` ); } - } else if (config.attest.signKey !== '' && config.attest.includeTimestamp) { - // Key-based signing only timestamps on an explicit request, so the + } else if (keyBasedSigning(config) && config.attest.includeTimestamp) { + // Key and KMS signing only timestamp on an explicit request, so the // inputs are forwarded only when include-timestamp is true. Older // cimon releases accept and ignore them. args.push('--include-timestamp=true'); @@ -320,7 +328,7 @@ async function run(config) { path.dirname(config.attest.provenanceOutput), { continueOnError: true } ); - if (config.attest.signKey !== '') { + if (keyBasedSigning(config)) { client.uploadArtifact( `signed-provenance-${jobId}-${randomSuffix}`, [config.attest.signedProvenanceOutput], From f9d114806cfb83a562aebfc1a23fc9549dde6afb Mon Sep 17 00:00:00 2001 From: Ronen Slavin Date: Mon, 26 Oct 2026 18:45:44 +0200 Subject: [PATCH 2/3] ci(attest): push the rebuilt dist to the PR branch, leased on the PR head The rebuild-dist job checks out the PR head SHA, a detached HEAD, so the bare `git push` in the auto-commit step failed with "You are not currently on a branch". Push to the PR branch by name instead, leased on the PR head SHA the run built from, so the push lands only while the branch is unchanged. The workflow also runs when its own file changes. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/build-attest-dist.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-attest-dist.yaml b/.github/workflows/build-attest-dist.yaml index da9b179..ac3a328 100644 --- a/.github/workflows/build-attest-dist.yaml +++ b/.github/workflows/build-attest-dist.yaml @@ -9,6 +9,7 @@ on: - 'attest/index.js' - 'attest/package.json' - 'attest/package-lock.json' + - '.github/workflows/build-attest-dist.yaml' workflow_dispatch: permissions: @@ -50,6 +51,8 @@ jobs: if: github.event_name == 'pull_request' env: PR_HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }} + PR_HEAD_REF: ${{ github.event.pull_request.head.ref }} + PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} BASE_REPO: ${{ github.repository }} run: | # SECURITY: only act if the rebuild produced exactly one @@ -88,4 +91,9 @@ jobs: git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git add attest/dist/index.js git commit -m "chore(attest): rebuild dist/index.js" - git push + # The checkout is the PR head SHA, a detached HEAD, so name the + # PR branch. The lease makes the push land only while the branch + # still points at the SHA this run built from; if it moved in any + # direction or was deleted, the push is rejected. + git push --force-with-lease="refs/heads/$PR_HEAD_REF:$PR_HEAD_SHA" \ + origin "HEAD:refs/heads/$PR_HEAD_REF" From 96495e7c522b339fa1e48b3b29626eb94d3d45f9 Mon Sep 17 00:00:00 2001 From: Ronen Slavin Date: Sat, 31 Oct 2026 19:41:26 +0200 Subject: [PATCH 3/3] chore(attest): rebuild dist/index.js Co-Authored-By: Claude Opus 5.5 --- attest/dist/index.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/attest/dist/index.js b/attest/dist/index.js index f6b1b0d..3216747 100644 --- a/attest/dist/index.js +++ b/attest/dist/index.js @@ -127691,6 +127691,7 @@ function getActionConfig() { subjects: _actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput('subjects'), imageRef: _actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput('image-ref'), signKey: _actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput('sign-key'), + kms: _actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput('kms'), keyless: _actions_core__WEBPACK_IMPORTED_MODULE_0__.getBooleanInput('keyless'), tlogUpload: _actions_core__WEBPACK_IMPORTED_MODULE_0__.getBooleanInput('tlog-upload'), includeTimestamp: _actions_core__WEBPACK_IMPORTED_MODULE_0__.getBooleanInput('include-timestamp'), @@ -127729,12 +127730,19 @@ function backendArgs(config) { return args; } -// signingArgs returns the key / keyless / Sigstore / timestamp flags shared -// by `attest generate-and-sign` and `attest sbom`, so both attestations are -// signed the same way. +// keyBasedSigning reports whether the attestations are signed with a key file +// or a KMS key rather than keyless. +function keyBasedSigning(config) { + return config.attest.signKey !== '' || config.attest.kms !== ''; +} + +// signingArgs returns the key / KMS / keyless / Sigstore / timestamp flags +// shared by `attest generate-and-sign` and `attest sbom`, so both +// attestations are signed the same way. function signingArgs(config) { const args = []; if (config.attest.signKey !== '') args.push('--key', config.attest.signKey); + if (config.attest.kms !== '') args.push('--kms', config.attest.kms); if (config.attest.keyless) { args.push('--keyless'); @@ -127755,8 +127763,8 @@ function signingArgs(config) { `--timestamp-server-url=${config.attest.timestampServerUrl}` ); } - } else if (config.attest.signKey !== '' && config.attest.includeTimestamp) { - // Key-based signing only timestamps on an explicit request, so the + } else if (keyBasedSigning(config) && config.attest.includeTimestamp) { + // Key and KMS signing only timestamp on an explicit request, so the // inputs are forwarded only when include-timestamp is true. Older // cimon releases accept and ignore them. args.push('--include-timestamp=true'); @@ -127880,7 +127888,7 @@ async function run(config) { path__WEBPACK_IMPORTED_MODULE_5__.dirname(config.attest.provenanceOutput), { continueOnError: true } ); - if (config.attest.signKey !== '') { + if (keyBasedSigning(config)) { client.uploadArtifact( `signed-provenance-${jobId}-${randomSuffix}`, [config.attest.signedProvenanceOutput],