[codex] Add GitHub Actions hardening audit#163
Conversation
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e93cd671d7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| function findActionsRisks(file: string, content: string): Finding[] { | ||
| const findings: Finding[] = []; | ||
| const hasPermissions = PERMISSIONS_PATTERN.test(content); |
There was a problem hiding this comment.
Detect only top-level workflow permissions
In workflows that define permissions: only under one job, this check treats the whole file as having explicit workflow permissions and skips actions-missing-permissions. Any other job in the same workflow still runs under the repository/org default token permissions, so the audit can report no missing top-level least-privilege setting even though the new docs say it flags missing top-level workflow permissions. Please distinguish top-level permissions: from job-level blocks before suppressing this finding.
Useful? React with 👍 / 👎.
| const action = match[1]; | ||
| const ref = match[2] ?? ''; | ||
| if (action.startsWith('./') || action.startsWith('../') || action.startsWith('docker://')) continue; | ||
| if (!ref || !FULL_SHA_PATTERN.test(ref)) { |
There was a problem hiding this comment.
Accept quoted SHA-pinned action refs
For valid YAML such as uses: "actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd", the regex captures the trailing quote as part of ref, so this full 40-character pin fails FULL_SHA_PATTERN.test(ref) and is incorrectly reported as unpinned. Repositories that quote scalar values in workflows will get false warnings/failures from actions-audit despite using immutable refs.
Useful? React with 👍 / 👎.
Summary
contextforge actions-auditfor GitHub Actions hardening proofCloses #162.
Why
Agent-authored repos increasingly need proof that release workflows are not silently weakened by mutable actions, broad permissions,
pull_request_targetpatterns, or direct script interpolation of untrusted GitHub contexts.Research anchors:
Validation
pnpm buildpnpm typecheckpnpm testnode dist/cli.js actions-audit --summary contextforge-actions-audit.md --sarif contextforge-actions.sarif-> pass, 100/100node dist/cli.js workflow-audit --summary contextforge-workflow-audit.md --sarif contextforge-workflow.sarif-> pass, 100/100node dist/cli.js security-benchmark-> pass, 4/4node dist/cli.js audit --min-context-score 70 --min-cache-score 70 --min-security-score 70 --output contextforge-audit.json --report contextforge-report.html-> pass, 100/100 / 100/100 / 100/100node dist/cli.js publish-readiness --summary contextforge-publish-readiness.md-> warn only for human npm setupnpm pack --dry-run --json->contextforge@0.69.0git diff --checkCodeRabbit agent auth was checked but is not authenticated in this environment.