Hi,
I just upgraded our SonarQube instance to 10.4 and a lot of false positives appeared when using regular expressions to validate @PathVariable
formats like this :
@GetMapping("/something/{id:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}}")
public String getObj(@PathVariable("id") UUID id){
return "";
}
Which is being reported as “Bind path variable “12”, “4”, “8” to a method parameter.”.
The rule should ignore what’s after the first :
until the corresponding closing }
.
See examples patterns at Mapping Requests :: Spring Framework