Skip to content

Commit d4b964c

Browse files
author
Stephan Brandauer
committed
add support for sanitizers
1 parent 227c5fa commit d4b964c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

java/ql/src/Telemetry/AutomodelApplicationModeCharacteristics.qll

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ private import semmle.code.java.security.QueryInjection
1515
private import semmle.code.java.security.RequestForgery
1616
private import semmle.code.java.dataflow.internal.ModelExclusions as ModelExclusions
1717
private import AutomodelSharedUtil as AutomodelSharedUtil
18+
private import semmle.code.java.security.PathSanitizer as PathSanitizer
1819
import AutomodelSharedCharacteristics as SharedCharacteristics
1920
import AutomodelEndpointTypes as AutomodelEndpointTypes
2021

@@ -48,7 +49,19 @@ module ApplicationCandidatesImpl implements SharedCharacteristics::CandidateSig
4849
class RelatedLocationType = JavaRelatedLocationType;
4950

5051
// Sanitizers are currently not modeled in MaD. TODO: check if this has large negative impact.
51-
predicate isSanitizer(Endpoint e, EndpointType t) { none() }
52+
predicate isSanitizer(Endpoint e, EndpointType t) {
53+
(
54+
exists(t) and
55+
e.getType() instanceof BoxedType
56+
or
57+
e.getType() instanceof PrimitiveType
58+
or
59+
e.getType() instanceof NumberType
60+
)
61+
or
62+
t instanceof AutomodelEndpointTypes::TaintedPathSinkType and
63+
e instanceof PathSanitizer::PathInjectionSanitizer
64+
}
5265

5366
RelatedLocation asLocation(Endpoint e) { result = e.asExpr() }
5467

0 commit comments

Comments
 (0)