Skip to content
Myr

Merge tag '4.20.0' into 5.0

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Wes Todd · committed by Wes Todd · parents 63992bb, 21df421 · Browse files · 9 files+81 added−15 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

9 files+81 added−15 removed

  • tests:+51 added−7 removed
  • other:+30 added−8 removed

9 files+81 added−15 removed

modified:lib/response.js+1 added-1 removed
835 unmodified lines
836 },837838 html: function(){839 var u = escapeHtml(address);840 body = '<p>' + statuses.message[status] + '. Redirecting to <a href="' + u + '">' + u + '</a></p>'840 body = '<p>' + statuses.message[status] + '. Redirecting to ' + u + '</p>'841 },842843 default: function(){844 body = '';
196 unmodified lines
modified:test/app.router.js+26 added
192 unmodified lines
193 .get('/user/10/edit')194 .expect('editing user 10', done);195 })196197 if (supportsRegexp('(?<foo>.*)')) {198 it('should populate req.params with named captures', function(done){199 var app = express();200 var re = new RegExp('^/user/(?<userId>[0-9]+)/(view|edit)?$');201202 app.get(re, function(req, res){203 var id = req.params.userId204 , op = req.params[0];205 res.end(op + 'ing user ' + id);206 });207208 request(app)209 .get('/user/10/edit')210 .expect('editing user 10', done);211 })212 }213214 it('should ensure regexp matches path prefix', function (done) {215 var app = express()216 var p = []217
938 unmodified lines
1156 var app = express();1157 assert.strictEqual(app.get('/', function () {}), app)1158 })1159})11601161function supportsRegexp(source) {1162 try {1163 new RegExp(source)1164 return true1165 } catch (e) {1166 return false1167 }1168}
modified:test/express.static.js+2 added-2 removed
484 unmodified lines
485 it('should include HTML link', function (done) {486 request(this.app)487 .get('/users')488 .expect('Location', '/users/')489 .expect(301, /<a href="\/users\/">/, done)489 .expect(301, /\/users\//, done)490 })491492 it('should redirect directories with query string', function (done) {493 request(this.app)
13 unmodified lines
507 request(this.app)508 .get('/snow')509 .expect('Location', '/snow%20%E2%98%83/')510 .expect('Content-Type', /html/)511 .expect(301, />Redirecting to <a href="\/snow%20%E2%98%83\/">\/snow%20%E2%98%83\/<\/a></, done)511 .expect(301, />Redirecting to \/snow%20%E2%98%83\/</, done)512 })513514 it('should respond with default Content-Security-Policy', function (done) {515 request(this.app)
299 unmodified lines
modified:test/express.urlencoded.js+2 added-2 removed
184 unmodified lines
185186 it('should parse deep object', function (done) {187 var str = 'foo'188189 for (var i = 0; i < 500; i++) {189 for (var i = 0; i < 32; i++) {190 str += '[p]'191 }192193 str += '=bar'
9 unmodified lines
203204 var depth = 0205 var ref = obj.foo206 while ((ref = ref.p)) { depth++ }207 assert.strictEqual(depth, 500)207 assert.strictEqual(depth, 32)208 })209 .expect(200, done)210 })211 })
628 unmodified lines
modified:test/res.redirect.js+21 added-3 removed
89 unmodified lines
90 .get('/')91 .set('Accept', 'text/html')92 .expect('Content-Type', /html/)93 .expect('Location', 'http://google.com')94 .expect(302, '<p>Found. Redirecting to <a href="http://google.com">http://google.com</a></p>', done)94 .expect(302, '<p>Found. Redirecting to http://google.com</p>', done)95 })9697 it('should escape the url', function(done){98 var app = express();
7 unmodified lines
106 .set('Host', 'http://example.com')107 .set('Accept', 'text/html')108 .expect('Content-Type', /html/)109 .expect('Location', '%3Cla\'me%3E')110 .expect(302, '<p>Found. Redirecting to <a href="%3Cla&#39;me%3E">%3Cla&#39;me%3E</a></p>', done)110 .expect(302, '<p>Found. Redirecting to %3Cla&#39;me%3E</p>', done)111 })112113 it('should not render evil javascript links in anchor href (prevent XSS)', function(done){114 var app = express();115 var xss = 'javascript:eval(document.body.innerHTML=`<p>XSS</p>`);';116 var encodedXss = 'javascript:eval(document.body.innerHTML=%60%3Cp%3EXSS%3C/p%3E%60);';117118 app.use(function(req, res){119 res.redirect(xss);120 });121122 request(app)123 .get('/')124 .set('Host', 'http://example.com')125 .set('Accept', 'text/html')126 .expect('Content-Type', /html/)127 .expect('Location', encodedXss)128 .expect(302, '<p>Found. Redirecting to ' + encodedXss +'</p>', done);129 });130131 it('should include the redirect type', function(done){132 var app = express();133134 app.use(function(req, res){
4 unmodified lines
139 .get('/')140 .set('Accept', 'text/html')141 .expect('Content-Type', /html/)142 .expect('Location', 'http://google.com')125 .expect(301, '<p>Moved Permanently. Redirecting to <a href="http://google.com">http://google.com</a></p>', done);143 .expect(301, '<p>Moved Permanently. Redirecting to http://google.com</p>', done);144 })145 })146147 describe('when accepting text', function(){
67 unmodified lines
modified:History.md+12 added-2 removed
174 unmodified lines
175 - `req.query` is now a getter instead of a plain property176 * add:177 - `app.router` is a reference to the base router178179unreleased1794.20.0 / 2024-09-10180==========181181 * deps: serve-static@0.16.0182 * Remove link renderization in html while redirecting183 * deps: send@0.19.0184 * Remove link renderization in html while redirecting185 * deps: body-parser@0.6.0186 * add `depth` option to customize the depth level in the parser187 * IMPORTANT: The default `depth` level for parsing URL-encoded data is now `32` (previously was `Infinity`)188 * Remove link renderization in html while using `res.redirect`189 * deps: path-to-regexp@0.1.10190 - Adds support for named matching groups in the routes using a regex191 - Adds backtracking protection to parameters without regexes defined192 * deps: encodeurl@~2.0.0193 - Removes encoding of `\`, `|`, and `^` to align better with URL spec194 * Deprecate passing `options.maxAge` and `options.expires` to `res.clearCookie`195 - Will be ignored in v5, clearCookie will set a cookie with an expires in the past to instruct clients to delete the cookie
3616 unmodified lines
modified:package.json+5 added-1 removed
modified:Readme.md+3 added-2 removed
200 unmodified lines
201* [import-brain](https://github.com/import-brain) - **Eric Cheng** (he/him)202* [3imed-jaberi](https://github.com/3imed-jaberi) - **Imed Jaberi**203* [dakshkhetan](https://github.com/dakshkhetan) - **Daksh Khetan** (he/him)204* [lucasraziel](https://github.com/lucasraziel) - **Lucas Soares Do Rego**205* [IamLizu](https://github.com/IamLizu) - **S M Mahmudul Hasan** (he/him)206* [Sushmeet](https://github.com/Sushmeet) - **Sushmeet Sunger**207208<details>209<summary>Triagers emeriti members</summary>
44 unmodified lines
254[npm-install-size-image]: https://badgen.net/packagephobia/install/express255[npm-install-size-url]: https://packagephobia.com/result?p=express256[npm-url]: https://npmjs.org/package/express257[npm-version-image]: https://badgen.net/npm/v/express257[ossf-scorecard-badge]: https://api.securityscorecards.dev/projects/github.com/expressjs/express/badge258[ossf-scorecard-visualizer]: https://kooltheba.github.io/openssf-scorecard-api-visualizer/#/projects/github.com/expressjs/express258[ossf-scorecard-badge]: https://api.scorecard.dev/projects/github.com/expressjs/express/badge259[ossf-scorecard-visualizer]: https://ossf.github.io/scorecard-visualizer/#/projects/github.com/expressjs/express260[Code of Conduct]: https://github.com/expressjs/express/blob/master/Code-Of-Conduct.md
modified:Triager-Guide.md+9 added-2 removed
7 unmodified lines
8classification:910* `needs triage`: This can be kept if the triager is unsure which next steps to take11* `awaiting more info`: If more info has been requested from the author, apply this label.12* `question`: User questions that do not appear to be bugs or enhancements.13* `discuss`: Topics for discussion. Might end in an `enhancement` or `question` label.12* `bug`: Issues that present a reasonable conviction there is a reproducible bug.13* `enhancement`: Issues that are found to be a reasonable candidate feature additions.1415If the issue is a question or discussion, it should be moved to GitHub Discussions.1617### Moving Discussions and Questions to GitHub Discussions1819For issues labeled with `question` or `discuss`, it is recommended to move them to GitHub Discussions instead:2021* **Questions**: User questions that do not appear to be bugs or enhancements should be moved to GitHub Discussions.22* **Discussions**: Topics for discussion should be moved to GitHub Discussions. If the discussion leads to a new feature or bug identification, it can be moved back to Issues.2324In all cases, issues may be closed by maintainers if they don't receive a timely response when25further information is sought, or when additional questions are asked.2627## Approaches and Best Practices for getting into triage contributions
43 unmodified lines