Improve handling of the 'author' word as an exception

This commit is contained in:
Tony Torralba
2021-09-16 11:57:28 +02:00
parent 21079a1315
commit f18c163408
2 changed files with 32 additions and 3 deletions

View File

@@ -81,9 +81,9 @@ class AuthMethod extends SensitiveExecutionMethod {
AuthMethod() {
exists(string s | s = this.getName().toLowerCase() |
s.matches(["%login%", "%auth%"]) and
not s.matches([
"get%", "set%", "parse%", "%loginfo%", "remove%", "clean%", "%unauth%", "%author%"
])
not s.matches(["get%", "set%", "parse%", "%loginfo%", "remove%", "clean%", "%unauth%"]) and
// exclude "author", but not "authorize" or "authority"
not s.regexpMatch(".*[aA]uthors?([A-Z0-9_].*|$)")
) and
not this.getDeclaringType().getASupertype*() instanceof TypeException
}