A request handler is mapped without naming its HTTP methods, so it answers all of them

tx0/java:any-http-method-mappingstrictwarningsecurity, cwe-352

What it finds

A handler method with @RequestMapping("/transfer") and no method answers GET as well as POST. An action that changes state then also runs from a link or an image tag, where protection against cross-site request forgery usually does not apply (CWE-352). @GetMapping, @PostMapping or method = ... limit it to what is meant.

Reported is @RequestMapping without method on a method.

From the rule's source, any_http_method_mapping.rs.

Example from the rule's tests
import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestMethod; @RequestMapping("/bank")class Bank {  @RequestMapping("/transfer")tx0 reports: answers every HTTP method  void transfer() {}   @RequestMapping(value = "/balance", method = RequestMethod.GET)  void balance() {}}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/java:any-http-method-mapping" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/java:any-http-method-mapping] reason="..."

tx0 explain tx0/java:any-http-method-mapping shows the same in the terminal. Found a false positive? Report it.