Repository navigation
Keep registry URLs out of npm lockfiles - #2719
Merged
DariuszPorowski merged 1 commit intoOct 28, 2026
Merged
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the lockfile registry URL cleanup and validation changes.
No open issues 🎉
3 files not reviewed
playwright/package-lock.json: Generated filesamples/dapr/nodeapp/package-lock.json: Generated filesamples/demo/client/package-lock.json: Generated file
What changed in this PR
This PR helps prevent private npm registry URLs from entering lockfiles, avoiding the Dependabot authentication failures and upmerge conflicts seen in earlier updates.
Changes:
- Adds project-level npm settings to omit registry download URLs from lockfiles.
- Removes existing
resolvedURLs while preserving package versions and integrity hashes. - Adds validation for non-npmjs HTTP(S) download hosts and Azure Artifacts feed references, running on pull requests and pushes targeting
edgeandv*.
| File | Description |
|---|---|
samples/demo/client/package-lock.json |
Removes registry download URLs from client dependencies. |
samples/demo/client/.npmrc |
Enables URL omission for the demo client. |
samples/demo/.npmrc |
Enables URL omission for the demo server. |
samples/dapr/nodeapp/package-lock.json |
Removes registry download URLs from Dapr sample dependencies. |
samples/dapr/nodeapp/.npmrc |
Enables URL omission for the Dapr Node.js sample. |
playwright/package-lock.json |
Removes registry download URLs from test dependencies. |
playwright/.npmrc |
Enables URL omission for the Playwright project. |
.github/workflows/validate-lockfiles.yaml |
Runs lockfile validation in CI. |
.github/scripts/validate_lockfiles.py |
Checks tracked lockfiles for disallowed registry references. |
Review effort: Balanced
nicolejms
previously approved these changes
Oct 27, 2026
DariuszPorowski
requested changes
Oct 27, 2026
DariuszPorowski
left a comment
Member
There was a problem hiding this comment.
I think now we should target 0.62/edge - 0.61 is not relevant anymore
Add an .npmrc with omit-lockfile-registry-resolved=true next to each npm project so npm stops writing the registry download URL into package-lock.json. Lockfiles then don't depend on whichever registry the author installed from, and installs use the configured registry. Regenerate each lockfile with npm install --package-lock-only. The only change is the removal of the resolved lines; package versions and integrity hashes are unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
kachawla
force-pushed
the
kachawla-npm-lockfile-omit-registry-resolved
branch
from
October 27, 2026 21:57
6a803b0 to
0be4e95
Compare
Member
Author
@DariuszPorowski updated |
DariuszPorowski
approved these changes
Oct 28, 2026
DariuszPorowski
deleted the
kachawla-npm-lockfile-omit-registry-resolved
branch
October 28, 2026 04:24
This was referenced Oct 28, 2026
Merged
DariuszPorowski
pushed a commit
to radius-project/bicep-types-aws
that referenced
this pull request
Oct 29, 2026
## Summary Adds `src/aws-type-generator/.npmrc` with `omit-lockfile-registry-resolved=true` and regenerates `package-lock.json` once so it no longer stores registry download URLs. ## Reason for change npm writes each package's full download URL into the lockfile's `resolved` fields, using whatever registry the author installed from. If someone runs `npm install` against a private mirror, those mirror URLs get committed. That happened in radius-project/samples#2698, which committed 214 private registry URLs. It broke Dependabot (`private_source_authentication_failure`) and an upmerge, and took radius-project/samples#2709, radius-project/samples#2710, and radius-project/samples#2713 to clean up by hand. [`omit-lockfile-registry-resolved`](https://docs.npmjs.com/cli/v10/using-npm/config#omit-lockfile-registry-resolved) tells npm to leave out the `resolved` key for registry dependencies. Versions and `integrity` hashes stay, and npm resolves packages from whatever registry is configured at install time. Non-registry entries keep their `resolved` value, so the `bicep-types` file link is unchanged. This lockfile only has public registry URLs today, so this is preventive. It mirrors radius-project/samples#2719. The one-time lockfile change removes 377 `resolved` lines and nothing else: no version or integrity changes. ## How to test 1. Check the lockfile diff is only `resolved` removals: ```bash git show origin/main:src/aws-type-generator/package-lock.json > /tmp/before.json diff <(jq -S 'del(.. | .resolved?)' /tmp/before.json) <(jq -S . src/aws-type-generator/package-lock.json) ``` Expected: no output. 2. Install and test the way CI does: ```bash git submodule update --init --recursive (cd bicep-types/src/bicep-types && npm ci && npm run build) cd src/aws-type-generator && npm ci && npm run build && npm test ``` Expected: install succeeds, tests pass, and `package-lock.json` is not modified. 3. Run `npm install` in `src/aws-type-generator` after a dependency change. Expected: no `resolved` fields are added for registry packages. ## File change summary | File | Summary of change | | ---- | ----------------- | | `src/aws-type-generator/.npmrc` | New. Sets `omit-lockfile-registry-resolved=true`. | | `src/aws-type-generator/package-lock.json` | Regenerated. Removes 377 registry `resolved` URLs; no other changes. | Signed-off-by: Karishma Chawla <kachawla@microsoft.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This was referenced Nov 3, 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.
Summary
Stop npm from writing registry download URLs into
package-lock.json, and regenerate the lockfiles once without them.Reason for change
npm records each package's full download URL in the lockfile
resolvedfield, using whatever registry the author installed from. When someone installs through a private registry, those URLs get committed. #2698 landed 214 of them onv0.61. That broke Dependabot (private_source_authentication_failure) and the upmerge toedge, and it took #2709, #2710, and #2713 to clean up by hand.This PR sets npm's
omit-lockfile-registry-resolvedoption, which makes npm create lockfiles without aresolvedkey for registry dependencies. Package versions andintegrityhashes are still recorded, so installs stay pinned and verified. npm fetches each package from whatever registry is configured at install time.npm reads
.npmrcper project, so the file goes next to eachpackage.jsonrather than at the repo root. It only sets this option. It does not setregistry.Dependabot behavior with the setting will be confirmed on the next Dependabot run after this merges. #2720 adds a CI check that fails on non-npmjs registry URLs in lockfiles.
How to test
resolvedlines are removed (644 total). Package names, versions, andintegrityvalues are identical before and after for every lockfile. Regenerated withnpm install --package-lock-only(npm 11) from each project folder.npm ciinplaywright/passes. TheBuild samplesworkflow on this PR runs the Docker builds forsamples/demo/andsamples/dapr/nodeapp/, which runnpm ci/npm installagainst registry.npmjs.org.File change summary
playwright/.npmrc,samples/demo/.npmrc,samples/demo/client/.npmrc,samples/dapr/nodeapp/.npmrcomit-lockfile-registry-resolved=true.playwright/package-lock.json,samples/demo/package-lock.json,samples/demo/client/package-lock.json,samples/dapr/nodeapp/package-lock.jsonresolvedlines removed, nothing else changed.