Fix missing-workflow-permissions alerts and integrate zizmor#113
Merged
Conversation
Resolves 6 of the 7 open code scanning alerts (https://github.com/rubyatscale/visualize_packs/security/code-scanning), all actions/missing-workflow-permissions findings on workflows that had no explicit permissions block and so defaulted to the repository's token permissions: - ci.yml: root-level `contents: read` (checkout + bundle exec only, across all three jobs) - cd.yml: `contents: write` on the shared-config caller job - the called reusable workflow pushes a release tag (discourse/publish-rubygems-action) and creates a GitHub release (`gh release create`), both of which need contents:write - stale.yml: `issues: write` + `pull-requests: write` - required by actions/stale to label/close stale issues and PRs - triage.yml: `issues: write` - the called reusable workflow's own `label_issues` job requires this from the caller The 7th alert (js/functionality-from-untrusted-source, the insecure `http://d3js.org/d3.v3.min.js` CDN script tag in d3_graph_generator/public/index.html) is already fixed on the open Vite migration branch (#112) via removing that dead script tag entirely; it isn't duplicated here since that PR deletes the file this alert points at. Also adds .github/workflows/zizmor.yml, copied from shared-config's existing zizmor integration (the org's canonical pattern - this is the first repo to adopt it). Running it locally against this repo's own workflows surfaced additional real findings beyond CodeQL's actions coverage, all fixed here so the new job starts green instead of red: - unpinned `actions/checkout@v4` / `ruby/setup-ruby@v1` in ci.yml - pinned to SHA (matching the convention already used in codeql.yml) - missing `persist-credentials: false` on checkout steps in ci.yml and codeql.yml - stale/incorrect version comments on already-pinned SHAs in ci.yml, codeql.yml, and the copied zizmor.yml - e.g. a SHA commented "# v6" that's actually tagged v7.0.0 today (floating major tags move), and "# v3.37.3" on a SHA that's actually v4.37.3 (a leftover from an earlier find-and-replace pass across the org). Caught by zizmor's ref-version-mismatch audit in online mode (--gh-token), not offline. - three findings suppressed with `# zizmor: ignore[...]` comments for patterns that are deliberate, org-wide conventions rather than bugs: workflow_run-triggered CD (dangerous-triggers), unpinned @main references to shared-config's own reusable workflows (unpinned-uses - pinning these would defeat the point of centralizing them, since shared-config updates wouldn't propagate), and secrets: inherit on the cd.yml caller (secrets-inherit - matches shared-config's own precedent for this exact pattern). Verified with `zizmor .github/workflows/` locally, both offline and with --gh-token (online mode catches the ref-version-mismatch findings that offline mode misses): 0 findings, all ignores/suppressions resolving correctly.
|
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. |
Matches the existing bundler grouping in this same file: one PR a month for all github-actions bumps together, instead of a separate PR per action. Especially relevant now that this PR pins several actions to a SHA (actions/checkout, ruby/setup-ruby, github/codeql-action, zizmorcore/zizmor-action) for the first time, which is what makes them trackable by dependabot's github-actions ecosystem in the first place.
The new zizmor.yml added earlier in this PR caught its own dependabot-cooldown finding on the github-actions entry this PR just added (alert #11), and the same check flags the pre-existing bundler entry too - it just never ran against this repo before since zizmor.yml didn't exist until this PR. Fixed both with zizmor --fix=safe, matching shared-config's own dependabot.yml convention (cooldown: default-days: 7).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves 6 of the 7 open code scanning alerts (https://github.com/rubyatscale/visualize_packs/security/code-scanning), all
actions/missing-workflow-permissionsfindings on workflow jobs that had no explicitpermissions:block and so defaulted to the repository's token permissions:ci.yml(3 jobs)contents: read— checkout +bundle execonly, nothing writescd.ymlcontents: writeon the caller job — the called reusable workflow pushes a release tag (discourse/publish-rubygems-action) and creates a GitHub release (gh release create), both needcontents: writestale.ymlissues: write+pull-requests: write— required byactions/staletriage.ymlissues: write— matches what the called reusable workflow's own job declaresThe 7th alert (
js/functionality-from-untrusted-source, the insecurehttp://d3js.org/d3.v3.min.jsCDN tag) was already fixed by #112 (merged), which deleted the file that alert pointed at — CodeQL just hasn't rescannedmainyet, so it still shows as open.Also adds
.github/workflows/zizmor.yml, copied fromshared-config's existing zizmor integration (the org's canonical pattern — this is the first consumer repo to adopt it). Running it locally against this repo's own workflows surfaced real findings beyond CodeQL's coverage, fixed here so the new job starts green:actions/checkout@v4/ruby/setup-ruby@v1inci.yml— pinned to SHA, matchingcodeql.yml's existing convention.persist-credentials: falseon checkout steps inci.ymlandcodeql.yml.codeql.yml(said# v3.37.3, the SHA is actuallyv4.37.3— a leftover from an earlier find-and-replace across the org).# zizmor: ignore[...]for deliberate, org-wide conventions rather than bugs:workflow_run-triggered CD (dangerous-triggers), unpinned@mainreferences toshared-config's reusable workflows (unpinned-uses— pinning these would defeat the point of centralizing them), andsecrets: inheriton thecd.ymlcaller (secrets-inherit, matchingshared-config's own precedent).Verified with
zizmor .github/workflows/, both offline and with--gh-token(online mode catches additional findings, like the stale version comment, that offline mode misses): 0 findings.Independent verification surfaced a real, currently-active bug in
shared-config's owncd.yml(not touched by this diff): its checkout step setspersist-credentials: false, butdiscourse/publish-rubygems-action'srake releasestep does a rawgit pushthat depends on that persisted credential. This means grantingcontents: writehere is necessary but not sufficient — the actual deploy will still fail.This isn't hypothetical:
rubyatscale/danger-migrations(which calls the sameshared-config/cd.yml@main) has failed 9 of its last 10 CD runs since 2026-04-14 withfatal: could not read Username for 'https://github.com'.visualize_packs's next real gem release will very likely hit the same failure. Fixing it requires a change toshared-configitself (e.g. droppingpersist-credentials: falseon that checkout step, or re-authenticating before the push), which is out of scope for this PR.Test plan
zizmor .github/workflows/— 0 findings, offline and onlinemain