From a7472b404baf42397b65601b5a18b7e53ce7c70a Mon Sep 17 00:00:00 2001 From: Noritaka Kobayashi Date: Wed, 30 Sep 2026 01:41:05 +0900 Subject: [PATCH] build(deps-dev): bump supertest from 6.3.0 to 7.3.0 Signed-off-by: Noritaka Kobayashi --- package.json | 2 +- test/acceptance/downloads.js | 4 ++-- test/express.static.js | 15 +++++---------- test/support/utils.js | 15 +++++++++++++++ 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 2d6a11e0cd5..fb250c30ae0 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "morgan": "1.12.1", "nyc": "^17.1.0", "pbkdf2-password": "1.2.1", - "supertest": "^6.3.0", + "supertest": "^7.3.0", "vhost": "~3.0.2" }, "engines": { diff --git a/test/acceptance/downloads.js b/test/acceptance/downloads.js index 3deed3e0cc7..3e143f3edcb 100644 --- a/test/acceptance/downloads.js +++ b/test/acceptance/downloads.js @@ -1,6 +1,7 @@ var app = require('../../examples/downloads') , request = require('supertest'); +var utils = require('../support/utils'); describe('downloads', function(){ describe('GET /', function(){ @@ -39,8 +40,7 @@ describe('downloads', function(){ describe('GET /files/../index.js', function () { it('should respond with 403', function (done) { - request(app) - .get('/files/../index.js') + utils.getRawPath(request(app), '/files/../index.js') .expect(403, done) }) }) diff --git a/test/express.static.js b/test/express.static.js index a2035631d66..9d88f5fb235 100644 --- a/test/express.static.js +++ b/test/express.static.js @@ -81,8 +81,7 @@ describe('express.static()', function () { }) it('should support ../', function (done) { - request(this.app) - .get('/users/../todo.txt') + utils.getRawPath(request(this.app), '/users/../todo.txt') .expect(200, '- groceries', done) }) @@ -269,8 +268,7 @@ describe('express.static()', function () { }) it('should fall-through when traversing past root', function (done) { - request(this.app) - .get('/users/../../todo.txt') + utils.getRawPath(request(this.app), '/users/../../todo.txt') .expect(404, 'Not Found', done) }) @@ -344,8 +342,7 @@ describe('express.static()', function () { }) it('should 403 when traversing past root', function (done) { - request(this.app) - .get('/users/../../todo.txt') + utils.getRawPath(request(this.app), '/users/../../todo.txt') .expect(403, /ForbiddenError/, done) }) @@ -578,14 +575,12 @@ describe('express.static()', function () { }) it('should catch urlencoded ../', function (done) { - request(this.app) - .get('/users/%2e%2e/%2e%2e/todo.txt') + utils.getRawPath(request(this.app), '/users/%2e%2e/%2e%2e/todo.txt') .expect(403, done) }) it('should not allow root path disclosure', function (done) { - request(this.app) - .get('/users/../../fixtures/todo.txt') + utils.getRawPath(request(this.app), '/users/../../fixtures/todo.txt') .expect(403, done) }) }) diff --git a/test/support/utils.js b/test/support/utils.js index fb816b08000..4b892accd59 100644 --- a/test/support/utils.js +++ b/test/support/utils.js @@ -17,6 +17,21 @@ exports.shouldHaveHeader = shouldHaveHeader exports.shouldNotHaveBody = shouldNotHaveBody exports.shouldNotHaveHeader = shouldNotHaveHeader; exports.shouldSkipQuery = shouldSkipQuery +exports.getRawPath = getRawPath + +/** + * Send a GET request without URL dot-segment normalization. + * + * @param {object} agent SuperTest request factory + * @param {string} path Request path + * @returns {object} SuperTest request + */ + +function getRawPath (agent, path) { + return agent.get(path).on('request', function (test) { + test.req.path = path + }) +} /** * Assert that a supertest response has a specific body.