ci: harden GitHub Actions workflows - #1052
Merged
Merged
Conversation
- Add least-privilege permissions blocks at workflow and job level so jobs only receive the scopes they need (contents: read by default, write only where releases are created). - Set persist-credentials: false on all actions/checkout steps that do not push, so the repo-scoped token is not left on disk for later steps and node_modules scripts. - pre-release: verify the release tag commit is an ancestor of origin/main before building, preventing releases from tags pointing at unreviewed commits. - publish-extension: gate marketplace publish jobs behind a 'publish' environment, pin vsce and ovsx to exact versions instead of installing latest at run time, and pass marketplace PATs via env vars instead of argv (argv is world-readable via /proc on the runner).
Pre-release tags are intentionally used to test builds without merging everything to main first, so drop the ancestor check and full fetch; stable release.yaml keeps its existing tag-on-main verification.
EhabY
force-pushed
the
ci/supply-chain-hardening
branch
from
July 29, 2026 16:02
75892d1 to
f6ec3b7
Compare
The setup job extracts the locked @vscode/vsce version from pnpm-lock.yaml (fails closed on a miss via pipefail) and the Marketplace publish job installs exactly that version, so packaging and publishing always run the same tool version.
EhabY
force-pushed
the
ci/supply-chain-hardening
branch
from
July 29, 2026 22:02
68d43e6 to
8b25074
Compare
jdomeracki-coder
approved these changes
Jul 30, 2026
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.
Hardens the GitHub Actions release/publish pipeline. No runtime code changes; nothing changes on today's happy path.
Changes
GITHUB_TOKEN: workflows default tocontents: read; only the release-creating job keepscontents: write+pull-requests: read(same scopes as before, now job-scoped). All checkouts setpersist-credentials: false; no job pushes or fetches after checkout, and pnpm clones thegithub:coder/coderdependency anonymously in its own store, so this is inert.publishenvironment as an attachment point for approval gating.install -glatest at publish time: the locked@vscode/vsceversion is extracted frompnpm-lock.yaml(fails closed on a miss), so packaging and publishing run the same tool version.ovsxis pinned to1.0.2(today's latest; not a project dependency, so no lockfile to sync against).VSCE_PAT/OVSX_PATenv vars (read natively by both tools) instead of-p <token>argv, which is world-readable via/proc.Alternatives considered
pnpm installin the publish job to runpnpm vsce publishdirectly. Pro: zero version extraction. Con: installs hundreds of packages into the one job holding marketplace PATs; larger exfiltration surface. Rejected.Important
Admin follow-up: the
publishenvironment auto-creates on first run with no protection rules, so it blocks nothing by itself. Add required reviewers, and ideally moveVSCE_PAT/OVSX_PATinto environment secrets so only approved runs can read them.Intentionally unchanged: pre-release tags remain buildable off
main(used for testing); dev-onlypnpm auditfindings (mocha transitives, unreachable from the shipped extension) are deferred. Dependency provenance for thecodergit dependency is handled in #1053.