Skip to content

chore: harden repository security#155

Merged
skyrpex merged 11 commits intomainfrom
chore/migrate-to-pnpm
May 6, 2026
Merged

chore: harden repository security#155
skyrpex merged 11 commits intomainfrom
chore/migrate-to-pnpm

Conversation

@skyrpex
Copy link
Copy Markdown
Contributor

@skyrpex skyrpex commented May 5, 2026

Motivation

Switching to pnpm for security: unlike npm, pnpm does not run postinstall scripts from dependencies by default, reducing the risk of supply chain attacks.

The CI workflow changes enforce additional security hardening via zizmor (static analysis for GitHub Actions) and pinact (pins actions to full commit SHAs).

Changes

pnpm migration

  • Replace package-lock.json with pnpm-lock.yaml (generated via pnpm import)
  • Add "packageManager": "pnpm@10.33.3" to package.json
  • Update vscode:prepublish, package, and pretest scripts to use pnpm run
  • Update CI workflows (build.yml, release.yml) to use pnpm/action-setup, cache: pnpm, and pnpm install --frozen-lockfile

pnpm security policy (pnpm-workspace.yaml)

  • Block all dependency build scripts by default (postinstall etc.), with esbuild explicitly allowlisted (required to download its platform binary)
  • Enforce trustPolicy: no-downgrade to prevent package version rollbacks
  • Enable blockExoticSubdeps: true to block non-standard subdependency specifiers
  • Set minimumReleaseAge: 10080 (7 days) to mirror the Dependabot cooldown

CI hardening (zizmor + pinact)

  • Pin all GitHub Actions to full commit SHAs via pinact
  • set-version action: write to $GITHUB_OUTPUT instead of $GITHUB_ENV to prevent env injection via crafted branch names
  • dependabot-auto-merge: replace pull_request_target with pull_request and drop unnecessary checkout step
  • release.yml: move permissions from workflow level to per-job scope; set workflow-level permissions: {}

Dependabot

  • Add cooldown.default-days: 7 (zizmor best practice) to npm and github-actions ecosystems
  • Add github-actions ecosystem tracking

skyrpex added 4 commits May 5, 2026 16:28
- Replace package-lock.json with pnpm-lock.yaml
- Add packageManager field to package.json
- Update CI workflows to use pnpm/action-setup and pnpm commands
- Add dependabot cooldown of 3 days and github-actions ecosystem
- Set npm.packageManager to pnpm in VS Code settings
@skyrpex skyrpex marked this pull request as draft May 5, 2026 14:33
skyrpex added 3 commits May 5, 2026 16:37
- set-version action: use GITHUB_OUTPUT instead of GITHUB_ENV to prevent
  env injection via crafted branch names
- dependabot-auto-merge: replace pull_request_target with pull_request and
  drop unnecessary checkout step
- release: move permissions from workflow level to per-job scope; lock
  workflow-level permissions to empty
@skyrpex skyrpex marked this pull request as ready for review May 5, 2026 14:44
@skyrpex skyrpex changed the title chore: migrate from npm to pnpm chore: harden repository security May 5, 2026
Copy link
Copy Markdown
Contributor

@anisaoshafi anisaoshafi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot Cristian for taking care of security 👏🏼 🔐

❓Shouldn't we also get rid of npx in favor of pnpm in these two publish jobs?

  • npx @vscode/vsce publish --packagePath *.vsix
  • npx ovsx publish *.vsix -p $OVSX_PAT

Comment thread .vscode/settings.json Outdated
Comment on lines +10 to +12
"js/ts.preferences.importModuleSpecifier": "shortest",
"js/ts.preferences.importModuleSpecifierEnding": "js",
"js/ts.preferences.preferTypeOnlyAutoImports": true,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why were some of these settings changed to js/ts format? are these js/ts ones valid vs code settings?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the previous values are deprecated and this is the correct new format. Maybe I should move these changes to a different PR

@skyrpex
Copy link
Copy Markdown
Contributor Author

skyrpex commented May 6, 2026

❓Shouldn't we also get rid of npx in favor of pnpm in these two publish jobs?

  • npx @vscode/vsce publish --packagePath *.vsix
  • npx ovsx publish *.vsix -p $OVSX_PAT

npx is still a good way to run binaries that aren't installed in the repo. Those two are good examples. There is an equivalent in pnpm: pnpm dlx, though. I'll change it.

@skyrpex skyrpex requested a review from anisaoshafi May 6, 2026 13:07
@skyrpex skyrpex enabled auto-merge (squash) May 6, 2026 13:08
Copy link
Copy Markdown
Contributor

@anisaoshafi anisaoshafi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks 🚀

@skyrpex skyrpex merged commit 125d9d6 into main May 6, 2026
8 checks passed
@skyrpex skyrpex deleted the chore/migrate-to-pnpm branch May 6, 2026 14:55
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.

2 participants