Skip to content

Adds lock file linting to flows running with every PR. Closes #775 - #861

Draft
Adam-it wants to merge 2 commits into
pnp:mainfrom
Adam-it:adds-lock-file-linter-step
Draft

Adds lock file linting to flows running with every PR. Closes #775#861
Adam-it wants to merge 2 commits into
pnp:mainfrom
Adam-it:adds-lock-file-linter-step

Conversation

@Adam-it

@Adam-it Adam-it commented Aug 1, 2026

Copy link
Copy Markdown
Member

🎯 Aim

The aim of this PR is to add a lint step for npm dependencies present in the lock file to every workflow which we run for PRs so that we try to shield ourselves from hacky updates done directly in the lock file in the PR that update the package hash to a vulnerable repo or package

📷 Result

{BEBE85F3-B9E1-4D28-B920-EC5A5F073613}

✅ What was done

  • Adds a new dev dependency lockfile-lint to use it in the pipeline
  • Updated the check tests workflow which is the only flow we run for every open PR and added step to lint lock file

🔗 Related issue

Closes #775

@nicodecleyre nicodecleyre self-assigned this Aug 2, 2026

@nicodecleyre nicodecleyre left a comment

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.

Great work so far, can you check the comments i left? Thank you!

npm_config_omit: optional

- name: Validate lockfile for SPFx Toolkit
run: .\node_modules\.bin\lockfile-lint --path npm-shrinkwrap.json --type npm --allowed-hosts npm --validate-https

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.

Would you consider adding --validate-integrity and --validate-package-names to the lockfile-lint command? The current flags cover host and protocol validation, but the scenario described in the aim, a lockfile edit that swaps the package hash to a vulnerable repo or package, is specifically caught by --validate-integrity. --validate-package-names would additionally cover typosquatting or name mismatches between package.json and the lockfile.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

good comment. lets do that 👍, will do that

Comment thread package.json
"@tailwindcss/postcss": "4.1.4",
"@types/glob": "8.1.0",
"@types/mocha": "10.0.10",
"@types/node-forge": "^1.3.11",

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.

Also noticed unrelated dependency changes (@types/node-forge. Removal of @types/sinon, @types/vscode, @typescript-eslint-plugin. Version swap on rehype-raw, remark-gfm, use-debounce). Were these intentional, or can they be split out of this PR since they're not needed for the lockfile-lint change?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@nicodecleyre TBH those changes were just done 'automagically' after npm install. those are the same packages in the same versions just places in different order in the package.json. Not sure if the lint or npm install reoder this part 🙂.
I may revert to previous order but still nothing changed even now as the versions are the same

Copilot AI left a comment

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.

Pull request overview

Adds CI validation of the npm shrinkwrap to reduce the risk of lockfile injection in PRs for this VS Code extension (SPFx Toolkit), aligning with the security goal in #775.

Changes:

  • Adds lockfile-lint as a dev dependency and updates npm-shrinkwrap.json accordingly.
  • Updates the PR test workflow to run a lockfile validation step.
  • Minor dependency list reordering/cleanup in package.json.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
package.json Adds lockfile-lint to devDependencies (plus minor ordering changes).
npm-shrinkwrap.json Updates shrinkwrap to include lockfile-lint and its transitive dependencies.
.github/workflows/check-tests.yml Adds a lockfile validation step to the PR test workflow.
Files not reviewed (1)
  • npm-shrinkwrap.json: Generated file

Comment thread .github/workflows/check-tests.yml
Comment thread package.json
Comment thread npm-shrinkwrap.json
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.

Prevent npm lockfile injection

3 participants