Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Changing package.json to use concat-stream "^2.0.0" and tap "^12.5.3"…#1899

Open
infintesimal wants to merge 3 commits into
browserify:masterbrowserify/browserify:masterfrom
infintesimal:masterinfintesimal/browserify:masterCopy head branch name to clipboard
Open

Changing package.json to use concat-stream "^2.0.0" and tap "^12.5.3"…#1899
infintesimal wants to merge 3 commits into
browserify:masterbrowserify/browserify:masterfrom
infintesimal:masterinfintesimal/browserify:masterCopy head branch name to clipboard

Conversation

@infintesimal

@infintesimal infintesimal commented Mar 1, 2019

Copy link
Copy Markdown

… to remove npm audit security warngings; updating tests to use Buffer.from() where appropriate to remove deprecation warnings in tests

Fixes #1900.

… to remove npm audit security warngings; updating tests to use Buffer.from() where appropriate to remove deprecation warnings in tests
Comment thread package.json Outdated
"buffer": "^5.0.2",
"cached-path-relative": "^1.0.0",
"concat-stream": "^1.6.0",
"concat-stream": "^2.0.0",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the breaking change here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point; I have been cleansing a lot of npm code and this change probably came on the heels of another package I updated to 2.0.0. IMO it's no harm, no foul to keep it at 1.6.0; and it's no-harm, no foul to tick it up. I am resubmitting a PR without the concat-stream 2.0.0

Comment thread package.json Outdated
"semver": "^5.5.0",
"seq": "0.3.5",
"tap": "^10.7.2",
"tap": "^12.5.3",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the breaking changes here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npm audit kicks off a notice of 15 vulnerabilities, see

infintesimal@hishost:~/bw$ npm audit --parseable
install	handlebars	high	npm install --save-dev tap@12.5.3	Prototype Pollution	https://npmjs.com/advisories/755	tap>nyc>istanbul-reports>handlebars	Y
install	hoek	moderate	npm install --save-dev tap@12.5.3	Prototype Pollution	https://npmjs.com/advisories/566	tap>coveralls>request>hawk>boom>hoek	Y
install	hoek	moderate	npm install --save-dev tap@12.5.3	Prototype Pollution	https://npmjs.com/advisories/566	tap>coveralls>request>hawk>cryptiles>boom>hoek	Y
install	hoek	moderate	npm install --save-dev tap@12.5.3	Prototype Pollution	https://npmjs.com/advisories/566	tap>coveralls>request>hawk>hoek	Y
install	hoek	moderate	npm install --save-dev tap@12.5.3	Prototype Pollution	https://npmjs.com/advisories/566	tap>coveralls>request>hawk>sntp>hoek	Y
install	tunnel-agent	moderate	npm install --save-dev tap@12.5.3	Memory Exposure	https://npmjs.com/advisories/598	tap>coveralls>request>tunnel-agent	Y
install	lodash	moderate	npm install --save-dev tap@12.5.3	Prototype Pollution	https://npmjs.com/advisories/782	tap>nyc>istanbul-lib-instrument>babel-generator>babel-types>lodash	Y
install	lodash	moderate	npm install --save-dev tap@12.5.3	Prototype Pollution	https://npmjs.com/advisories/782	tap>nyc>istanbul-lib-instrument>babel-generator>lodash	Y
install	lodash	moderate	npm install --save-dev tap@12.5.3	Prototype Pollution	https://npmjs.com/advisories/782	tap>nyc>istanbul-lib-instrument>babel-template>babel-traverse>babel-types>lodash	Y
install	lodash	moderate	npm install --save-dev tap@12.5.3	Prototype Pollution	https://npmjs.com/advisories/782	tap>nyc>istanbul-lib-instrument>babel-template>babel-traverse>lodash	Y
install	lodash	moderate	npm install --save-dev tap@12.5.3	Prototype Pollution	https://npmjs.com/advisories/782	tap>nyc>istanbul-lib-instrument>babel-template>babel-types>lodash	Y
install	lodash	moderate	npm install --save-dev tap@12.5.3	Prototype Pollution	https://npmjs.com/advisories/782	tap>nyc>istanbul-lib-instrument>babel-template>lodash	Y
install	lodash	moderate	npm install --save-dev tap@12.5.3	Prototype Pollution	https://npmjs.com/advisories/782	tap>nyc>istanbul-lib-instrument>babel-traverse>babel-types>lodash	Y

I am accountable to others for the "best-effort" basis on keeping packages secure to current standards. Fixing tap to 12.5.3 results in npm audit returning 0 known vulnerabilities.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After tap@12.5.3

infintesimal@hishost:~/bw$ npm install --save-dev tap@12.5.3
+ tap@12.5.3
added 300 packages from 185 contributors and audited 580 packages in 10.058s
found 0 vulnerabilities

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think vulns matter in dev deps, generally. In this case, this prototype pollution attack only affects when deep merging untrusted code, which can’t happen here.

@goto-bus-stop goto-bus-stop Mar 1, 2019

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same goes for handlebars, which is only 'vulnerable' with untrusted templates. Browserify's dependencies only use trusted static templates.
Iirc, tunnel-agent is in the dependency tree but not used at all.

Still, fixing these warnings can be worthwhile, even if only because they're annoying to the developer. In this case though, we're specifically using older versions because the newer versions don't support all our target platforms. If there is a a way to upgrade without losing compatibility, I'd be all for it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I understand the dev deps is not relevant in a prod bundle. My security peers want to mitigate the risk wherever possible. I am looking at fresh conflicts in esm and the older node platforms the team supports. I will see if I can work something out. Right now build is breaking on esm.js. I'll be glad to have the PR accepted when I can prove that I can get through the build for all platforms. Cheers. Steve

Comment thread test/bare.js Outdated
});
vm.runInNewContext(body, {
Buffer: Buffer,
Buffer: function (s) { return Buffer.from(s) },

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Buffer.from does not exist in old Node versions which browserify still supports—for this change, we need to check if it exists:

var buf = Buffer.from ? Buffer.from(s) : Buffer(s)

or use a module like safe-buffer that polyfills the from method.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing. I have some fresh commits pending the PR so this is all backwards compatible.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you prefer I use safe-buffer to what I patched up in three of the test files (bare.js, bare_shebang.js and buffer.js)? I can do that too.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

safe-buffer might be easier because you can just use Buffer.from in all the callsites and it'll do the right thing. I don't really mind either way though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.