Skip to content

Commit

Permalink
[SECURITY-195] - Throw the MalformedURLException if the request inclu…
Browse files Browse the repository at this point in the history
…des the relative addressing
  • Loading branch information
oleg-nenashev committed Sep 10, 2015
1 parent 1002ada commit 5431e39
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/src/main/java/hudson/model/Slave.java
Expand Up @@ -323,6 +323,13 @@ private URLConnection connect() throws IOException {
public URL getURL() throws MalformedURLException {
String name = fileName;
if (name.equals("hudson-cli.jar")) name="jenkins-cli.jar";

// Prevent the sandbox escaping (SECURITY-195)
if (name.contains("..")) {
throw new MalformedURLException("The specified file path " + fileName + " contains '..'. "
+ "The path is not allowed due to security reasons");
}

URL res = Jenkins.getInstance().servletContext.getResource("/WEB-INF/" + name);
if(res==null) {
// during the development this path doesn't have the files.
Expand Down

0 comments on commit 5431e39

Please sign in to comment.