Skip to content

Commit 46d7165

Browse files
author
Max Schaefer
committed
Explain about redirects to example.com.
1 parent a02f373 commit 46d7165

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

javascript/ql/src/Security/CWE-601/ServerSideUrlRedirect.qhelp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,19 @@ before doing the redirection:
3838
<sample src="examples/ServerSideUrlRedirectGood.js"/>
3939

4040
<p>
41-
Alternatively, we can check that the target URL does not redirect to a different host:
41+
Alternatively, we can check that the target URL does not redirect to a different host
42+
by parsing it relative to a base URL with a known host and verifying that the host
43+
stays the same:
4244
</p>
4345

4446
<sample src="examples/ServerSideUrlRedirectGood2.js"/>
4547

48+
<p>
49+
Note that as written, the above code will allow redirects to URLs on <code>example.com</code>,
50+
which is harmless but perhaps not intended. Substitute your own domain name for
51+
<code>example.com</code> to prevent this.
52+
</p>
53+
4654
</example>
4755

4856
<references>

0 commit comments

Comments
 (0)