You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue : When the application startup, the static file can be accessed with any(GET,POST, XXX) http method Application fails in Vulnerability scan as below
identified: - Verb tampering, Only allow required http methods e.g. get, post.
Spark Java version : spark-core:2.7.2
Server: Jetty(9.4.14.v20181114)
is it possible to add filter or some other alternative to stop accessing the static information from CURL or POSTMAN ?
Sample reproducer
import static spark.Spark.halt;
import spark.Service;
public class ServerExample {
public ServerExample() {
Service service = Service.ignite().port(4568);
service.staticFiles.externalLocation("C:\\dev"); //file attached for dev folder
service.before((req, res) -> {
System.out.println("Hello:" + req.headers());
});
service.get("/", (req, res) -> {
if (!req.requestMethod().equalsIgnoreCase("GET")) {
halt(401, "invalid Http method");
}
return null;
});
}
public static void main(String[] args) {
new ServerExample();
}
}
The text was updated successfully, but these errors were encountered:
Prashantha-AV
changed the title
SparkJava - failed validate http methods for Static files
SparkJava - failed to validate http methods for Static files
Dec 10, 2020
@Prashantha-AV@perwendel
Hi. I think the correct behavior is to return a 405 code if the file is found, but the http method is not supported. Do you agree?
HI,
Need help on static files
Issue : When the application startup, the static file can be accessed with any(GET,POST, XXX) http method
Application fails in Vulnerability scan as below
identified: - Verb tampering, Only allow required http methods e.g. get, post.
Spark Java version : spark-core:2.7.2
Server: Jetty(9.4.14.v20181114)
is it possible to add filter or some other alternative to stop accessing the static information from CURL or POSTMAN ?
Sample reproducer
reproduce issue from CURL
1.
The XYZ above call is invalid HTTP method.
The app should not respond to any invalid http method, adding filter "/" is not considered.
Could any help to fix this.
dev.zip
The text was updated successfully, but these errors were encountered: