diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a143eed63..6dba5c2d9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,23 +27,23 @@ jobs: include: - name: Node.js 4.0 node-version: "4.0" - npm-i: mocha@5.2.0 supertest@3.4.2 + npm-i: mocha@5.2.0 nyc@11.9.0 supertest@3.4.2 - name: Node.js 4.x node-version: "4.9" - npm-i: mocha@5.2.0 supertest@3.4.2 + npm-i: mocha@5.2.0 nyc@11.9.0 supertest@3.4.2 - name: Node.js 5.x node-version: "5.12" - npm-i: mocha@5.2.0 supertest@3.4.2 + npm-i: mocha@5.2.0 nyc@11.9.0 supertest@3.4.2 - name: Node.js 6.x node-version: "6.17" - npm-i: mocha@6.2.2 + npm-i: mocha@6.2.2 nyc@14.1.1 supertest@6.1.6 - name: Node.js 7.x node-version: "7.10" - npm-i: mocha@6.2.2 + npm-i: mocha@6.2.2 nyc@14.1.1 supertest@6.1.6 - name: Node.js 8.x node-version: "8.17" @@ -68,7 +68,7 @@ jobs: node-version: "13.14" - name: Node.js 14.x - node-version: "14.18" + node-version: "14.19" steps: - uses: actions/checkout@v2 @@ -113,6 +113,7 @@ jobs: echo "node@$(node -v)" echo "npm@$(npm -v)" npm -s ls ||: + (npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print "::set-output name=" $2 "::" $3 }' - name: Run tests shell: bash diff --git a/.gitignore b/.gitignore index 5fee6a2dc9..3a673d9cc0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,27 +1,15 @@ -# OS X -.DS_Store* -Icon? -._* - -# Windows -Thumbs.db -ehthumbs.db -Desktop.ini - -# Linux -.directory -*~ - - # npm node_modules package-lock.json *.log *.gz - # Coveralls +.nyc_output coverage # Benchmarking benchmarks/graphs + +# ignore additional files using core.excludesFile +# https://git-scm.com/docs/gitignore diff --git a/History.md b/History.md index d89efef4e6..5380daf09c 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +5.x +=== + +This incorporates all changes after 4.17.2 up to 4.17.3. + 5.0.0-beta.1 / 2022-02-14 ========================= @@ -157,6 +162,21 @@ This is the first Express 5.0 alpha release, based off 4.10.1. * add: - `app.router` is a reference to the base router +4.17.3 / 2022-02-16 +=================== + + * deps: accepts@~1.3.8 + - deps: mime-types@~2.1.34 + - deps: negotiator@0.6.3 + * deps: body-parser@1.19.2 + - deps: bytes@3.1.2 + - deps: qs@6.9.7 + - deps: raw-body@2.4.3 + * deps: cookie@0.4.2 + * deps: qs@6.9.7 + * Fix handling of `__proto__` keys + * pref: remove unnecessary regexp for trust proxy + 4.17.2 / 2021-12-16 =================== diff --git a/appveyor.yml b/appveyor.yml index 433729652b..7f7a3717e7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,7 +10,7 @@ environment: - nodejs_version: "11.15" - nodejs_version: "12.22" - nodejs_version: "13.14" - - nodejs_version: "14.18" + - nodejs_version: "14.19" cache: - node_modules install: @@ -46,11 +46,25 @@ install: } elseif ([int]$env:nodejs_version.split(".")[0] -lt 12) { npm install --silent --save-dev mocha@8.4.0 } + - ps: | + # nyc for test coverage + # - use 10.3.2 for Node.js < 4 + # - use 11.9.0 for Node.js < 6 + # - use 14.1.1 for Node.js < 8 + if ([int]$env:nodejs_version.split(".")[0] -lt 4) { + npm install --silent --save-dev nyc@10.3.2 + } elseif ([int]$env:nodejs_version.split(".")[0] -lt 6) { + npm install --silent --save-dev nyc@11.9.0 + } elseif ([int]$env:nodejs_version.split(".")[0] -lt 8) { + npm install --silent --save-dev nyc@14.1.1 + } - ps: | # supertest for http calls # - use 3.4.2 for Node.js < 6 if ([int]$env:nodejs_version.split(".")[0] -lt 6) { npm install --silent --save-dev supertest@3.4.2 + } elseif ([int]$env:nodejs_version.split(".")[0] -lt 8) { + npm install --silent --save-dev supertest@6.1.6 } # Update Node.js modules - ps: | diff --git a/examples/auth/index.js b/examples/auth/index.js index 2f05d5ff8d..2859545c54 100644 --- a/examples/auth/index.js +++ b/examples/auth/index.js @@ -1,3 +1,5 @@ +'use strict' + /** * Module dependencies. */ @@ -59,14 +61,14 @@ function authenticate(name, pass, fn) { if (!module.parent) console.log('authenticating %s:%s', name, pass); var user = users[name]; // query the db for the given username - if (!user) return fn(new Error('cannot find user')); + if (!user) return fn(null, null) // apply the same algorithm to the POSTed password, applying // the hash against the pass / salt, if there is a match we // found the user hash({ password: pass, salt: user.salt }, function (err, pass, salt, hash) { if (err) return fn(err); if (hash === user.hash) return fn(null, user) - fn(new Error('invalid password')); + fn(null, null) }); } @@ -99,9 +101,10 @@ app.get('/login', function(req, res){ res.render('login'); }); -app.post('/login', function(req, res){ +app.post('/login', function (req, res, next) { if (!req.body) return res.sendStatus(400) authenticate(req.body.username, req.body.password, function(err, user){ + if (err) return next(err) if (user) { // Regenerate session when signing in // to prevent fixation diff --git a/examples/content-negotiation/db.js b/examples/content-negotiation/db.js index 43fb04baa1..f59b23bf18 100644 --- a/examples/content-negotiation/db.js +++ b/examples/content-negotiation/db.js @@ -1,3 +1,5 @@ +'use strict' + var users = []; users.push({ name: 'Tobi' }); diff --git a/examples/content-negotiation/index.js b/examples/content-negotiation/index.js index 348929e852..280a4e2299 100644 --- a/examples/content-negotiation/index.js +++ b/examples/content-negotiation/index.js @@ -1,3 +1,5 @@ +'use strict' + var express = require('../../'); var app = module.exports = express(); var users = require('./db'); diff --git a/examples/content-negotiation/users.js b/examples/content-negotiation/users.js index fe511072ec..fe703e73a9 100644 --- a/examples/content-negotiation/users.js +++ b/examples/content-negotiation/users.js @@ -1,3 +1,4 @@ +'use strict' var users = require('./db'); diff --git a/examples/cookie-sessions/index.js b/examples/cookie-sessions/index.js index 1dda15de61..01c731c1c8 100644 --- a/examples/cookie-sessions/index.js +++ b/examples/cookie-sessions/index.js @@ -1,3 +1,5 @@ +'use strict' + /** * Module dependencies. */ diff --git a/examples/cookies/index.js b/examples/cookies/index.js index 7d6264a143..8bca73ff97 100644 --- a/examples/cookies/index.js +++ b/examples/cookies/index.js @@ -1,3 +1,5 @@ +'use strict' + /** * Module dependencies. */ diff --git a/examples/downloads/index.js b/examples/downloads/index.js index dc59532c40..0d8118591f 100644 --- a/examples/downloads/index.js +++ b/examples/downloads/index.js @@ -1,11 +1,18 @@ +'use strict' + /** * Module dependencies. */ var express = require('../../'); var path = require('path'); +var resolvePath = require('resolve-path') + var app = module.exports = express(); +// path to where the files are stored on disk +var FILES_DIR = path.join(__dirname, 'files') + app.get('/', function(req, res){ res.send('