mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
remove FPs in js/build-artifact-leak where the "leaked" properties are constrained to a safe subset
This commit is contained in:
@@ -205,6 +205,7 @@ module CleartextLogging {
|
||||
|
|
||||
not exists(write.getPropertyName()) and
|
||||
not exists(read.getPropertyName()) and
|
||||
not isFilteredPropertyName(read.getPropertyNameExpr().flow().getALocalSource()) and
|
||||
src = read.getBase() and
|
||||
trg = write.getBase().getALocalSource()
|
||||
)
|
||||
@@ -217,4 +218,24 @@ module CleartextLogging {
|
||||
trg.asExpr() = f.getArgumentsVariable().getAnAccess()
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `name` is filtered by e.g. a regular-expression test or a filter call.
|
||||
*/
|
||||
private predicate isFilteredPropertyName(DataFlow::Node name) {
|
||||
exists(DataFlow::MethodCallNode reduceCall |
|
||||
reduceCall.getABoundCallbackParameter(0, 1).flowsTo(name) and
|
||||
reduceCall.getMethodName() = "reduce"
|
||||
|
|
||||
reduceCall.getReceiver+().(DataFlow::MethodCallNode).getMethodName() = "filter"
|
||||
)
|
||||
or
|
||||
exists(StringOps::RegExpTest test |
|
||||
test.getStringOperand().getALocalSource() = name.getALocalSource()
|
||||
)
|
||||
or
|
||||
exists(MembershipCandidate test |
|
||||
test.getAMemberNode().getALocalSource() = name.getALocalSource()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user