Bagaimana cara memperbaiki kerentanan ini? (npm perbaikan audit gagal untuk memperbaiki kerentanan ini)

9

Proyek saya memiliki 6 kerentanan tingkat keparahan tinggi dan saya tidak tahu bagaimana cara memperbaikinya. perbaikan audit npm gagal. Tolong bantu saya untuk memperbaiki ini.

Saya menginstal https://www.npmjs.com/package/toastr ke proyek saya dan setelah itu menginstal kerentanan ditampilkan. Saya tidak tahu apakah ada hubungannya. === npm laporan keamanan audit ===

                             Manual Review                                  
         Some vulnerabilities require your attention to resolve             

      Visit https://go.npm.me/audit-guide for additional guidance           


High            Machine-In-The-Middle                                         

Package         https-proxy-agent                                             

Patched in      >=3.0.0                                                       

Dependency of   @angular/cli [dev]                                            

Path            @angular/cli > @schematics/update > pacote >                  
                make-fetch-happen > https-proxy-agent                         

More info       https://npmjs.com/advisories/1184                             
High            Machine-In-The-Middle                                         

Package         https-proxy-agent                                             

Patched in      >=3.0.0                                                       

Dependency of   @angular/cli [dev]                                            

Path            @angular/cli > pacote > make-fetch-happen >                   
                https-proxy-agent                                             

More info       https://npmjs.com/advisories/1184                             
High            Machine-In-The-Middle                                         

Package         https-proxy-agent                                             

Patched in      >=3.0.0                                                       

Dependency of   @angular/cli [dev]                                            

Path            @angular/cli > @schematics/update > pacote >                  
                npm-registry-fetch > make-fetch-happen > https-proxy-agent    

More info       https://npmjs.com/advisories/1184                             
High            Machine-In-The-Middle                                         

Package         https-proxy-agent                                             

Patched in      >=3.0.0                                                       

Dependency of   @angular/cli [dev]                                            

Path            @angular/cli > pacote > npm-registry-fetch >                  
                make-fetch-happen > https-proxy-agent                         

More info       https://npmjs.com/advisories/1184                             
High            Machine-In-The-Middle                                         

Package         https-proxy-agent                                             

Patched in      >=3.0.0                                                       

Dependency of   protractor [dev]                                              

Path            protractor > browserstack > https-proxy-agent                 

More info       https://npmjs.com/advisories/1184                             
High            Machine-In-The-Middle                                         

Package         https-proxy-agent                                             

Patched in      >=3.0.0                                                       

Dependency of   protractor [dev]                                              

Path            protractor > saucelabs > https-proxy-agent                    

More info       https://npmjs.com/advisories/1184

sumber

Jawaban:

10

1) npm i --save-dev npm-force-resolusi

2) Tambahkan ini ke package.json Anda

"resolusi": {"https-proxy-agent": "^ 3.0.0"}

3) Biarkan npm-force-resolusi melakukan itu

rm -r node_modules
npx npm-force-resolutions
npm install

4) jalankan kembali audit Anda, audit npm.

Fon: https://github.com/TooTallNate/node-https-proxy-agent/issues/84#issuecomment-543884972

José Luiz Gonzaga Neto
sumber
1
Solusi ini hanya berfungsi untuk beberapa waktu dan sekali lagi masalah yang sama muncul
2

Memperbaiki masalah BUILD dan masalah instalasi umum:

package.json

{
  ...
  "scripts": {
     "resolve-install": "npx npm-force-resolutions && npm install"
  },
  "resolutions": {
    "https-proxy-agent": "^3.0.0"
  }
}

Maka alih-alih npm installjalankan saja di cmdatau Dockerfile:

npm run resolve-install
Kevin Upton
sumber