Skip to content

Commit fedb98d

Browse files
committed
Implement the standard getAReasonSinkExcluded using StandardEndpointFilterCharacteristics
1 parent cf4e37a commit fedb98d

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/StandardEndpointFilters.qll

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,13 @@ private import javascript
1010
private import semmle.javascript.filters.ClassifyFiles as ClassifyFiles
1111
private import semmle.javascript.heuristics.SyntacticHeuristics
1212
private import CoreKnowledge as CoreKnowledge
13+
import EndpointCharacteristics as EndpointCharacteristics
1314

1415
/** Provides a set of reasons why a given data flow node should be excluded as a sink candidate. */
1516
string getAReasonSinkExcluded(DataFlow::Node n) {
16-
isArgumentToModeledFunction(n) and result = "argument to modeled function"
17-
or
18-
isArgumentToSinklessLibrary(n) and result = "argument to sinkless library"
19-
or
20-
isSanitizer(n) and result = "sanitizer"
21-
or
22-
isPredicate(n) and result = "predicate"
23-
or
24-
isHash(n) and result = "hash"
25-
or
26-
isNumeric(n) and result = "numeric"
27-
or
28-
// Ignore candidate sinks within externs, generated, library, and test code
29-
exists(string category | category = ["externs", "generated", "library", "test"] |
30-
ClassifyFiles::classify(n.getFile(), category) and
31-
result = "in " + category + " file"
17+
exists(EndpointCharacteristics::StandardEndpointFilterCharacteristic characteristic |
18+
characteristic.getEndpoints(n) and
19+
result = characteristic
3220
)
3321
}
3422

0 commit comments

Comments
 (0)