Skip to content

fix(governance): split credentialed live policy audit - #685

Closed
hyperpolymath wants to merge 4 commits into
mainfrom
fix/split-live-actions-policy
Closed

fix(governance): split credentialed live policy audit#685
hyperpolymath wants to merge 4 commits into
mainfrom
fix/split-live-actions-policy

Conversation

@hyperpolymath

@hyperpolymath hyperpolymath commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • keep the workflow-tree allowlist as the existing enforceable preflight
  • move the repository Administration API check into a separate credentialed advisory job
  • report explicitly when HYPATIA_SCAN_PAT was not supplied, without claiming the live policy passed
  • retain fail-closed behaviour when a caller does supply the credential
  • apply the same separation to both reusable policy entry points
  • check out policy tools from the exact commit defining the reusable workflow,
    preserving consumer pin semantics and allowing Standards PRs to test their
    own fixes
  • keep direct consumer-owned Scorecard SARIF publishers retired while allowing
    the canonical Standards reusable to publish centrally managed results

Why

The census in #656 established that 331 of 332 governance callers cannot pass the combined check: the ordinary job token cannot read the Administration endpoint, while the PAT was neither distributed nor inherited. A permanently red advisory gives no useful policy signal.

This implements option C from #656. It does not silently equate a tree check with a live settings audit. The two capabilities now have distinct contexts and conclusions.

Verification

  • bash scripts/tests/actions-policy-486-test.sh — 12/12 positive and negative cases pass, including an API/authentication-unavailable control
  • bash scripts/tests/check-workflow-staleness-test.sh — 20/20 positive and negative cases pass, including consumer direct-SARIF rejection and canonical-publisher acceptance
  • actionlint -ignore 'SC2086' -ignore 'property "workflow_sha" is not defined' .github/workflows/governance-reusable.yml .github/workflows/allowlist-preflight-reusable.yml — pass; the second suppression is limited to the current actionlint schema lag for GitHub's documented job.workflow_sha context
  • git diff --check — pass
  • gh actions-lock --no-fix still reaches the pre-existing unsupported local-action error in signed-push-smoke.yml; this change adds no new action identity or ref

Closes #656

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 8 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 94f49132-6b28-4fbc-bf10-86a438510672

📥 Commits

Reviewing files that changed from the base of the PR and between f192f08 and 28f7a2c.

📒 Files selected for processing (6)
  • .github/workflows/allowlist-preflight-reusable.yml
  • .github/workflows/governance-reusable.yml
  • scripts/check-actions-policy.sh
  • scripts/check-workflow-staleness.sh
  • scripts/tests/actions-policy-486-test.sh
  • scripts/tests/check-workflow-staleness-test.sh

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gitar-bot

gitar-bot Bot commented Aug 29, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

While this PR successfully decouples the tree-based and live governance audits, it introduces several critical issues that should prevent merging. Most significantly, renaming the primary governance job is a breaking change that will block merges across all repositories using these reusable workflows due to branch protection requirements.

Additionally, there are fundamental logic errors in how the 'live' policy check is gated; using environment variables within 'if' conditions before they are initialized ensures that the security check is always skipped and the advisory notice is always shown. There is also a violation of the bootstrap logic, meaning changes to the auditing scripts cannot be verified within this repository's own Pull Requests. Finally, several redundant steps were left in the 'preflight' jobs that fetch scripts no longer used in those contexts.

About this PR

  • The PR leaves behind redundant logic in the 'preflight' jobs. Sparse-checkout, staging, and copy operations for 'scripts/check-actions-policy.sh' are still present even though that script is now handled exclusively by the new 'actions-policy-live' jobs. These should be removed to reduce maintenance surface and improve performance.

Test suggestions

  • The tree-based allowlist (preflight) job continues to block execution on policy violations.
  • The live policy job reports an advisory notice and succeeds when the HYPATIA_SCAN_PAT secret is missing.
  • The live policy job executes the administration API check when the HYPATIA_SCAN_PAT secret is provided.
  • The live policy job fails when the PAT is provided but the repository configuration is non-compliant.
  • The standards repository tests local changes to the audit scripts in its own CI workflows (bootstrap logic).
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. The standards repository tests local changes to the audit scripts in its own CI workflows (bootstrap logic).

TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback

# 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 != '' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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.

env:
GH_TOKEN: ${{ secrets.HYPATIA_SCAN_PAT || github.token }}
GH_TOKEN: ${{ secrets.HYPATIA_SCAN_PAT }}
if: ${{ env.GH_TOKEN != '' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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 != '' }}

jobs:
preflight:
name: Actions policy (tree + live)
name: Actions policy (tree)

Copy link
Copy Markdown

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) to Actions 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.

uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: hyperpolymath/standards
ref: main

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM RISK

The actions-policy-live job ignores the 'Bootstrap rule' by hardcoding ref: main. This prevents testing changes to check-actions-policy.sh within the standards repository's own PRs.

- name: Report unavailable live policy credential
env:
GH_TOKEN: ${{ secrets.HYPATIA_SCAN_PAT }}
if: ${{ env.GH_TOKEN == '' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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 secrets.HYPATIA_SCAN_PAT directly.

uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: hyperpolymath/standards
ref: main

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM RISK

This checkout hardcodes ref: main, which violates the 'Bootstrap rule' where the standards repository should test its own local scripts during PRs. When the repository is hyperpolymath/standards, it should use the current SHA to ensure changes to check-actions-policy.sh are verified before merging.

- name: Report unavailable live policy credential
env:
GH_TOKEN: ${{ secrets.HYPATIA_SCAN_PAT }}
if: ${{ env.GH_TOKEN == '' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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 == '' }}

@hyperpolymath
hyperpolymath force-pushed the fix/split-live-actions-policy branch from 6b67ada to 541214b Compare August 29, 2026 01:52
@sonarqubecloud

Copy link
Copy Markdown

hyperpolymath added a commit that referenced this pull request Aug 29, 2026
…688)

## Summary

- removes the four high-severity Hypatia findings without weakening the
scanner
- records the remaining 61 reviewed medium findings as exact-file,
severity-preserving baseline entries tracked by #687
- makes the baseline schema and executable validator support Hypatia
rule IDs such as `HYP-S009`
- separates credentialed live Actions-policy auditing from the
deterministic pull-request gate, with explicit degraded-mode reporting
- validates pinned workflow-staleness sources and adds regression tests
for both policy paths
- patches the Dependabot-reported `gix-packetline` denial of service and
the additional audited `h2` denial of service in the certifier lockfile
- adds optional, exact-version Zig installation to the reusable Rust
workflow so native Zig-backed crates can use the central CI without ad
hoc setup
- refreshes only the derived registry hashes affected by these source
changes

## Verification

- exact Zig 0.15.2: `zig build test`
- baseline tests: 8/8 passed
- Actions-policy regression tests: 12/12 passed
- workflow-staleness tests: 20/20 passed
- authoritative strict Hypatia baseline gate: 0 kept, 61 suppressed
- baseline ratchet with the actual base: 104 to 129 entries accepted
only through the declared, issue-linked exception
- `cargo audit --no-fetch`: 0 vulnerabilities after the two lockfile
updates
- `gh actions-lock --no-fix`: clean across 44 workflows
- `actionlint .github/workflows/rust-ci-reusable.yml`: clean
- registry/topology check: clean

## Boundaries and follow-up

- no broad path exclusion or severity downgrade is introduced
- four warning-class dependency advisories remain (two unsoundness
warnings and two yanked crates); this PR does not misrepresent them as
resolved vulnerabilities
- the incomplete `rsr-certifier` workspace is tracked separately in #689
instead of being papered over with placeholder modules or features
- the 61 reviewed medium Hypatia findings remain explicit debt in #687

This PR now supersedes #685 by containing its live/deterministic policy
split as well as the security and reusable-CI work.
@hyperpolymath

Copy link
Copy Markdown
Owner Author

Superseded by #688, which includes this PR’s live/deterministic Actions-policy split together with the dependency, baseline, review, registry, and reusable Zig CI repairs. #688 passed the complete hosted suite and was squash-merged as signed commit f83f03f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

governance / Allowlist Preflight is permanently red in 331 of 332 repos — the PAT was never distributed

1 participant