Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 77ada90

Browse filesBrowse files
authored
Deprecate "back" magic string in redirects (#5935)
1 parent 21df421 commit 77ada90
Copy full SHA for 77ada90

File tree

Expand file treeCollapse file tree

2 files changed

+6
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-0
lines changed

‎History.md

Copy file name to clipboardExpand all lines: History.md
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
unreleased
2+
==========
3+
4+
* Deprecate `res.location("back")` and `res.redirect("back")` magic string
5+
16
4.20.0 / 2024-09-10
27
==========
38
* deps: serve-static@0.16.0

‎lib/response.js

Copy file name to clipboardExpand all lines: lib/response.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,7 @@ res.location = function location(url) {
916916

917917
// "back" is an alias for the referrer
918918
if (url === 'back') {
919+
deprecate('res.location("back"): use res.location(req.get("Referrer") || "/") and refer to https://dub.sh/security-redirect for best practices');
919920
loc = this.req.get('Referrer') || '/';
920921
} else {
921922
loc = String(url);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.