mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
Fix performance change in SecurityFlag
This commit is contained in:
@@ -20,9 +20,17 @@ abstract class FlagKind extends string {
|
|||||||
bindingset[result]
|
bindingset[result]
|
||||||
abstract string getAFlagName();
|
abstract string getAFlagName();
|
||||||
|
|
||||||
/** Gets a node representing a (likely) security flag. */
|
private predicate flagFlowStepTC(DataFlow::Node node1, DataFlow::Node node2) {
|
||||||
DataFlow::Node getAFlag() {
|
node2 = node1 and
|
||||||
exists(DataFlow::Node flag |
|
isFlagWithName(node1)
|
||||||
|
or
|
||||||
|
exists(DataFlow::Node nodeMid |
|
||||||
|
flagFlowStep(nodeMid, node2) and
|
||||||
|
flagFlowStepTC(node1, nodeMid)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private predicate isFlagWithName(DataFlow::Node flag) {
|
||||||
exists(VarAccess v | v.getVariable().getName() = getAFlagName() |
|
exists(VarAccess v | v.getVariable().getName() = getAFlagName() |
|
||||||
flag.asExpr() = v and v.getType() instanceof FlagType
|
flag.asExpr() = v and v.getType() instanceof FlagType
|
||||||
)
|
)
|
||||||
@@ -33,8 +41,13 @@ abstract class FlagKind extends string {
|
|||||||
flag.asExpr() = ma and
|
flag.asExpr() = ma and
|
||||||
ma.getType() instanceof FlagType
|
ma.getType() instanceof FlagType
|
||||||
)
|
)
|
||||||
|
|
}
|
||||||
flagFlowStep*(flag, result)
|
|
||||||
|
/** Gets a node representing a (likely) security flag. */
|
||||||
|
DataFlow::Node getAFlag() {
|
||||||
|
exists(DataFlow::Node flag |
|
||||||
|
isFlagWithName(flag) and
|
||||||
|
flagFlowStepTC(flag, result)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user