Skip to content

ci(security): harden security workflow — clear zizmor alerts #10 & #11#32

Open
WomB0ComB0 wants to merge 2 commits into
mainfrom
ci/harden-security-workflow
Open

ci(security): harden security workflow — clear zizmor alerts #10 & #11#32
WomB0ComB0 wants to merge 2 commits into
mainfrom
ci/harden-security-workflow

Conversation

@WomB0ComB0
Copy link
Copy Markdown
Member

@WomB0ComB0 WomB0ComB0 commented Jun 1, 2026

Clears both open code-scanning alerts on .github/workflows/security.yml (zizmor 1.24.1), verified locally with zizmor --persona=auditor --no-online-audits"No findings to report."

Alerts addressed

# Rule Sev Fix
#11 secrets-inherit warning Replace secrets: inherit (forwards all repo secrets to the reusable workflow) with named forwarding of only SEMGREP_APP_TOKEN — the one token-consuming scanner enabled here.
#10 unpinned-uses error Already SHA-pinned in #30; carried forward. (Alert stays "open" only because the workflow startup-fails and never re-scans.)

Plus two latent findings the stale 2026-04-15 scan predates:

  • excessive-permissions — workflow-level permissions dropped to {}; contents/security-events/pull-requests moved onto the scan job so they apply only to the reusable call.
  • undocumented-permissions — every scope now has an explanatory comment.

Dependency

Requires resq-software/.github#21 (merged ✅), which declares SEMGREP_APP_TOKEN under workflow_call.secrets in the reusable workflow. This PR re-pins to that workflow's new SHA b48036af (#21).

Test plan

Honest caveat

The earlier #30 SHA-pin did not fix the scheduled startup_failure (it persisted on the merged commit). The true startup error is only visible in the Actions web UI, not the API. This PR is the next most-likely fix; if the workflow still startup-fails after merge, the cause is elsewhere (org ruleset / repo Actions setting) and needs a look at the run page.

Summary by CodeRabbit

  • Chores
    • Enhanced security scanning infrastructure by implementing least-privilege access controls and restricting permissions to only what's necessary.

Resolves both open code-scanning alerts on .github/workflows/security.yml
(zizmor 1.24.1, verified locally with `zizmor --persona=auditor`):

- #11 secrets-inherit (warning): replace `secrets: inherit` — which hands
  the reusable workflow ALL of this repo's secrets — with named forwarding
  of just SEMGREP_APP_TOKEN (the only enabled token-consuming scanner).
  Enabled by resq-software/.github#21, which declares the secret under
  workflow_call.secrets; re-pinned to that workflow's new SHA
  (b48036af, #21).
- #10 unpinned-uses (error): already SHA-pinned in #30; carried forward.

Also clears two latent findings the stale scan predates:
- excessive-permissions: drop workflow-level `permissions` to `{}` and move
  contents/security-events/pull-requests scopes onto the `scan` job, so they
  apply only to the reusable call.
- undocumented-permissions: every scope now carries an explanatory comment.

`zizmor --no-online-audits` reports "No findings" on the result.

NOTE: this does not by itself explain the separate scheduled-run
startup_failure (which persisted after the #30 pin); switching off
`secrets: inherit` is the leading remaining hypothesis and this PR tests it.
@gemini-code-assist
Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

Warning

Review limit reached

@WomB0ComB0, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 57 minutes and 9 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fa091c53-8dd1-4540-a111-a44b9862913e

📥 Commits

Reviewing files that changed from the base of the PR and between e5b38a7 and cbb79c7.

📒 Files selected for processing (1)
  • .github/workflows/security.yml
📝 Walkthrough

Walkthrough

Updates .github/workflows/security.yml to enforce least-privilege access by declaring empty top-level permissions, explicitly scoping minimal permissions to the scan job, updating the reusable workflow SHA, and tightening secrets forwarding to pass only SEMGREP_APP_TOKEN instead of inheriting all secrets.

Changes

Security scan workflow hardening

Layer / File(s) Summary
Workflow permissions, secrets, and SHA update
.github/workflows/security.yml
Top-level permissions: {} is added; job-level scan.permissions grants only contents: read, security-events: write, and pull-requests: read; secrets: inherit is removed and replaced with explicit SEMGREP_APP_TOKEN forwarding; reusable workflow uses SHA is updated to a newer commit.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • resq-software/programs#30: Both PRs update the reusable security-scan.yml workflow invocation to a newer SHA-pinned commit in the same scan job.

Poem

🐰 A rabbit's security cheer,
Permissions tightened, secrets clear!
No inherit here, just what's required,
Access scoped and fires retired. 🔐✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: hardening the security workflow by removing overly permissive secret handling and clarifying permissions, which directly resolves the two zizmor alerts (#10 and #11) mentioned.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/harden-security-workflow

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 and usage tips.

Root cause of the security-workflow startup_failure (every run since
2026-05-04, 0 jobs executed): the reusable security-scan.yml's CodeQL and
zizmor jobs request `actions: read` (added in resq-software/.github#20,
2026-05-04 — exactly when the failures began). A reusable workflow's jobs
cannot request a permission the caller did not grant; GitHub rejects the
entire run at startup.

The prior #30 SHA-pin and the secrets-inherit removal did not fix it
because neither granted actions:read. Add it to the scan job's permissions.
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