| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // BAD: no URI validation | ||
| String returnURL = request.getParameter("returnURL"); | ||
| RequestDispatcher rd = sc.getRequestDispatcher(returnURL); | ||
| rd.forward(request, response); | ||
|
|
||
| // GOOD: check for a trusted prefix, ensuring path traversal is not used to erase that prefix: | ||
| // (alternatively use `Path.normalize` instead of checking for `..`) | ||
| if (!returnURL.contains("..") && returnURL.hasPrefix("/pages")) { ... } | ||
| // Also GOOD: check for a forbidden prefix, ensuring URL-encoding is not used to evade the check: | ||
| // (alternatively use `URLDecoder.decode` before `hasPrefix`) | ||
| if (returnURL.hasPrefix("/internal") && !returnURL.contains("%")) { ... } |
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.