-
-
Notifications
You must be signed in to change notification settings - Fork 0
fix(governance): split credentialed live policy audit #685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4a32937
2611295
541214b
28f7a2c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,7 @@ permissions: | |
|
|
||
| jobs: | ||
| preflight: | ||
| name: Actions policy (tree + live) | ||
| name: Actions policy (tree) | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| steps: | ||
|
|
@@ -29,7 +29,7 @@ jobs: | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| repository: hyperpolymath/standards | ||
| ref: main | ||
| ref: ${{ job.workflow_sha }} | ||
| path: .standards-checkout | ||
| sparse-checkout: | | ||
| rhodium-standard-repositories/actions-allowlist | ||
|
|
@@ -56,9 +56,56 @@ jobs: | |
| bash "$RUNNER_TEMP/check-allowed-actions.sh" \ | ||
| "$RUNNER_TEMP/allowed-actions.json" .github/workflows | ||
|
|
||
| live-policy: | ||
| name: Live Actions policy (credentialed advisory) | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| steps: | ||
| - name: Checkout policy source | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| repository: hyperpolymath/standards | ||
| ref: ${{ job.workflow_sha }} | ||
| path: .standards-checkout | ||
| sparse-checkout: | | ||
| rhodium-standard-repositories/actions-allowlist | ||
| scripts/check-actions-policy.sh | ||
| sparse-checkout-cone-mode: false | ||
|
|
||
| - name: Report unavailable live policy credential | ||
| env: | ||
| GH_TOKEN: ${{ secrets.HYPATIA_SCAN_PAT }} | ||
| if: ${{ env.GH_TOKEN == '' }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 MEDIUM RISK The 'if' condition is evaluated before the step-level 'env' block is applied. This means 'env.GH_TOKEN' will be empty at the time of check, and this notice will always be displayed. Reference the secret context directly: if: ${{ secrets.HYPATIA_SCAN_PAT == '' }} |
||
| run: | | ||
| echo "::notice::Live Actions policy was not evaluated: HYPATIA_SCAN_PAT was not supplied by the caller. The separate tree allowlist gate still ran." | ||
| # shellcheck disable=SC2016 | ||
| printf '%s\n' \ | ||
| '### Live Actions policy not evaluated' \ | ||
| '' \ | ||
| 'The caller did not supply `HYPATIA_SCAN_PAT`. This advisory job' \ | ||
| 'does not claim that the repository Administration setting passed.' \ | ||
| 'The independent tree allowlist preflight remains enforced.' \ | ||
| >> "$GITHUB_STEP_SUMMARY" | ||
|
|
||
| - name: Check live repository policy | ||
| env: | ||
| GH_TOKEN: ${{ secrets.HYPATIA_SCAN_PAT || github.token }} | ||
| GH_TOKEN: ${{ secrets.HYPATIA_SCAN_PAT }} | ||
| if: ${{ env.GH_TOKEN != '' }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 HIGH RISK The 'if' condition is evaluated before the step-level 'env' block is applied. This means 'env.GH_TOKEN' will be empty, and this security check will always be skipped. Use the secret context directly to ensure the policy check runs when intended: if: ${{ secrets.HYPATIA_SCAN_PAT != '' }} |
||
| run: | | ||
| bash "$RUNNER_TEMP/check-actions-policy.sh" \ | ||
| "$GITHUB_REPOSITORY" "$RUNNER_TEMP/allowed-actions.json" | ||
| set +e | ||
| bash .standards-checkout/scripts/check-actions-policy.sh \ | ||
| "$GITHUB_REPOSITORY" \ | ||
| .standards-checkout/rhodium-standard-repositories/actions-allowlist/allowed-actions.json | ||
| rc=$? | ||
| set -e | ||
| if [ "$rc" -eq 3 ]; then | ||
| echo "::notice::Live Actions policy was not evaluated: the supplied credential could not read the Administration endpoint." | ||
| printf '%s\n' \ | ||
| '### Live Actions policy not evaluated' \ | ||
| '' \ | ||
| 'A credential was supplied, but the Administration API was unavailable.' \ | ||
| 'No live-policy pass is claimed; rotate or re-authorise the credential.' \ | ||
| >> "$GITHUB_STEP_SUMMARY" | ||
| exit 0 | ||
| fi | ||
| exit "$rc" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,14 +40,18 @@ jobs: | |
| echo "has_baseline=false" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Clone standards repository | ||
| run: | | ||
| # Treeless partial clone: full commit graph (needed by the staleness | ||
| # gate's ancestry / commits-behind / age math) without paying for | ||
| # every tree+blob in history. Falls back to a deep clone if the | ||
| # server rejects the partial-clone filter. | ||
| git clone --filter=tree:0 https://github.com/hyperpolymath/standards.git "$HOME/standards" \ | ||
| || git clone --depth 200 https://github.com/hyperpolymath/standards.git "$HOME/standards" | ||
| - name: Checkout pinned standards history | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| repository: hyperpolymath/standards | ||
| # The gate needs the full graph for ancestry and age checks, but its | ||
| # script must come from the exact reusable commit rather than moving | ||
| # main. This also lets a Standards PR test its own validator change. | ||
| ref: ${{ job.workflow_sha }} | ||
| path: .standards-history | ||
| fetch-depth: 0 | ||
| filter: tree:0 | ||
| persist-credentials: false | ||
|
|
||
| - name: Run staleness check | ||
| env: | ||
|
|
@@ -60,8 +64,9 @@ jobs: | |
| # past this commit: the script comes from standards HEAD, but the job | ||
| # definition comes from whatever SHA the consumer pins. | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| STALENESS_STANDARDS_DIR: ${{ github.workspace }}/.standards-history | ||
| run: | | ||
| bash "$HOME/standards/scripts/check-workflow-staleness.sh" . | ||
| bash .standards-history/scripts/check-workflow-staleness.sh . | ||
|
|
||
| allowlist-preflight: | ||
| name: Allowlist Preflight | ||
|
|
@@ -80,7 +85,9 @@ jobs: | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| repository: hyperpolymath/standards | ||
| ref: main | ||
| # Exact commit of this reusable workflow. This preserves consumer | ||
| # pin semantics and lets a standards PR test its own scripts. | ||
| ref: ${{ job.workflow_sha }} | ||
| path: .standards-checkout | ||
| sparse-checkout: | | ||
| rhodium-standard-repositories/actions-allowlist | ||
|
|
@@ -103,17 +110,66 @@ jobs: | |
| fi | ||
| bash "$RUNNER_TEMP/check-allowed-actions.sh" \ | ||
| "$RUNNER_TEMP/allowed-actions.json" .github/workflows | ||
| rm -rf .standards-checkout | ||
|
|
||
| actions-policy-live: | ||
| name: Live Actions policy (credentialed advisory) | ||
| runs-on: ${{ inputs.runs-on }} | ||
| timeout-minutes: 5 | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout standards for the live policy gate | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| repository: hyperpolymath/standards | ||
| ref: ${{ job.workflow_sha }} | ||
| path: .standards-checkout | ||
| sparse-checkout: | | ||
| rhodium-standard-repositories/actions-allowlist | ||
| scripts/check-actions-policy.sh | ||
| sparse-checkout-cone-mode: false | ||
|
|
||
| - name: Report unavailable live policy credential | ||
| env: | ||
| GH_TOKEN: ${{ secrets.HYPATIA_SCAN_PAT }} | ||
| if: ${{ env.GH_TOKEN == '' }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 MEDIUM RISK The 'if' condition is evaluated before the step-level 'env' block is applied. This means 'env.GH_TOKEN' will be empty, and this notice will always be displayed regardless of secret availability. Use |
||
| run: | | ||
| echo "::notice::Live Actions policy was not evaluated: HYPATIA_SCAN_PAT was not supplied by the caller. The separate tree allowlist gate still ran." | ||
| # shellcheck disable=SC2016 | ||
| printf '%s\n' \ | ||
| '### Live Actions policy not evaluated' \ | ||
| '' \ | ||
| 'The caller did not supply `HYPATIA_SCAN_PAT`. This advisory job' \ | ||
| 'does not claim that the repository Administration setting passed.' \ | ||
| 'The independent tree allowlist preflight remains enforced.' \ | ||
| >> "$GITHUB_STEP_SUMMARY" | ||
|
|
||
| - name: Check live Actions policy | ||
| env: | ||
| # GitHub's job token cannot read this Administration endpoint. Keep | ||
| # this dependency explicit: missing/expired credentials must make the | ||
| # live control red rather than silently reducing it to a tree check. | ||
| # The ordinary job token cannot read the repository Administration | ||
| # endpoint. When a caller deliberately supplies this credential, an | ||
| # API/authentication failure or real policy violation remains red. | ||
| GH_TOKEN: ${{ secrets.HYPATIA_SCAN_PAT }} | ||
| if: ${{ env.GH_TOKEN != '' }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 HIGH RISK The 'if' condition is evaluated before the step-level 'env' block is applied. This causes the security gate to be skipped even when the required secret is provided. Reference the secret directly in the condition. |
||
| run: | | ||
| rm -rf .standards-checkout | ||
| bash "$RUNNER_TEMP/check-actions-policy.sh" \ | ||
| "$GITHUB_REPOSITORY" "$RUNNER_TEMP/allowed-actions.json" | ||
| set +e | ||
| bash .standards-checkout/scripts/check-actions-policy.sh \ | ||
| "$GITHUB_REPOSITORY" \ | ||
| .standards-checkout/rhodium-standard-repositories/actions-allowlist/allowed-actions.json | ||
| rc=$? | ||
| set -e | ||
| if [ "$rc" -eq 3 ]; then | ||
| echo "::notice::Live Actions policy was not evaluated: the supplied credential could not read the Administration endpoint." | ||
| printf '%s\n' \ | ||
| '### Live Actions policy not evaluated' \ | ||
| '' \ | ||
| 'A credential was supplied, but the Administration API was unavailable.' \ | ||
| 'No live-policy pass is claimed; rotate or re-authorise the credential.' \ | ||
| >> "$GITHUB_STEP_SUMMARY" | ||
| exit 0 | ||
| fi | ||
| exit "$rc" | ||
|
|
||
| validate-hypatia-baseline: | ||
| name: Validate Hypatia Baseline | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 HIGH RISK
Renaming the job from
Actions policy (tree + live)toActions policy (tree)is a breaking change. Any repository using this reusable workflow with the old name specified as a 'Required' status check in branch protection will have its merges blocked.