Skip to content

[Snyk] Fix for 3 vulnerabilities#43

Open
Mapuppy09 wants to merge 868 commits intofritzy/linked-install2from
snyk-fix-3f9ac0b4e22c896de467fc54ddca73e4
Open

[Snyk] Fix for 3 vulnerabilities#43
Mapuppy09 wants to merge 868 commits intofritzy/linked-install2from
snyk-fix-3f9ac0b4e22c896de467fc54ddca73e4

Conversation

@Mapuppy09
Copy link
Owner

snyk-top-banner

Snyk has created this PR to fix 3 vulnerabilities in the npm dependencies of this project.

Snyk changed the following file(s):

  • package.json
⚠️ Warning
Failed to update the package-lock.json, please update manually before merging.

Vulnerabilities that will be fixed with an upgrade:

Issue Score
high severity Regular Expression Denial of Service (ReDoS)
SNYK-JS-CROSSSPAWN-8303230
  756  
high severity Command Injection
SNYK-JS-GLOB-14040952
  706  
low severity Regular Expression Denial of Service (ReDoS)
SNYK-JS-BRACEEXPANSION-9789073
  436  

Important

  • Check the changes in this PR to ensure they won't cause issues with your project.
  • Max score is 1000. Note that the real score may have changed since the PR was raised.
  • This PR was automatically created by Snyk using the credentials of a real user.

Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open fix PRs.

For more information:
🧐 View latest project report
📜 Customise PR templates
🛠 Adjust project settings
📚 Read about Snyk's upgrade logic


Learn how to fix vulnerabilities with free interactive lessons:

🦉 Regular Expression Denial of Service (ReDoS)
🦉 Command Injection

lukekarrys and others added 30 commits April 2, 2024 05:38
deps: init-package-json@6.0.2

deps: promzard@1.0.1
The ISO 8601 references is broken broken due to `"` appended at the end.
…ier (npm#7346)

There are a bunch of places were we load `semver`, I'm trying to see if
I can remove the full import for `semver` and only import the specific
functions.

Currently, I didn't have any perf improvement since we still load the
entire `semver`, once we have removed all the package loads, then we
could see some improvement (a little bit).
This PR addresses an issue where CLI flags were not taking precedence
over publishConfig settings. To ensure CLI flags have higher priority,
properties from the publishConfig object that also exist in CLI flags
are filtered out.


  Related to npm#6400
Lazy loading `workspaces` and `glob` dependencies, will avoid loading
the dependency when running inside a repo that is not a workspace and
also will not load `glob` when is not needed.

Before:


![image](https://github.com/npm/cli/assets/12551007/5d8d50f3-d855-4d00-964d-b6b0526361b0)

After:


![image](https://github.com/npm/cli/assets/12551007/75744909-0fcb-43cc-9986-ff68bc46a078)
…pm#7360)

If we didn't load `glob`, we can save up to `6ms` by lazy loading this
module.
This adds some lazy loading, inlines some single use functions, and also
removes the "define" function in the definitions file.  That was
guarding against something that isn't worth the runtime to check for.
I missed these calls when first moving to `@npmcli/redact`. This isn't a
performance specific PR but I assume it will help since there are now a
few places where we no longer need to require `npm-registry-fetch` at
all.
wraithgar and others added 29 commits May 30, 2024 08:50
…npm#7582)

Small doc fix. Reviewing the section on `funding` on docs.npmjs.com, I
noticed some odd code-block formatting, as well as some opportunities to
clarify.

The current weirdness:


![2024-06-02-214100_3840x2160_scrot](https://github.com/npm/cli/assets/205760/5f0a436f-5812-4a97-b4b9-b4183219d4dd)

Glad to see string-or-object worked out.
…bally (npm#7587)

When multiple version of the same package is exist globally either at
top level or at any level as a sub dependency, even though the version
specified does not exist at top level it was running top level bin since
it matches the bin name.
This fixes checks for depth of the found node along with already
existing specs checks.

Fixes: npm#7486
- closes npm#7614

## Issue

Examples in the
[repository](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository)
section of the [npm CI > Configuring npm >
package.json](https://docs.npmjs.com/cli/v10/configuring-npm/package-json)
reference page use the protocol `https`. The examples are:

```json
"url": "https://github.com/npm/cli.git"
```
```json
"url": "https://github.com/facebook/react.git"
```

Executing `npm pkg fix` in a repo with a `url` definition and `protocol`
using `https` normalizes the protocol to `git+https`.

Examples should be aligned with what `npm pkg fix` considers correct and
should also be aligned to the list of valid protocols in the [Git URLs
as
Dependencies](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#git-urls-as-dependencies)
section, which states:

> `<protocol>` is one of `git`, `git+ssh`, `git+http`, `git+https`, or
`git+file`.

## Change

1. `npm/cli.git`
    Change to
    ```json
    "url": "git+https://github.com/npm/cli.git"
    ```
2. `facebook/react.git`
Since the source example of
https://github.com/facebook/react/blob/main/packages/react-dom/package.json
does not use the correct `git+https` protocol, use instead
    ```json
    "url": "git+https://github.com/npm/cli.git",
    "directory": "workspaces/libnpmpublish"
    ```
…pm#7602)

When metadata is committed for the first time when there is no
package-lock, when target node has the same name field value as target
package name and link node also share the same name field, name field is
omitted from lock file, in subsequent times when there is already a lock
file, it reads target node with name field derived from realpath value
of the node and included in lock file. this creates mismatch of lock
file between installs.

This PR adds additional condition to check if name derived from realpath
is the same name as package and adds the name property.

Fixes: npm#7166
It has historically not worked very consistently and we don't have the
bandwidth to keep fixing it.
…npm#7579)

<!-- What / Why -->
If a node represents a symbolic link or a file dep (node.isLink is
true), its target is expected to reference another node in the
dependency tree. If the linking is not done correctly or is incomplete,
node.target might be null.
<!-- Describe the request in detail. What it does and why it's being
changed. -->
in this PR, a null check is added to ensure node.target is not null or
before proceeding, which will prevent causing errors like:
`npm error Cannot set properties of null (setting 'peer')` 

## References
  Related to npm#7065, 
  Fixes npm#6622, npm#5007,
  Closes npm#6622, npm#5007
This change solves npm#4783

<!-- What / Why -->
<!-- Describe the request in detail. What it does and why it's being
changed. -->
During 'npm cache verify', currently all the cache files are open at the
same time, which will bring EMFILE error in an environment that limit
max open files.
This change limits the concurrent open files in garbageCollect() with
p-map module to avoid this problem.

## References
  Fixes npm#4783
…#7640)

Handle arborist error when loading and checking package in global tree.
@Mapuppy09 Mapuppy09 changed the base branch from latest to fritzy/linked-install2 March 12, 2026 05:22
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.