mirror of
https://github.com/github/codeql.git
synced 2025-12-18 09:43:15 +01:00
40 lines
1.0 KiB
Plaintext
40 lines
1.0 KiB
Plaintext
import javascript
|
|
import semmle.javascript.dataflow.InferredTypes
|
|
import semmle.javascript.dataflow.CustomAbstractValueDefinitions
|
|
|
|
class MyCustomAbstractValueDefinition extends CustomAbstractValueDefinition {
|
|
|
|
DataFlow::ValueNode node;
|
|
|
|
MyCustomAbstractValueDefinition() {
|
|
DataFlow::valueNode(this) = node and
|
|
node instanceof DataFlow::ObjectLiteralNode and
|
|
exists (DataFlow::PropWrite pwn |
|
|
pwn.writes(node, "custom", any(BooleanLiteral l | l.getValue() = "true").flow())
|
|
)
|
|
}
|
|
|
|
override boolean getBooleanValue() {
|
|
result = true
|
|
}
|
|
|
|
override predicate isCoercibleToNumber() {
|
|
none()
|
|
}
|
|
|
|
override PrimitiveAbstractValue toPrimitive() {
|
|
result = TAbstractOtherString()
|
|
}
|
|
|
|
override InferredType getType() { result = TTObject() }
|
|
|
|
override predicate shouldTrackProperties() {
|
|
none()
|
|
}
|
|
|
|
}
|
|
|
|
from AnalyzedValueNode n, MyCustomAbstractValueDefinition def, CustomAbstractValueFromDefinition val
|
|
where def.getAbstractValue() = val and
|
|
n.getAValue() = val
|
|
select n, val |