Update sectraining.md
This commit is contained in:
parent
84200f0bcf
commit
a83bc196e3
1 changed files with 12 additions and 0 deletions
|
|
@ -113,3 +113,15 @@ public void doAction(HttpServletRequest request, HttpServletResponse response) {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Open Redirect
|
||||||
|
|
||||||
|
#### Java Prevention
|
||||||
|
Unless the development is aided by third-party libraries, developers must implement their own solution to determine whether the user-controlled string represents a local path or not. If the list of permitted URLs for redirection is known, implement an allow list of such URLs.
|
||||||
|
|
||||||
|
Otherwise, an easy ad hoc solution could be the following:
|
||||||
|
```java
|
||||||
|
private static boolean isLocal(String path) {
|
||||||
|
return path.startsWith("/") && !path.startsWith("//");
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue