[FIXED SECURITY-155] Do not allow plugin code to be downloaded via doDynamic, only static resources.

This commit is contained in:
Jesse Glick committed 2014-08-22 16:41:19 -04:00
1 parent 31e5d10be0
commit f0a29b562e
2 files changed
+8

No files matched your search

+5
View File
@@ -42,6 +42,7 @@ import net.sf.json.JSONObject;
import com.thoughtworks.xstream.XStream;
import java.net.URI;
import java.net.URISyntaxException;
import org.kohsuke.stapler.HttpResponses;
/**
* Base class of Hudson plugin.
@@ -200,6 +201,10 @@ public abstract class Plugin implements Saveable {
public void doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
String path = req.getRestOfPath();
if (path.startsWith("/META-INF/") || path.startsWith("/WEB-INF/")) {
throw HttpResponses.notFound();
}
if(path.length()==0)
path = "/";