angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

webpack-dev-server vulnerability

Open markgoho opened this issue 7 years ago • 38 comments

Bug Report or Feature Request (mark with an x)

- [X] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
- [X] dependencies

Versions

node: 10.14.2 npm: 6.4.1

Angular CLI: 7.1.4
Node: 10.14.2
OS: win32 x64
Angular: 7.1.4
@angular-devkit/architect         0.10.7
@angular-devkit/build-angular     0.11.4
@angular-devkit/build-optimizer   0.11.4
@angular-devkit/build-webpack     0.10.7
@angular-devkit/core              7.0.7
@angular-devkit/schematics        7.1.4
@ngtools/webpack                  7.1.4
@schematics/angular               7.1.4
@schematics/update                0.11.4
rxjs                              6.3.3
typescript                        3.1.6
webpack                           4.19.1
--

Repro steps

npm install

The log given by the failure

=== npm audit security report ===                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Manual Review
Some vulnerabilities require your attention to resolve
Visit https://go.npm.me/audit-guide for additional guidance
High            Missing Origin Validation
Package         webpack-dev-server
Patched in      >=3.1.11
Dependency of   @angular-devkit/build-angular [dev]
Path            @angular-devkit/build-angular > webpack-dev-server
More info       https://nodesecurity.io/advisories/725
found 1 high severity vulnerability in 78596 scanned packages
1 vulnerability requires manual review. See the full report for details.
--

https://nodesecurity.io/advisories/725

markgoho avatar Jan 02 '19 02:01 markgoho

I guess it will be fixed in next release https://github.com/angular/angular-cli/pull/13277

L2jLiga avatar Jan 02 '19 06:01 L2jLiga

I’ll back port the fix to the patch branch later on today

alan-agius4 avatar Jan 02 '19 08:01 alan-agius4

updating to version 3.1.14 may not work, as per https://github.com/webpack/webpack-dev-server/issues/1615

charlesfaustin avatar Jan 02 '19 10:01 charlesfaustin

Actually, upgrading to 3.1.14 might work, if the typo in the vulnerability database had been fixed: https://npm.community/t/npm-audit-sweems-to-get-semver-wrong/4352/4

Diaan avatar Jan 02 '19 11:01 Diaan

Thanks @Diaan for your input.

alan-agius4 avatar Jan 02 '19 11:01 alan-agius4

I am also getting the Missing Origin Validation vulnerability.

Steps to reproduce:

npm uninstall -g @angular/cli
npm cache verify

npm install -g @angular/cli
npm cache verify

cd c:\src
c:\src>ng new spa

? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? SCSS   [ http://sass-lang.com   ]

added 1133 packages from 1180 contributors and audited 40178 packages in 41.531s found 1 high severity vulnerability

c:\src >cd spa
c:\src\spa>npm audit
                  === npm audit security report ===
                            Manual Review
       Some vulnerabilities require your attention to resolve
   Visit https://go.npm.me/audit-guide for additional guidance

High Missing Origin Validation Package webpack-dev-server Patched in >=3.1.11 Dependency of @angular-devkit/build-angular [dev] Path @angular-devkit/build-angular > webpack-dev-server More info https://nodesecurity.io/advisories/725

found 1 high severity vulnerability in 40178 scanned packages 1 vulnerability requires manual review. See the full report for details.

c:\src\spa>npm audit fix

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

up to date in 5.196s fixed 0 of 1 vulnerability in 40178 scanned packages 1 vulnerability required manual review and could not be updated

c:\src\spa>npm install webpack-dev-server --save-dev

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

  • [email protected] added 39 packages from 17 contributors, updated 4 packages and audited 43619 packages in 10.377s found 1 high severity vulnerability run npm audit fix to fix them, or npm audit for details
c:\src\spa>npm audit
                  === npm audit security report ===
                            Manual Review
       Some vulnerabilities require your attention to resolve
     Visit https://go.npm.me/audit-guide for additional guidance

High Missing Origin Validation Package webpack-dev-server Patched in >=3.1.11 Dependency of @angular-devkit/build-angular [dev] Path @angular-devkit/build-angular > webpack-dev-server More info https://nodesecurity.io/advisories/725

found 1 high severity vulnerability in 43619 scanned packages 1 vulnerability requires manual review. See the full report for details.

c:\src\spa>ng update

We analyzed your package.json and everything seems to be in order. Good work!

Notice the different webpack and webpack-dev-server dependencies:

C:\src\spa\node_modules@angular-devkit\build-angular\package.json

{
  "_from": "@angular-devkit/build-angular@~0.11.0",
  "_id": "@angular-devkit/[email protected]",
  "dependencies": {
    "webpack": "4.23.1",
    "webpack-dev-server": "3.1.10",
  },
}

C:\src\spa\node_modules@angular-devkit\build-webpack\package.json

{
  "_from": "@angular-devkit/[email protected]",
  "_id": "@angular-devkit/[email protected]",
  "peerDependencies": {
    "webpack": "^4.6.0",
    "webpack-dev-server": "^3.1.4"
  },
}

C:\src\spa\node_modules\webpack-dev-server\package.json

{
  "_from": "[email protected]",
  "_id": "[email protected]",
  "peerDependencies": {
    "webpack": "^4.0.0"
  },
}

[https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/build_angular/package.json] (updated 7 days ago)

{
  "name": "@angular-devkit/build-angular",
  "dependencies": {
    "webpack-dev-server": "3.1.14"
  },
}

[https://www.npmjs.com/package/@angular-devkit/build-angular] (published 14 days ago)

Do you have an ETA for updating the npm package?

cref: https://nodesecurity.io/advisories/725 https://npm.community/t/npm-audit-sweems-to-get-semver-wrong/4352/9 https://github.com/facebook/create-react-app/issues/6109

RandyDaddis avatar Jan 03 '19 02:01 RandyDaddis

Am getting this same error.

` npm audit === npm audit security report ===

                             Manual Review
         Some vulnerabilities require your attention to resolve

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

High Missing Origin Validation Package webpack-dev-server Patched in >=3.1.11 Dependency of @angular-devkit/build-angular Path @angular-devkit/build-angular > webpack-dev-server More info https://nodesecurity.io/advisories/725`

please let me know if there any patch update for the devkit or it transient webpack

Rajsekar89 avatar Jan 03 '19 13:01 Rajsekar89

@alan-agius4 I am really surprised that this isn't being addressed quicker.

It impacts every single person using @angular-devkit/build-angular The frequency isn't low, it is high. While it may be a false positive in terms of the actual security risk (just a typo), it is clearly an issue for those trying use npm audit in their build pipeline.

mjknight50 avatar Jan 04 '19 21:01 mjknight50

Just coming in late to this thread.

It impacts every single person using @angular-devkit/build-angular

If I read the vulnerability correctly, it only affects people doing HMR, and having a server listening on something too permissive (we default to localhost), right? This is far from "every single person".

That being said, we should still fix it. In general though, I would avoid hyperboles when it comes to security. NPM audit is known to be crying wolf a bit.

hansl avatar Jan 04 '19 23:01 hansl

@hansl npm audit throws a big red flag for anyone who installs @angular-devkit/build-angular

 npm install @angular-devkit/build-angular
+ @angular-devkit/[email protected]
found 1 high severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details

After reading the details of what is presumed to be the issue, a typo, I agree and stated in my post that from a security perspective it isn't a huge deal (in an effort to avoid hyperbole), but it took me some digging to make that determination myself. Wouldn't you want a clean install of @angular-devkit/build-angular ?

So, yes, it is every single person that installs @angular-devkit/build-angular will see that audit error. We can debate the validity of npm audit but the high severity vulnerability message displays to everyone.

Feel free to correct me if I am wrong.

mjknight50 avatar Jan 05 '19 15:01 mjknight50

+1

ShahanaFarooqui avatar Jan 05 '19 17:01 ShahanaFarooqui

@hansl I get this alert now in 5 of my angular project. This PR and comment provides information on likely fix "next Wednesday" https://github.com/angular/angular-cli/pull/13347#issuecomment-451145500

peterennis avatar Jan 05 '19 20:01 peterennis

@mjknight50, Yes, we do agree that this should be addressed, and as a mater of fact there is a PR in the merge queue and it will be released earlier next week.

While the audit message is shown to everybody the vulnerability itself only impacts a small group of people, and hence cutting a release late in the week for this week had a small benefit with a high risk.

alan-agius4 avatar Jan 06 '19 09:01 alan-agius4

+1 waiting for fix

austenstone avatar Jan 06 '19 21:01 austenstone

+1 waiting for fix

paul58914080 avatar Jan 06 '19 23:01 paul58914080

The problem is that everybody who sees this error and cares about his projects has to spend the time to find out what's going on. Took me "only" 20..30 minutes, but could be better spent.

Knacktus avatar Jan 07 '19 07:01 Knacktus

+1 waiting for fix

jcollard avatar Jan 08 '19 18:01 jcollard

+1 waiting for fix

ohager avatar Jan 08 '19 20:01 ohager

Spamming „+1 waiting for fix“ does not speed up the process 🤨

Atomzwieback avatar Jan 08 '19 20:01 Atomzwieback

But adding +1 might increase your bug frequency label from 'low' to 'high' :)

ShahanaFarooqui avatar Jan 08 '19 20:01 ShahanaFarooqui