Security
Headlines
HeadlinesLatestCVEs

Headline

CVE-2021-43616: npm-ci | npm Docs

** DISPUTED ** The npm ci command in npm 7.x and 8.x through 8.1.3 proceeds with an installation even if dependency information in package-lock.json differs from package.json. This behavior is inconsistent with the documentation, and makes it easier for attackers to install malware that was supposed to have been blocked by an exact version match requirement in package-lock.json. NOTE: The npm team believes this is not a vulnerability. It would require someone to socially engineer package.json which has different dependencies than package-lock.json. That user would have to have file system or write access to change dependencies. The npm team states preventing malicious actors from socially engineering or gaining file system access is outside the scope of the npm CLI.

CVE
#vulnerability#windows#nodejs#js

Table of contents

  • Synopsis
  • Description
  • Example
  • Configuration
    • audit
    • ignore-scripts
    • script-shell
  • See Also

Synopsis****Description

This command is similar to npm install, except it’s meant to be used in automated environments such as test platforms, continuous integration, and deployment – or any situation where you want to make sure you’re doing a clean install of your dependencies.

npm ci will be significantly faster when:

  • There is a package-lock.json or npm-shrinkwrap.json file.
  • The node_modules folder is missing or empty.

In short, the main differences between using npm install and npm ci are:

  • The project must have an existing package-lock.json or npm-shrinkwrap.json.
  • If dependencies in the package lock do not match those in package.json, npm ci will exit with an error, instead of updating the package lock.
  • npm ci can only install entire projects at a time: individual dependencies cannot be added with this command.
  • If a node_modules is already present, it will be automatically removed before npm ci begins its install.
  • It will never write to package.json or any of the package-locks: installs are essentially frozen.

Example

Make sure you have a package-lock and an up-to-date install:

$ cd ./my/npm/project

$ npm install

added 154 packages in 10s

$ ls | grep package-lock

Run npm ci in that project

$ npm ci

added 154 packages in 5s

Configure Travis to build using npm ci instead of npm install:

install:

- npm ci

cache:

directories:

  • “$HOME/.npm”

Configuration****audit

  • Default: true
  • Type: Boolean

When “true” submit audit reports alongside the current npm command to the default registry and all registries configured for scopes. See the documentation for npm audit for details on what is submitted.

ignore-scripts

  • Default: false
  • Type: Boolean

If true, npm does not run scripts specified in package.json files.

Note that commands explicitly intended to run a particular script, such as npm start, npm stop, npm restart, npm test, and npm run-script will still run their intended script if ignore-scripts is set, but they will not run any pre- or post-scripts.

script-shell

  • Default: ‘/bin/sh’ on POSIX systems, ‘cmd.exe’ on Windows
  • Type: null or String

The shell to use for scripts run with the npm exec, npm run and npm init <pkg> commands.

See Also

  • npm install
  • package-lock.json

Related news

RHSA-2022:4796: Red Hat Security Advisory: nodejs:16 security update

An update for the nodejs:16 module is now available for Red Hat Enterprise Linux 8. Red Hat Product Security has rated this update as having a security impact of Important. A Common Vulnerability Scoring System (CVSS) base score, which gives a detailed severity rating, is available for each vulnerability from the CVE link(s) in the References section.This content is licensed under the Creative Commons Attribution 4.0 International License (https://creativecommons.org/licenses/by/4.0/). If you distribute this content, or a modified version of it, you must provide attribution to Red Hat Inc. and provide a link to the original. Related CVEs: * CVE-2021-43616: npm: npm ci succeeds when package-lock.json doesn't match package.json

CVE: Latest News

CVE-2023-50976: Transactions API Authorization by oleiman · Pull Request #14969 · redpanda-data/redpanda
CVE-2023-6905
CVE-2023-6903
CVE-2023-6904
CVE-2023-3907