Repository navigation
ci: apply the CI security standard (no cache in release, pins, permissions) - #1060
Conversation
setup-node no longer restores the shared pnpm cache in the release and snapshot jobs, which hold id-token: write for npm trusted publishing, and the snapshot job no longer persists the checkout token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pin every action and reusable workflow to a full commit SHA with its version in a comment, default workflows to no permissions and grant each job what it uses, stop persisting the checkout token, and give each job a timeout above its slowest recent run. The pnpm-format label workflow passes only the secret it needs instead of inheriting all of them, and removes the label through env variables instead of interpolating the event into the shell script. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dependency review fails PRs that add a dependency with a high-severity advisory or a licence outside the allowlist. zizmor lints workflow changes on PRs and weekly. Dependabot keeps the pinned action SHAs current, with a 7-day cooldown before a new release is proposed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
tolgahan-arikan
left a comment
There was a problem hiding this comment.
LGTM, thanks. Non-blocking: the dependency-review licence allowlist will flag packages already in the lockfile the first time a PR bumps them. Examples: caniuse-lite (CC-BY-4.0); lru-cache@11, glob@13, minimatch@10, path-scurry (BlueOak-1.0.0); argparse@2 (Python-2.0); @img/sharp-libvips-* (LGPL-3.0-or-later). It passes now only because this PR changes no dependencies. Could add BlueOak-1.0.0, CC-BY-4.0 and Python-2.0 to allow-licenses and exempt sharp/libvips via allow-dependencies-licenses, or switch to a deny-licenses list. Fine as a follow-up.
patrislav
left a comment
There was a problem hiding this comment.
1. Dependabot won't see the composite action
With directory: /, Dependabot only scans .github/workflows/* and a root action.yml (docs). The pins in .github/actions/install-dependencies/action.yml won't get bumped, and that's what tests and pnpm-format install through.
- package-ecosystem: github-actions
directories: ["/", "/.github/actions/*"]2. The pipelines pin still floats underneath
apps-changeset-check.yml at 3c69da7 calls 0xPolygon/pipelines/.github/actions/upsert-changeset-comment@main, so that step still runs whatever is on pipelines main. And since the comment is # main rather than a tag, Dependabot won't bump this SHA; it's a manual edit on every pipelines change. Nothing to change here, but worth raising with pipelines: pin its internal @main refs and cut tags.
3. The v4 pins are on a deprecated runtime
This PR's CI logs warn that checkout v4.4.0 targets Node 20 and is "being forced to run on Node.js 24"; same for setup-node v4.4.0 and cache v4.3.0. The release workflow is already on checkout v7.0.1, setup-node v7.0.0 and pnpm/action-setup v6.0.9. Aligning the rest now avoids a three-major-version jump in the first grouped Dependabot PR.
Nit: the zizmor job's contents: read and actions: read are only needed on private repos.
Dependency review only passed because no dependency changed. Add the permissive licences GitHub reports for packages already in the tree (BlueOak-1.0.0, CC-BY-4.0, Python-2.0, BSD-2-Clause-Views, Zlib, ...) and exempt by name the packages already present under copyleft or unparsed licence data, so bumping them doesn't fail the check while a new dependency with such a licence still does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
checkout, setup-node, cache and pnpm/action-setup run on the deprecated Node 20 runtime at the versions pinned so far; pin the releases the release workflow already uses. pnpm/action-setup now takes the version from packageManager. Dependabot also scans .github/actions, which directory: / leaves out. zizmor no longer requests contents and actions read, which only private repositories need. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tolgahan-arikan
left a comment
There was a problem hiding this comment.
LGTM, thanks for addressing the licence allowlist, the composite-action scanning and the Node 20 pins.
Brings the GitHub Actions workflows in line with the CI security standard for GitHub Actions (npm and Go). Publishing still goes through changesets and
npm stage publish; no triggers are changed.Release path
releaseandsnapshotjobs holdid-token: write, butsetup-noderestored the shared pnpm cache there (cache: pnpm). It now runs withpackage-manager-cache: false, so nothing from the shared cache reaches the jobs that can stage packages. Releases install from the registry and take a little longer.snapshotcheckout no longer persists the job token. Thereleasecheckout already didn't.Workflow hygiene
0xPolygon/pipelines/...@mainis pinned to today'smain.permissions: {}and each job declares what it uses.persist-credentials: falseon the remaining checkouts.pnpm-formatcommits back through0xsequence/actions/git-commit, which clones with its own token.pnpm formatlabel workflow:GH_TOKEN_GIT_COMMITinstead ofsecrets: inherit;gh apiandenv:instead of interpolating the label name and token into acurlcommand.New checks
dependency-review.ymlfails a PR that adds a dependency with a high-severity advisory or a licence outside the allowlist.zizmor.ymllints workflow changes on PRs and weekly, with SARIF going to code scanning.dependabot.ymladds GitHub Actions version updates with a 7-day cooldown, so the pins stay current.Not in this PR (need a decision)
claude.ymlruns onissue_commentin a public repo, and claude-code-action checks out the PR head itself. It only runs for commenters with write access, but it still processes fork code with an API key in the job. A safer trigger design is a separate change.snapshotjob stages fromworkflow_dispatchwith a dist-tag frominputs.snapshot_tag. The standard only allowsnext/latestderived frompackage.json. That's a policy question for the standard, not a mechanical fix..npmrcignore-scripts=trueis not added. pnpm 10 already blocks dependency build scripts, and the setting would also skip the rootpostinstall(lefthook install). The release jobs keep--no-frozen-lockfile, which is documented in the workflow.Checks: zizmor (medium+) goes from 8 medium / 13 high findings to 1 high, the
claude.ymltrigger above. Only.github/changes, so no changeset is needed.After review
allow-licensesnow includes the permissive licences GitHub reports for packages already in the tree: BlueOak-1.0.0, CC-BY-4.0, Python-2.0, BSD-2-Clause-Views and others. The 13@img/sharp-*packages (LGPL, pulled in bynext→sharp) are exempted by name inallow-dependencies-licenses. A bump of an existing dependency now passes, while a new dependency under a copyleft licence still fails. The list was checked against this repo's dependency-graph SBOM with thespdx-satisfiesversion the action uses..github/actions/*too, so theinstall-dependenciespins get bumped.pnpm/action-setupnow takes the version frompackageManager; v4+ rejects aversion:input that disagrees with it.contents/actions: read, since the repo is public.apps-changeset-check.ymlstill callsupsert-changeset-comment@maininside 0xPolygon/pipelines. That's being raised with pipelines alongside the proposal to centralise pinned CI versions there.