diff --git a/.github/workflows/hypatia-scan.yml b/.github/workflows/hypatia-scan.yml index 09592ae8..d959b2e3 100644 --- a/.github/workflows/hypatia-scan.yml +++ b/.github/workflows/hypatia-scan.yml @@ -17,10 +17,16 @@ on: schedule: - cron: '0 0 * * 0' workflow_dispatch: + inputs: + credential_read_check: + description: Only validate this repository's saved scanner credential + type: boolean + required: false + default: false # Estate guardrail: cancel superseded runs so re-pushes don't pile up. concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.credential_read_check && 'credential-check' || 'scan' }} cancel-in-progress: true permissions: @@ -30,7 +36,17 @@ permissions: pull-requests: write jobs: + scanner-credential: + if: ${{ github.event_name == 'workflow_dispatch' && inputs.credential_read_check }} + permissions: + contents: read + uses: hyperpolymath/hypatia/.github/workflows/credential-read-check.yml@b93f0615a61ee4c05af66eb526538eab47120aaa + with: + scanner_only: true + secrets: + HYPATIA_SCAN_PAT: ${{ secrets.HYPATIA_SCAN_PAT }} hypatia: + if: ${{ !(github.event_name == 'workflow_dispatch' && inputs.credential_read_check) }} uses: metadatastician/standards/.github/workflows/hypatia-scan-reusable.yml@75bd5994470661a099df562d6d5ad2fe744dbd66 # hypatia-scan-reusable declares one secret; pass that one, not everything. secrets: diff --git a/docs/SCANNER-CREDENTIAL-CHECK.adoc b/docs/SCANNER-CREDENTIAL-CHECK.adoc new file mode 100644 index 00000000..025b1fac --- /dev/null +++ b/docs/SCANNER-CREDENTIAL-CHECK.adoc @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: CC-BY-SA-4.0 += Check the saved scanner credential +:revdate: 2026-11-16 + +Run the manual `Hypatia Security Scan` workflow with +`credential_read_check` selected to validate this repository's +`HYPATIA_SCAN_PAT` secret. This mode skips the normal scanner and calls +Hypatia's pinned credential checker with only that secret. It has a separate +concurrency group, so a check does not cancel an ordinary scan of the same ref. +Push, pull-request, scheduled and default manual runs retain the normal scan. + +The checker authenticates, then reads at most one alert from each of +`hyperpolymath/hypatia`'s Dependabot, code-scanning and secret-scanning +endpoints. Hypatia is a fixed probe target with all three endpoints enabled. +The value comes from this caller's secret store. Passing proves this saved +value can authenticate and read those three endpoints; it does not prove +fleet's own endpoint availability, estate-wide coverage, absence of alerts +or write access. A failed or unavailable endpoint fails the check. + +The check does not check out source, execute scanners, publish findings or +send dispatches. API response bodies are suppressed; secret scanning also +requests `hide_secret=true`. The callee's dispatch job is skipped, and no +dispatch secret is passed. Never use `secrets: inherit` for this check. + +For the estate scanner, the intended fine-grained token grants Contents, +Dependabot alerts, Code scanning alerts and Secret scanning alerts read-only +under resource owner `hyperpolymath`; Metadata read is automatic. Selecting +all repositories covers that owner's repositories, not another owner's +security data. A token's display name does not update an Actions secret: +replacement values must be installed in each intended secret store. + +The caller is also recorded in `scripts/lib/pinned-reusable-sources.json`, +with Git blob `15c597ea720a5affb861dab058084f7245ee4cbd` and content SHA-256 +`645e8ac8ff118c33f2dc941ec46f1abac895f7836339736841c269e4b9dc084d` for the +pinned checker. Its direct dependency receipt is emitted from those source +bytes using `audit-lock-closure.sh --emit-receipt`. Fleet's source verifier +authenticates that source and its edge to harden-runner; the ordinary vendor +lock remains unchanged because this adds a remote job-level reusable call. + +Live validation on 16 November: run `43836851465` passed the scanner job +using fleet's saved credential. The normal scan and dispatch jobs were +skipped. This is the bounded credential-read receipt described above. diff --git a/scripts/lib/lock-closure-receipts.tsv b/scripts/lib/lock-closure-receipts.tsv index 61299ce2..5fad31ee 100644 --- a/scripts/lib/lock-closure-receipts.tsv +++ b/scripts/lib/lock-closure-receipts.tsv @@ -63,3 +63,6 @@ metadatastician/standards ea2f4d8a886585ed442687ae63d4ad7493379ba4 oven-sh/setup # Reviewed source: hyperpolymath/proven-cicd-and-workflows/.github/workflows/secret-scanner-reusable.yml@1fd5e6371a50f0fc3687206a5adca0cdf7b39aa6 hyperpolymath/proven-cicd-and-workflows 1fd5e6371a50f0fc3687206a5adca0cdf7b39aa6 actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 + +# Reviewed source: hyperpolymath/hypatia/.github/workflows/credential-read-check.yml@b93f0615a61ee4c05af66eb526538eab47120aaa +hyperpolymath/hypatia b93f0615a61ee4c05af66eb526538eab47120aaa step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a diff --git a/scripts/lib/pinned-reusable-sources.json b/scripts/lib/pinned-reusable-sources.json index 88a592a2..f42996c1 100644 --- a/scripts/lib/pinned-reusable-sources.json +++ b/scripts/lib/pinned-reusable-sources.json @@ -241,7 +241,7 @@ { "workflow": ".github/workflows/hypatia-scan.yml", "job": "hypatia", - "line": 34 + "line": 50 } ], "uses": [ @@ -725,6 +725,30 @@ } ], "source_url": "https://github.com/hyperpolymath/proven-cicd-and-workflows/blob/1fd5e6371a50f0fc3687206a5adca0cdf7b39aa6/.github/workflows/secret-scanner-reusable.yml" + }, + { + "repository": "hyperpolymath/hypatia", + "commit": "b93f0615a61ee4c05af66eb526538eab47120aaa", + "path": ".github/workflows/credential-read-check.yml", + "blob": "15c597ea720a5affb861dab058084f7245ee4cbd", + "content_sha256": "645e8ac8ff118c33f2dc941ec46f1abac895f7836339736841c269e4b9dc084d", + "role": "active", + "callers": [ + { + "workflow": ".github/workflows/hypatia-scan.yml", + "job": "scanner-credential" + } + ], + "uses": [ + { + "kind": "step", + "ref": "step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a" + }, + { + "kind": "step", + "ref": "step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a" + } + ] } ], "dependencies": { @@ -841,6 +865,12 @@ "uses": [ "actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1" ] + }, + "step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a": { + "ref": "v2.22.4", + "commit": "sha1-1d88384fd173af6ecb012dfd0264a306b711241a", + "owner_id": 88700172, + "repo_id": 422287306 } } }