File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
java/ql/lib/semmle/code/java/security Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -96,16 +96,17 @@ private predicate logInjectionSanitizer(MethodCall ma) {
9696 * by checking if there are line breaks in `e`.
9797 */
9898private predicate logInjectionGuard ( Guard g , Expr e , boolean branch ) {
99+ exists ( MethodCall ma | ma = g |
100+ ma .getMethod ( ) instanceof StringContainsMethod and
101+ ma .getArgument ( 0 ) .( CompileTimeConstantExpr ) .getStringValue ( ) = [ "\n" , "\r" ] and
102+ e = ma .getQualifier ( ) and
103+ branch = false
104+ )
105+ or
99106 exists ( MethodCall ma , CompileTimeConstantExpr target |
100107 ma = g and
101108 target = ma .getArgument ( 0 )
102109 |
103- ma .getMethod ( ) .getDeclaringType ( ) instanceof TypeString and
104- ma .getMethod ( ) .hasName ( "contains" ) and
105- target .getStringValue ( ) = [ "\n" , "\r" ] and
106- e = ma .getQualifier ( ) and
107- branch = false
108- or
109110 ma .getMethod ( ) .hasName ( "matches" ) and
110111 (
111112 ma .getMethod ( ) .getDeclaringType ( ) instanceof TypeString and
You can’t perform that action at this time.
0 commit comments