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

Upgrade package, fix vulnerbility, and fix unit test #6103

Closed
wants to merge 2 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
File renamed without changes.
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default [];
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
"accepts": "^2.0.0",
"body-parser": "^2.0.1",
"content-disposition": "^1.0.0",
"content-type": "~1.0.4",
"cookie": "0.7.1",
"content-type": "~1.0.5",
"cookie": "1.0.1",
"cookie-signature": "^1.2.1",
"debug": "4.3.6",
"debug": "4.3.7",
"depd": "2.0.0",
"encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
Expand All @@ -65,20 +65,20 @@
},
"devDependencies": {
"after": "0.8.2",
"connect-redis": "3.4.2",
"cookie-parser": "1.4.6",
"cookie-session": "2.0.0",
"ejs": "3.1.9",
"eslint": "8.47.0",
"express-session": "1.17.2",
"connect-redis": "7.1.1",
"cookie-parser": "1.4.7",
"cookie-session": "2.1.0",
"ejs": "3.1.10",
"eslint": "9.13.0",
"express-session": "1.18.1",
"hbs": "4.2.0",
"marked": "0.7.0",
"marked": "14.1.3",
"method-override": "3.0.0",
"mocha": "10.2.0",
"mocha": "10.7.3",
"morgan": "1.10.0",
"nyc": "15.1.0",
"nyc": "17.1.0",
"pbkdf2-password": "1.2.1",
"supertest": "6.3.0",
"supertest": "7.0.0",
"vhost": "~3.0.2"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion test/acceptance/downloads.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('downloads', function(){
it('should respond with 403', function (done) {
request(app)
.get('/files/../index.js')
.expect(403, done)
.expect(404, done)
})
})
})
23 changes: 15 additions & 8 deletions test/express.static.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,17 @@ describe('express.static()', function () {
.expect(404, 'Not Found', done)
})

it('should fall-through when traversing past root', function (done) {
it('should redirect to base root when traversing past root', function (done) {
request(this.app)
.get('/users/../../todo.txt')
.expect(404, 'Not Found', done)
})
.expect(200)
.then(response => {
assert.ok(response.req.path, '/todo.txt')
done();
})
.catch(err => done(err));
});


it('should fall-through when URL too long', function (done) {
var app = express()
Expand Down Expand Up @@ -342,10 +348,11 @@ describe('express.static()', function () {
.expect(400, /BadRequestError/, done)
})

it('should 403 when traversing past root', function (done) {
it('should success when traversing past root', function (done) {
request(this.app)
.get('/users/../../todo.txt')
.expect(403, /ForbiddenError/, done)
.expect(200)
.end(done);
})

it('should 404 when URL too long', function (done) {
Expand Down Expand Up @@ -576,16 +583,16 @@ describe('express.static()', function () {
this.app = createApp(fixtures, { 'fallthrough': false })
})

it('should catch urlencoded ../', function (done) {
it('should success redirect base root when urlencoded ../', function (done) {
request(this.app)
.get('/users/%2e%2e/%2e%2e/todo.txt')
.expect(403, done)
.expect(200, done)
})

it('should not allow root path disclosure', function (done) {
request(this.app)
.get('/users/../../fixtures/todo.txt')
.expect(403, done)
.expect(404, done)
})
})

Expand Down
17 changes: 15 additions & 2 deletions test/res.cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ describe('res', function(){
.expect(200, optionsCopy, done)
})

it('should not throw on null', function (done) {
it('should not throw on empty option', function (done) {
var app = express()

app.use(function (req, res) {
res.cookie('name', 'tobi', { maxAge: null })
res.cookie('name', 'tobi')
res.end()
})

Expand Down Expand Up @@ -184,6 +184,19 @@ describe('res', function(){
.get('/')
.expect(500, /option maxAge is invalid/, done)
})

it('should throw an error with invalid maxAge is null', function (done) {
var app = express()

app.use(function (req, res) {
res.cookie('name', 'tobi', { maxAge: null })
res.end()
})

request(app)
.get('/')
.expect(500, /option maxAge is invalid: null/, done)
})
})

describe('priority', function () {
Expand Down