Skip to content

chore(governance): add PrGovernance risk-gate workflow - #4

Merged
Pigbibi merged 1 commit into
mainfrom
chore/add-pr-governance-risk-gate
Dec 3, 2026
Merged

Pigbibi merged 1 commit into
mainfrom
chore/add-pr-governance-risk-gate

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Onboard CodeGovernanceLab/AiTaskService to CodeGovernanceLab/PrGovernance using the canonical risk-gate.yml template pinned at 5c4348e9d9ffbacf5526164a5be7f5c9f74fbfaf.

AI assistance

Prepared with Antigravity.

@Pigbibi
Pigbibi merged commit 235778d into main Dec 3, 2026
@Pigbibi
Pigbibi deleted the chore/add-pr-governance-risk-gate branch December 3, 2026 08:32
@cgl-opencode-reviewer

Copy link
Copy Markdown

AI Code Review (opencode / glm-5.3)

The workflow gets the fundamentals right for a pull_request_target-based gate: the third-party action is pinned to a full 40-char SHA, PR code is never checked out, no secrets are passed (only non-sensitive vars), and record_label scopes its token tightly. However, the evaluate job grants actions:write without a visible need, the workflow_run trigger references a 'PR review signal' workflow that this PR does not add (so the fork/Dependabot review-comment relay may silently never fire), and the always() condition lets evaluation proceed even when the label-head recorder failed, which is a fail-open direction for the gate's own evidence model. Remaining items are verification notes around comment-trigger spoofing and an env var naming inconsistency.

Reviewed commit: ef8333b606 · Coverage: complete · Unresolved findings: true

Findings

  • [MEDIUM] .github/workflows/risk-gate.yml: The evaluate job (and top-level permissions) grant actions:write. A gate that 'reads metadata only' and posts commit statuses needs at most actions:read to inspect workflow_run payloads/artifacts; actions:write additionally lets the third-party action approve or cancel workflow runs. Reduce to actions:read or document the concrete write capability required.
  • [MEDIUM] .github/workflows/risk-gate.yml: The workflow_run trigger references workflows: ["PR review signal"], but this PR adds no such workflow. Per the file's own comment, fork/Dependabot review and inline comments reach this trusted run only via that relay; if the workflow does not already exist in the repo, the trigger silently never fires and those review signals are never evaluated. Confirm the companion workflow exists or add it as part of this onboarding.
  • [MEDIUM] .github/workflows/risk-gate.yml: evaluate's condition always() && needs.record_label.result != 'cancelled' lets evaluation proceed even when record_label failed. The file states the labeled payload is 'the only authenticated record of which head a clearing label was added to', so running evaluate after a recorder failure can produce a verdict without the label-to-head binding (fail-open if the action falls back to 'label present on PR'). Fail closed: also exclude result == 'failure' (or fail the run) when label evidence could not be recorded.
  • [LOW] .github/workflows/risk-gate.yml: The issue_comment pre-filter accepts any user.type == 'Bot' or any comment body containing 'codex-review'/'ai-review-receipt', so any user or installed app can launch the trusted evaluation. This is safe only if the pinned action validates receipts by author identity (GOVERNANCE_REVIEWER_APP_ID/USER_ID/LOGIN) rather than by body-content matching, which is trivially forgeable. Verify the action enforces author-bound validation.
  • [LOW] .github/workflows/risk-gate.yml: Env var naming inconsistency: GOVERNANCE_REVIEWERS_JSON lacks the RISK_GATE_ prefix used by every other var in this workflow. If repo settings only define RISK_GATE_* variables, the reviewers list is silently empty. Confirm the exact variable name or align the prefix.
  • [LOW] .github/workflows/risk-gate.yml: For workflow_run events from fork PRs, github.event.workflow_run.pull_requests is typically empty, so the concurrency group falls back to github.run_id and cancel-in-progress no longer dedupes relayed evaluations for the same PR. Consider deriving the PR number from the workflow_run head SHA/branch lookup so relayed runs share the per-PR concurrency group.

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.

1 participant