Skip to content

feat(cli): complete actions audit workflow scanner with secrets-in-run and third-party-action rules#437

Draft
Copilot wants to merge 3 commits into
masterfrom
copilot/add-actions-audit-command
Draft

feat(cli): complete actions audit workflow scanner with secrets-in-run and third-party-action rules#437
Copilot wants to merge 3 commits into
masterfrom
copilot/add-actions-audit-command

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 25, 2026

sh1pt build actions audit was missing two of the eight security rules called out in the issue. This PR fills the gaps so the scanner covers all requested patterns.

New audit rules

Rule Severity Pattern detected
secrets-in-run high ${{ secrets.* }} interpolated directly in a run: step — leaks plaintext into workflow logs
third-party-action low uses: from outside trusted orgs (actions/, github/, aws-actions/, azure/, docker/, hashicorp/, google-github-actions/, slsa-framework/) not pinned to a 40-char SHA digest

Full rule coverage after this PR

Rule Severity
unpinned-action-branch high
write-all-permissions high
pull-request-target high
curl-pipe-bash / wget-pipe-bash high
secrets-in-run high
missing-permissions medium
unpinned-docker-image medium
third-party-action low

Example

$ sh1pt build actions audit --repo . --json
{
  "repoDir": "/my/repo",
  "filesScanned": 3,
  "findings": [
    { "file": "...", "rule": "secrets-in-run", "severity": "high",
      "message": "secret interpolated directly in a `run:` step — value may appear in workflow logs" },
    { "file": "...", "rule": "third-party-action", "severity": "low",
      "message": "action some-org/cool-action is from a third-party publisher — consider pinning to a SHA digest" }
  ],
  "riskLevel": "high"
}

Implementation notes

  • secrets-in-run regex handles both inline (- run: cmd ${{ secrets.X }}) and YAML block-scalar forms (- run: |\n cmd ${{ secrets.X }})
  • third-party-action deduplicates findings per action ref (same action used in multiple jobs only reported once)
  • Block scalar regex tightened to [|>][-+]?\d* to match only valid YAML chomping/indentation indicators

Copilot AI linked an issue May 25, 2026 that may be closed by this pull request
@alwaysmeticulous
Copy link
Copy Markdown

Meticulous was unable to execute a test run for this PR because the most recent commit is associated with multiple PRs. To execute a test run, please try pushing up a new commit that is only associated with this PR.

Last updated for commit f53ffb3. This comment will update as new commits are pushed.

Copilot AI added 2 commits May 25, 2026 19:16
Add two missing security audit rules to auditWorkflowContent:

- secrets-in-run (high): detects ${{ secrets.* }} interpolated
  directly in `run:` steps (both inline and block styles), which
  can leak secret values in GitHub Actions workflow logs.

- third-party-action (low): flags `uses:` references from outside
  the set of well-known trusted organisations (actions/, github/,
  aws-actions/, azure/, docker/, hashicorp/, google-github-actions/,
  slsa-framework/) that are not pinned to an immutable 40-char SHA
  digest.

Also adds four new tests for these rules:
- detects secrets interpolated in run steps
- does not flag secrets used in env: blocks
- flags third-party actions not pinned to a SHA
- does not flag trusted-org actions or SHA-pinned actions

Closes #422
…ar regex

Address code review feedback:
- Track reported third-party actions in a Set to prevent duplicate
  findings when the same action appears multiple times in a workflow
- Tighten block scalar regex from [|>][^\n]* to [|>][-+]?\d*[^\n]*
  to only match valid YAML block scalar indicators (optional chomping
  indicator +/- and optional explicit indentation digit)
Copilot AI changed the title [WIP] Add actions audit workflow scanner to sh1pt CLI feat(cli): complete actions audit workflow scanner with secrets-in-run and third-party-action rules May 25, 2026
Copilot AI requested a review from ralyodio May 25, 2026 19:18
@github-actions
Copy link
Copy Markdown

vu1nz Security Review

0 finding(s) in PR #?

No security issues found.

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.

Implement actions audit workflow scanner

2 participants