Java: add name-based heuristic

This commit is contained in:
Jami Cogswell
2024-12-15 20:53:27 -05:00
parent 286c655264
commit 39ccde0c9d
4 changed files with 62 additions and 23 deletions

View File

@@ -211,4 +211,10 @@ public class CsrfUnprotectedRequestTypeTest {
public void bad10(@RequestParam String user) { // $ hasCsrfUnprotectedRequestType
myBatisService.bad10(user);
}
// BAD: method name implies a state-change
@GetMapping(value = "delete")
public String delete(@RequestParam String user) { // $ hasCsrfUnprotectedRequestType
return "delete";
}
}

View File

@@ -7,9 +7,7 @@ module CsrfUnprotectedRequestTypeTest implements TestSig {
predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasCsrfUnprotectedRequestType" and
exists(CallPathNode src, CallPathNode sink, CallPathNode sinkPred |
unprotectedStateChange(src, sink, sinkPred)
|
exists(CallPathNode src, CallPathNode sink | unprotectedStateChange(src, sink) |
src.getLocation() = location and
element = src.toString() and
value = ""