@@ -3,6 +3,7 @@ private import experimental.semmle.code.java.frameworks.Jsf
33private import semmle.code.java.dataflow.ExternalFlow
44private import semmle.code.java.dataflow.FlowSources
55private import semmle.code.java.dataflow.StringPrefixes
6+ private import semmle.code.java.frameworks.javaee.ejb.EJBRestrictions
67
78/** A sink for unsafe URL forward vulnerabilities. */
89abstract class UnsafeUrlForwardSink extends DataFlow:: Node { }
@@ -23,31 +24,31 @@ private class RequestDispatcherSink extends UnsafeUrlForwardSink {
2324/** The `getResource` method of `Class`. */
2425class GetClassResourceMethod extends Method {
2526 GetClassResourceMethod ( ) {
26- this .getSourceDeclaration ( ) . getDeclaringType ( ) . hasQualifiedName ( "java.lang" , "Class" ) and
27+ this .getDeclaringType ( ) instanceof TypeClass and
2728 this .hasName ( "getResource" )
2829 }
2930}
3031
3132/** The `getResourceAsStream` method of `Class`. */
3233class GetClassResourceAsStreamMethod extends Method {
3334 GetClassResourceAsStreamMethod ( ) {
34- this .getSourceDeclaration ( ) . getDeclaringType ( ) . hasQualifiedName ( "java.lang" , "Class" ) and
35+ this .getDeclaringType ( ) instanceof TypeClass and
3536 this .hasName ( "getResourceAsStream" )
3637 }
3738}
3839
3940/** The `getResource` method of `ClassLoader`. */
4041class GetClassLoaderResourceMethod extends Method {
4142 GetClassLoaderResourceMethod ( ) {
42- this .getDeclaringType ( ) . hasQualifiedName ( "java.lang" , "ClassLoader" ) and
43+ this .getDeclaringType ( ) instanceof ClassLoaderClass and
4344 this .hasName ( "getResource" )
4445 }
4546}
4647
4748/** The `getResourceAsStream` method of `ClassLoader`. */
4849class GetClassLoaderResourceAsStreamMethod extends Method {
4950 GetClassLoaderResourceAsStreamMethod ( ) {
50- this .getDeclaringType ( ) . hasQualifiedName ( "java.lang" , "ClassLoader" ) and
51+ this .getDeclaringType ( ) instanceof ClassLoaderClass and
5152 this .hasName ( "getResourceAsStream" )
5253 }
5354}
@@ -73,8 +74,8 @@ class VirtualFile extends RefType {
7374}
7475
7576/** The JBoss method `getChild` of `FileResourceManager`. */
76- class GetVirtualFileMethod extends Method {
77- GetVirtualFileMethod ( ) {
77+ class GetVirtualFileChildMethod extends Method {
78+ GetVirtualFileChildMethod ( ) {
7879 this .getDeclaringType ( ) .getASupertype * ( ) instanceof VirtualFile and
7980 this .hasName ( "getChild" )
8081 }
@@ -91,7 +92,7 @@ private class GetResourceSink extends UnsafeUrlForwardSink {
9192 ma .getMethod ( ) instanceof GetFacesResourceAsStreamMethod or
9293 ma .getMethod ( ) instanceof GetClassResourceAsStreamMethod or
9394 ma .getMethod ( ) instanceof GetClassLoaderResourceAsStreamMethod or
94- ma .getMethod ( ) instanceof GetVirtualFileMethod
95+ ma .getMethod ( ) instanceof GetVirtualFileChildMethod
9596 ) and
9697 ma .getArgument ( 0 ) = this .asExpr ( )
9798 )
0 commit comments