Secure npm dependencies and update packages#1247
Open
microbit-grace wants to merge 6 commits into
Open
Conversation
.npmrc (new file) — the security block from ml-trainer PR #921, with the exclude scopes adapted to this repo (@microbit/* and @microbit-foundation/*): - min-release-age=7 — 7-day cooldown before installing newly-published versions (supply-chain protection), excluding your own scopes - allow-git/remote/file/directory=root — blocks transitive deps from non-registry sources - strict-allow-scripts=true — every dependency lifecycle script must be explicitly allowed - engine-strict=true — enforces the engines versions package.json: - engines: node >=24.0.0, npm >=11.18.0 (was >=24.0 / >=10.0) - Added allowScripts allowlist. Unlike ml-trainer, this repo's only install-script dependencies are esbuild and fsevents (I parsed hasInstallScript from your lockfile — none of ml-trainer's packages like better-sqlite3/core-js/@sentry/capacitor exist here), so: "allowScripts": { "esbuild": true, "fsevents": true } .github/workflows/build.yml — added npm install -g npm@11 --registry=https://registry.npmjs.org right after setup-node, before npm ci (matches the PR; your checkout@v6, setup-node@v6, upload-artifact@v7 are already current). The pr-url.yml workflow has no npm steps, so it's untouched.
The npm update bumped several packages with stricter or changed type definitions. Resolve the resulting tsc errors: - lunr / @types/lunr: the global `declare namespace lunr` augmentation no longer merges into the imported binding, and @types/lunr's `export =` cannot be module-augmented. Describe the multiLanguage and per-language plugins that lunr-languages attaches at runtime via a `LunrWithLanguages` type and cast at the call sites instead. - @codemirror/view: ViewPlugin.extension now resolves to `null` unless the `Arg` type param is `undefined`. Pin `ViewPlugin.fromClass<...>` so the drag-and-drop decorations plugin is treated as an Extension again. - vscode-languageserver-protocol: Diagnostic.message is now `string | MarkupContent`; extract the string. SignatureHelp's activeParameter can be `null`; widen the guard to `!= null`. - vscode-jsonrpc: bump the direct dependency to ^9 to dedupe against vscode-languageserver-protocol@3.18, fixing the duplicate MessageConnection type mismatch in pyright.ts. - vitest 4: the async `rejects` matcher dropped `toThrowError`; use `toThrow`.
…3 into npm-update
Collaborator
|
The .npmrc parts of this all look good. The lock file changes upgrade CodeMirror through quite a few minor versions at once. I think we need to do a manual testing pass for this to build confidence. Suggested areas:
|
Collaborator
|
Branch: https://review-python-editor-v3.microbit.org/npm-update/ Not sure why no PR link. |
Collaborator
Collaborator
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.



Security hardening
Dependency update + type fixes
npm update bumped several packages with stricter/changed types. Fixes:
Test config
CI (build.yml)