2020-06-30 12:48:39 +02:00
|
|
|
include::../description.adoc[]
|
|
|
|
|
|
|
|
include::../ask-yourself.adoc[]
|
|
|
|
|
|
|
|
include::../recommended.adoc[]
|
|
|
|
|
|
|
|
== Sensitive Code Example
|
|
|
|
|
|
|
|
----
|
|
|
|
@RequestMapping("/delete_user") // Sensitive: by default all HTTP methods are allowed
|
|
|
|
public String delete1(String username) {
|
|
|
|
// state of the application will be changed here
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequestMapping(path = "/delete_user", method = {RequestMethod.GET, RequestMethod.POST}) // Sensitive: both safe and unsafe methods are allowed
|
|
|
|
String delete2(@RequestParam("id") String id) {
|
|
|
|
// state of the application will be changed here
|
|
|
|
}
|
|
|
|
----
|
|
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
|
|
|
|
----
|
|
|
|
@RequestMapping("/delete_user", method = RequestMethod.POST) // Compliant
|
|
|
|
public String delete1(String username) {
|
|
|
|
// state of the application will be changed here
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequestMapping(path = "/delete_user", method = RequestMethod.POST) // Compliant
|
|
|
|
String delete2(@RequestParam("id") String id) {
|
|
|
|
// state of the application will be changed here
|
|
|
|
}
|
|
|
|
----
|
|
|
|
|
|
|
|
include::../see.adoc[]
|
2021-06-02 20:44:38 +02:00
|
|
|
|
2021-06-03 09:05:38 +02:00
|
|
|
ifdef::env-github,rspecator-view[]
|
2021-09-20 15:38:42 +02:00
|
|
|
|
|
|
|
'''
|
|
|
|
== Implementation Specification
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::../message.adoc[]
|
|
|
|
|
|
|
|
include::../highlighting.adoc[]
|
|
|
|
|
2021-06-08 15:52:13 +02:00
|
|
|
'''
|
2021-06-02 20:44:38 +02:00
|
|
|
== Comments And Links
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::../comments-and-links.adoc[]
|
2021-06-03 09:05:38 +02:00
|
|
|
endif::env-github,rspecator-view[]
|