Skip to content

ci: Harden Marketplace release pipelines against supply-chain attacks#5083

Open
iliev01 wants to merge 1 commit intogitkraken:mainfrom
iliev01:sec/harden-release-pipelines
Open

ci: Harden Marketplace release pipelines against supply-chain attacks#5083
iliev01 wants to merge 1 commit intogitkraken:mainfrom
iliev01:sec/harden-release-pipelines

Conversation

@iliev01
Copy link
Copy Markdown

@iliev01 iliev01 commented Mar 27, 2026

Summary

This PR hardens the Marketplace release pipelines and the CI pipeline of gitkraken/vscode-gitlens against supply-chain attacks by pinning all GitHub Actions to immutable commit SHAs and enforcing least-privilege permissions.

GitLens publishes to the VS Code Marketplace (millions of installs) and OpenVSIX — making the release pipelines exceptionally high-value targets. A compromised mutable action tag could silently inject malicious code into the published .vsix artifact, affecting all downstream users.

Changes

.github/workflows/cd-stable.yml

  • Pinned actions/checkout@v4@34e114876b0b11c390a56381ad16ebd13914f8d5
  • Pinned actions/setup-node@v4@49933ea5288caeca8642d1e84afbd3f7d6820020
  • Pinned pnpm/action-setup@v3@a3252b78c470c02df07e9d59298aecedc3ccdd6d
  • Pinned mindsers/changelog-reader-action@v2@32aa5b4c155d76c94e4ec883a223c947b2f02656
  • Pinned softprops/action-gh-release@v2@153bb8e04406b158c6c84fc1615b65b24149a1fe

.github/workflows/cd-pre.yml

  • Pinned actions/checkout@v4@34e114876b0b11c390a56381ad16ebd13914f8d5
  • Pinned actions/setup-node@v4@49933ea5288caeca8642d1e84afbd3f7d6820020
  • Pinned pnpm/action-setup@v3@a3252b78c470c02df07e9d59298aecedc3ccdd6d
  • Pinned actions/upload-artifact@v4@ea165f8d65b6e75b540449e92b4886f43607fa02
  • Added permissions: { contents: read } to the publish job to enforce least-privilege (the check job already had proper permissions)

.github/workflows/ci.yml

  • Added top-level permissions: { contents: read } to restrict default GITHUB_TOKEN scope across all three jobs (build, unit-tests, e2e-tests)
  • Pinned actions/checkout@v4@34e114876b0b11c390a56381ad16ebd13914f8d5
  • Pinned actions/setup-node@v4@49933ea5288caeca8642d1e84afbd3f7d6820020
  • Pinned pnpm/action-setup@v4@b906affcce14559ad1aafd4ab0e942779e9f58b1
  • Pinned actions/cache@v4@0057852bfaa89a56745cba8c7296529d2fc39830
  • Pinned actions/upload-artifact@v4@ea165f8d65b6e75b540449e92b4886f43607fa02

Security Rationale

Mutable version tags (e.g., @v4) allow action authors — or an attacker who gains write access — to silently substitute the code that runs during CI/CD. Pinning to immutable commit SHAs eliminates this attack vector entirely. Adding explicit permissions blocks enforces least privilege, limiting what the GITHUB_TOKEN can access.

This is especially critical for the cd-stable.yml and cd-pre.yml pipelines which handle Marketplace PATs and produce the .vsix artifacts that ship to millions of developers.

All # v... comments are preserved next to pinned SHAs for maintainability.

Consistent with OSSF Scorecard, StepSecurity Harden-Runner, and the GitHub Actions Security Hardening Guide.

…missions

- cd-stable.yml: Pin checkout, setup-node, pnpm/action-setup,
  changelog-reader-action, and action-gh-release to commit SHAs
- cd-pre.yml: Pin checkout, setup-node, pnpm/action-setup, and
  upload-artifact to commit SHAs; add permissions block to publish job
- ci.yml: Add top-level permissions: contents: read; pin checkout,
  setup-node, pnpm/action-setup, cache, and upload-artifact to commit SHAs

Signed-off-by: Atanas Iliev <atanas.iliev.ai@gmail.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