Skip to content

Commit 40ada39

Browse files
Jami CogswellJami Cogswell
authored andcommitted
Java: add authorizeHttpRequests and AuthorizeHttpRequestsConfigurer
1 parent 103932f commit 40ada39

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

java/ql/lib/semmle/code/java/frameworks/spring/SpringSecurity.qll

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,17 @@ class TypeHttpSecurity extends Class {
1515

1616
/**
1717
* The class
18-
* `org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer`.
18+
* `org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer$AuthorizedUrl`
19+
* or the class
20+
* `org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer$AuthorizedUrl`.
1921
*/
2022
class TypeAuthorizedUrl extends Class {
2123
TypeAuthorizedUrl() {
2224
this.hasQualifiedName("org.springframework.security.config.annotation.web.configurers",
23-
"ExpressionUrlAuthorizationConfigurer<HttpSecurity>$AuthorizedUrl<>")
25+
[
26+
"ExpressionUrlAuthorizationConfigurer<HttpSecurity>$AuthorizedUrl<>",
27+
"AuthorizeHttpRequestsConfigurer<HttpSecurity>$AuthorizedUrl<>"
28+
])
2429
}
2530
}
2631

@@ -34,14 +39,32 @@ class TypeAbstractRequestMatcherRegistry extends Class {
3439
}
3540
}
3641

37-
/** A call to `HttpSecurity.authorizeRequests` method. */
42+
/**
43+
* A call to `HttpSecurity.authorizeRequests` method.
44+
*
45+
* Note: this API is deprecated and scheduled for removal
46+
* in Spring Security 7.0.
47+
*/
3848
class AuthorizeRequestsCall extends MethodCall {
3949
AuthorizeRequestsCall() {
4050
this.getMethod().hasName("authorizeRequests") and
4151
this.getMethod().getDeclaringType() instanceof TypeHttpSecurity
4252
}
4353
}
4454

55+
/**
56+
* A call to `HttpSecurity.authorizeHttpRequests` method.
57+
*
58+
* Note: the no-argument version of this API is deprecated
59+
* and scheduled for removal in Spring Security 7.0.
60+
*/
61+
class AuthorizeHttpRequestsCall extends MethodCall {
62+
AuthorizeHttpRequestsCall() {
63+
this.getMethod().hasName("authorizeHttpRequests") and
64+
this.getMethod().getDeclaringType() instanceof TypeHttpSecurity
65+
}
66+
}
67+
4568
/** A call to `AuthorizedUrl.permitAll` method. */
4669
class PermitAllCall extends MethodCall {
4770
PermitAllCall() {

0 commit comments

Comments
 (0)