Skip to content

Harden CI security - #679

Merged
dcastil merged 14 commits into
mainfrom
other/harden-ci-security
May 24, 2026
Merged

dcastil merged 14 commits into
mainfrom
other/harden-ci-security

Conversation

@dcastil

@dcastil dcastil commented May 24, 2026

Copy link
Copy Markdown
Owner

Hardens the CI-related security of this repo in reaction to the recent supply chain attacks.

Some context:

dcastil added 5 commits May 24, 2026 10:42
Split the npm publish workflow into separate build and publish jobs for both
dev and production releases.

The build jobs now perform dependency installation, linting, tests, export
checks, and Rollup builds without `id-token: write`. The publish jobs are the
only jobs with OIDC permission, and they only download the previously generated
`dist` artifact and run `npm publish`.

This reduces exposure to the supply-chain pattern seen in the TanStack incident:
a compromised dependency install, build script, lifecycle hook, or poisoned cache
should not be able to mint an npm trusted-publishing token.

Also remove dependency caches from the publish workflow entirely. Release jobs
are slower as a result, but this prevents a cache written by another workflow
from influencing the package artifact that eventually gets published.

Disable checkout credential persistence because these jobs do not need to push
back to the repository after checkout.

Replace the third-party version action and `yarn version` call in the dev publish
path with a small inline Node script. This avoids unnecessary third-party code and
avoids running package version lifecycle scripts in the OIDC-enabled publish job.

Publish with `--ignore-scripts` so npm lifecycle scripts cannot execute in the
trusted-publishing step.
Drop the unnecessary repository checkout from the label workflow.
@github-actions github-actions Bot added other Is other context-v3 Related to tailwind-merge v3 labels May 24, 2026
@github-actions

Copy link
Copy Markdown

Metrics report

At head commit e413d3b and base commit d4a5a40 at 2026-05-24T09:25:28.308Z

Size

No changes

All size metrics
Export Size original Size minified Size minified and Brotli compressed
tailwind-merge esm 103.09 kB 0% 28.20 kB 0% 7.34 kB 0%
 › createTailwindMerge 17.96 kB 0% 4.50 kB 0% 1.71 kB 0%
 › extendTailwindMerge 102.29 kB 0% 27.46 kB 0% 7.08 kB 0%
 › fromTheme 0.27 kB 0% 0.09 kB 0% 0.08 kB 0%
 › getDefaultConfig 81.90 kB 0% 21.98 kB 0% 5.27 kB 0%
 › mergeConfigs 2.36 kB 0% 0.89 kB 0% 0.29 kB 0%
 › twJoin 1.18 kB 0% 0.24 kB 0% 0.16 kB 0%
 › twMerge 99.81 kB 0% 26.52 kB 0% 6.91 kB 0%
 › validators 5.25 kB 0% 2.05 kB 0% 0.84 kB 0%
tailwind-merge cjs 103.35 kB 0% 34.86 kB 0% 7.79 kB 0%
tailwind-merge/es5 esm 109.24 kB 0% 30.36 kB 0% 7.60 kB 0%
 › createTailwindMerge 20.19 kB 0% 5.13 kB 0% 1.86 kB 0%
 › extendTailwindMerge 107.96 kB 0% 29.63 kB 0% 7.35 kB 0%
 › fromTheme 0.25 kB 0% 0.11 kB 0% 0.08 kB 0%
 › getDefaultConfig 84.69 kB 0% 23.29 kB 0% 5.30 kB 0%
 › mergeConfigs 2.61 kB 0% 0.96 kB 0% 0.30 kB 0%
 › twJoin 1.21 kB 0% 0.30 kB 0% 0.18 kB 0%
 › twMerge 104.90 kB 0% 28.47 kB 0% 7.16 kB 0%
 › validators 7.06 kB 0% 2.68 kB 0% 0.87 kB 0%
tailwind-merge/es5 cjs 109.50 kB 0% 37.05 kB 0% 8.05 kB 0%

@codspeed

codspeed Bot commented May 24, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 7 untouched benchmarks


Comparing other/harden-ci-security (3228eb8) with main (d4a5a40)

Open in CodSpeed

dcastil added 8 commits May 24, 2026 11:35
Split metrics report generation from PR comment posting so untrusted PR code only runs in a read-only job.

The metrics report action now only generates the comment body and writes it to the required `comment-body-path` output file. It no longer accepts a GitHub token, no longer posts comments itself, and no longer keeps the old `set-comment`/Octokit-based posting code path around. This makes accidental direct posting from the action fail structurally instead of relying on convention.

Add a separate `post-comment` script for the trusted workflow job. That job checks out the base repository code, downloads the generated comment artifact, and creates or updates the PR comment using a small dependency-free GitHub REST client. This preserves the write permission boundary without requiring dependency installation in the write-capable job.

Also document the metrics-report CI boundary in the agent internals notes so future workflow changes keep PR-code execution and write-capable comment posting separated.
Remove the static `CODSPEED_TOKEN` from the benchmark workflow so PR benchmark code no longer receives a long-lived CodSpeed upload token.

CodSpeed supports tokenless uploads for public repositories, which fits this repo better than static credentials or OIDC because the benchmark job executes pull request code. This keeps the job read-only and avoids granting either a repository secret or `id-token: write` to untrusted benchmark runs.
Extend the existing CodeQL workflow to analyze GitHub Actions workflow files in addition to JavaScript and TypeScript code.

Add a dedicated `analyze-actions` job that runs CodeQL with `languages: actions` and the `security-extended` query suite. This enables GitHub’s workflow-specific security checks for issues such as untrusted checkout patterns, artifact and cache poisoning risks, excessive token exposure, missing permissions, and unpinned non-immutable actions.

Also run the CodeQL workflow on pull requests that modify `.github/actions/**` or `.github/workflows/**`, so CI control-plane changes are scanned before merge instead of only after landing on `main` or during the scheduled weekly run.
@github-advanced-security

Copy link
Copy Markdown

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:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@dcastil
dcastil merged commit 20845db into main May 24, 2026
11 checks passed
@dcastil
dcastil deleted the other/harden-ci-security branch May 24, 2026 11:23
@github-actions

Copy link
Copy Markdown

This was addressed in release v3.6.0-dev.20845db4cb580aa2375b9eba3d695d0ece18bc87.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

context-v3 Related to tailwind-merge v3 other Is other

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants