Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.8.1 proposal (became v4.0.0) #1718

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
gyp/test
node_modules
test/.node-gyp
package-lock.json
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
v3.8.1 2019-04-12
=================

### Due to security concern this version drops support for Node.js versions < 4.0.0

* [[`3578b2abf0`](https://github.com/nodejs/node-gyp/commit/3578b2abf0)] - **deps**: explicit limit on supported engines (Refael Ackermann)
* [[`ec8505e15f`](https://github.com/nodejs/node-gyp/commit/ec8505e15f)] - **deps**: updated tar package version to 4.4.8 (Pobegaylo Maksim) [#1713](https://github.com/nodejs/node-gyp/pull/1713)
* [[`6e1e425ffb`](https://github.com/nodejs/node-gyp/commit/6e1e425ffb)] - **(BREAKING for node < 4)** Upgrade to tar v3 (isaacs) [#1212](https://github.com/nodejs/node-gyp/pull/1212)
* [[`e6699d13cd`](https://github.com/nodejs/node-gyp/commit/e6699d13cd)] - **test**: fix addon test for Node.js 12 and V8 7.4 (Richard Lau) [#1705](https://github.com/nodejs/node-gyp/pull/1705)
* [[`0c6bf530a0`](https://github.com/nodejs/node-gyp/commit/0c6bf530a0)] - **lib**: use print() for python version detection (GreenAddress) [#1534](https://github.com/nodejs/node-gyp/pull/1534)


v3.8.0 2018-08-09
=================

Expand Down
38 changes: 16 additions & 22 deletions lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ var fs = require('graceful-fs')
, rm = require('rimraf')
, path = require('path')
, crypto = require('crypto')
, zlib = require('zlib')
, log = require('npmlog')
, semver = require('semver')
, fstream = require('fstream')
, request = require('request')
, mkdir = require('mkdirp')
, processRelease = require('./process-release')
Expand Down Expand Up @@ -148,41 +146,33 @@ function install (fs, gyp, argv, callback) {
var tarPath = gyp.opts.tarball
var badDownload = false
, extractCount = 0
, gunzip = zlib.createGunzip()
, extracter = tar.Extract({ path: devDir, strip: 1, filter: isValid })

var contentShasums = {}
var expectShasums = {}

// checks if a file to be extracted from the tarball is valid.
// only .h header files and the gyp files get extracted
function isValid () {
var name = this.path.substring(devDir.length + 1)
var isValid = valid(name)
if (name === '' && this.type === 'Directory') {
// the first directory entry is ok
return true
}
function isValid (path, entry) {
var isValid = valid(path)
if (isValid) {
log.verbose('extracted file from tarball', name)
log.verbose('extracted file from tarball', path)
extractCount++
} else {
// invalid
log.silly('ignoring from tarball', name)
log.silly('ignoring from tarball', path)
}
return isValid
}

gunzip.on('error', cb)
extracter.on('error', cb)
extracter.on('end', afterTarball)

// download the tarball, gunzip and extract!
// download the tarball and extract!

if (tarPath) {
var input = fs.createReadStream(tarPath)
input.pipe(gunzip).pipe(extracter)
return
return tar.extract({
file: tarPath,
strip: 1,
filter: isValid,
cwd: devDir
}).then(afterTarball, cb)
}

try {
Expand Down Expand Up @@ -222,7 +212,11 @@ function install (fs, gyp, argv, callback) {
})

// start unzipping and untaring
req.pipe(gunzip).pipe(extracter)
res.pipe(tar.extract({
strip: 1,
cwd: devDir,
filter: isValid
}).on('close', afterTarball).on('error', cb))
})

// invoked after the tarball has finished being extracted
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"bin": "./bin/node-gyp.js",
"main": "./lib/node-gyp.js",
"dependencies": {
"fstream": "^1.0.0",
"glob": "^7.0.3",
"graceful-fs": "^4.1.2",
"mkdirp": "^0.5.0",
Expand All @@ -32,11 +31,11 @@
"request": "^2.87.0",
"rimraf": "2",
"semver": "~5.3.0",
"tar": "^2.0.0",
"tar": "4",

Choose a reason for hiding this comment

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

Should this be?:

Suggested change
"tar": "4",
"tar": "^4.4.8",

Otherwise users without npm audit may still get the unsecure version.

Copy link
Member

Choose a reason for hiding this comment

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

this is the only part left in 6bc9bf1 so I'm removing that commit entirely and it'll end up with ^4.4.8

"which": "1"
},
"engines": {
"node": ">= 0.8.0"
"node": ">= 4.0.0"
Copy link
Member

Choose a reason for hiding this comment

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

This is a semver-major change.

},
"devDependencies": {
"tape": "~4.2.0",
Expand Down