Skip to content

Harden and speed up CI workflows - #43

Merged
kin0992 merged 1 commit into
mainfrom
chores/workflow-hardening
Jun 3, 2026
Merged

Harden and speed up CI workflows#43
kin0992 merged 1 commit into
mainfrom
chores/workflow-hardening

Conversation

@kin0992

@kin0992 kin0992 commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Why

The release job carries the most sensitive credentials in the repo (GitHub App private key + npm OIDC publish token) but ran with audit-only egress, and pulumi-setup interpolated an input into a shell command. Separately, CI was leaving easy performance on the table — Turbo remote-cache creds were never forwarded, CodeQL ran a pointless build step, and the security suite re-ran on docs-only changes.

What

Security

  • pulumi-setup: pass cloud-url via an env var instead of ${{ }} interpolation in run:, closing a command-injection sink.
  • release-reusable: harden-runner now runs egress-policy: block + disable-sudo: true with an allowlist scoped to exactly what the publish path needs (GitHub, npm registry, Node download, sigstore).

Speed

  • ci: forward TURBO_TOKEN/TURBO_TEAM to the static-analysis workflow (explicitly, not secrets: inherit, so fork PRs stay cache-read-only). Inert until the secrets are added to the repo.
  • security-analysis: drop CodeQL Autobuild, set build-mode: none — JS/TS needs no compilation.
  • security: paths-ignore docs (**/*.md, LICENSE, .editorconfig).

How to verify

  • CI / Static Analysis (self) (the required check) passes on this PR.
  • CodeQL job runs without the Autobuild step and still uploads results.
  • Egress allowlist will be exercised on the next release; if a host is missing, the harden-runner run summary "insights" link names it.

Risks / follow-ups

  • Turbo cache is a no-op until TURBO_TOKEN/TURBO_TEAM are created and added to repo secrets.
  • The release egress allowlist is best-effort; reconcile it against the first real release's harden-runner insights.
  • Not included here (separate decisions): pinning the internal @main action refs, and enforceAdmins: true on branch protection.

Lock down the release job's egress and remove a shell-injection sink,
then cut wasted work from the security and CI pipelines.

Security:
- pulumi-setup: pass cloud-url via an env var instead of interpolating
  it into the run script, closing a command-injection sink.
- release-reusable: run harden-runner in block mode with disable-sudo
  and an allowlist scoped to the endpoints the publish path needs. This
  is the job that holds the GitHub App key and mints the npm OIDC
  credential, so egress should be deny-by-default.

Speed:
- ci: forward TURBO_TOKEN/TURBO_TEAM to the static-analysis workflow so
  Turbo remote caching can actually take effect (inert until the secrets
  are added).
- security-analysis: drop CodeQL Autobuild and set build-mode none;
  JS/TS needs no compilation step.
- security: skip the suite on docs-only changes via paths-ignore.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jun 3, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 8a390a5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@kin0992
kin0992 merged commit 96e3d1f into main Jun 3, 2026
6 checks passed
@kin0992
kin0992 deleted the chores/workflow-hardening branch June 3, 2026 21:35
kin0992 added a commit that referenced this pull request Jun 3, 2026
## Why
After the egress block landed in #43, the release workflow started
failing in `kin0992/f1` — two hosts were missing from the allowlist, and
Next.js telemetry was making an unconfigured outbound call.

## What
- Add `release-assets.githubusercontent.com:443` — needed to download
toolchain release assets during setup/build.
- Add `fonts.googleapis.com:443` — fetched by Next.js at build time when
the app uses `next/font` with Google Fonts.
- Set `NEXT_TELEMETRY_DISABLED=1` on the Build step — suppresses the
telemetry call at source rather than allowlisting
`telemetry.nextjs.org`.

## How to verify
Re-run the failing job at
https://github.com/kin0992/f1/actions/runs/26915760107 after this
merges.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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