rename more acronyms

This commit is contained in:
erik-krogh
2022-08-24 12:59:07 +02:00
parent 06afe9c0f4
commit cc7a9ef97a
93 changed files with 693 additions and 451 deletions

View File

@@ -404,7 +404,10 @@ class Class extends UserType {
* compiled for. For this reason, the `is_pod_class` predicate is * compiled for. For this reason, the `is_pod_class` predicate is
* generated by the extractor. * generated by the extractor.
*/ */
predicate isPOD() { is_pod_class(underlyingElement(this)) } predicate isPod() { is_pod_class(underlyingElement(this)) }
/** DEPRECATED: Alias for isPod */
deprecated predicate isPOD() { this.isPod() }
/** /**
* Holds if this class, struct or union is a standard-layout class * Holds if this class, struct or union is a standard-layout class

View File

@@ -79,17 +79,17 @@ predicate isAggregateType03(Type t) {
* user-defined copy assignment operator and no user-defined destructor. * user-defined copy assignment operator and no user-defined destructor.
* A POD class is a class that is either a POD-struct or a POD-union. * A POD class is a class that is either a POD-struct or a POD-union.
*/ */
predicate isPODClass03(Class c) { predicate isPodClass03(Class c) {
isAggregateClass03(c) and isAggregateClass03(c) and
not exists(Variable v | not exists(Variable v |
v.getDeclaringType() = c and v.getDeclaringType() = c and
not v.isStatic() not v.isStatic()
| |
not isPODType03(v.getType()) not isPodType03(v.getType())
or or
exists(ArrayType at | exists(ArrayType at |
at = v.getType() and at = v.getType() and
not isPODType03(at.getBaseType()) not isPodType03(at.getBaseType())
) )
or or
v.getType() instanceof ReferenceType v.getType() instanceof ReferenceType
@@ -104,6 +104,9 @@ predicate isPODClass03(Class c) {
) )
} }
/** DEPRECATED: Alias for isPodClass03 */
deprecated predicate isPODClass03 = isPodClass03/1;
/** /**
* Holds if `t` is a POD type, according to the rules specified in * Holds if `t` is a POD type, according to the rules specified in
* C++03 3.9(10): * C++03 3.9(10):
@@ -112,14 +115,17 @@ predicate isPODClass03(Class c) {
* such types and cv-qualified versions of these types (3.9.3) are * such types and cv-qualified versions of these types (3.9.3) are
* collectively called POD types. * collectively called POD types.
*/ */
predicate isPODType03(Type t) { predicate isPodType03(Type t) {
exists(Type ut | ut = t.getUnderlyingType() | exists(Type ut | ut = t.getUnderlyingType() |
isScalarType03(ut) isScalarType03(ut)
or or
isPODClass03(ut) isPodClass03(ut)
or or
exists(ArrayType at | at = ut and isPODType03(at.getBaseType())) exists(ArrayType at | at = ut and isPodType03(at.getBaseType()))
or or
isPODType03(ut.(SpecifiedType).getUnspecifiedType()) isPodType03(ut.(SpecifiedType).getUnspecifiedType())
) )
} }
/** DEPRECATED: Alias for isPodType03 */
deprecated predicate isPODType03 = isPodType03/1;

View File

@@ -238,7 +238,7 @@ predicate dependsOnTransitive(DependsSource src, Element dest) {
/** /**
* A dependency that targets a TypeDeclarationEntry. * A dependency that targets a TypeDeclarationEntry.
*/ */
private predicate dependsOnTDE(Element src, Type t, TypeDeclarationEntry dest) { private predicate dependsOnTde(Element src, Type t, TypeDeclarationEntry dest) {
dependsOnTransitive(src, t) and dependsOnTransitive(src, t) and
getDeclarationEntries(t, dest) getDeclarationEntries(t, dest)
} }
@@ -247,8 +247,8 @@ private predicate dependsOnTDE(Element src, Type t, TypeDeclarationEntry dest) {
* A dependency that targets a visible TypeDeclarationEntry. * A dependency that targets a visible TypeDeclarationEntry.
*/ */
pragma[noopt] pragma[noopt]
private predicate dependsOnVisibleTDE(Element src, Type t, TypeDeclarationEntry dest) { private predicate dependsOnVisibleTde(Element src, Type t, TypeDeclarationEntry dest) {
dependsOnTDE(src, t, dest) and dependsOnTde(src, t, dest) and
exists(File g | g = dest.getFile() | exists(File g | g = dest.getFile() |
exists(File f | f = src.getFile() | f.getAnIncludedFile*() = g) exists(File f | f = src.getFile() | f.getAnIncludedFile*() = g)
) )
@@ -260,8 +260,8 @@ private predicate dependsOnVisibleTDE(Element src, Type t, TypeDeclarationEntry
private predicate dependsOnDeclarationEntry(Element src, DeclarationEntry dest) { private predicate dependsOnDeclarationEntry(Element src, DeclarationEntry dest) {
exists(Type t | exists(Type t |
// dependency from a Type use -> unique visible TDE // dependency from a Type use -> unique visible TDE
dependsOnVisibleTDE(src, t, dest) and dependsOnVisibleTde(src, t, dest) and
strictcount(TypeDeclarationEntry alt | dependsOnVisibleTDE(src, t, alt)) = 1 strictcount(TypeDeclarationEntry alt | dependsOnVisibleTde(src, t, alt)) = 1
) )
or or
exists(TypedefType mid | exists(TypedefType mid |

View File

@@ -1,11 +1,14 @@
import semmle.code.cpp.Macro import semmle.code.cpp.Macro
/** A macro defining NULL. */ /** A macro defining NULL. */
class NULLMacro extends Macro { class NullMacro extends Macro {
NULLMacro() { this.getHead() = "NULL" } NullMacro() { this.getHead() = "NULL" }
} }
/** DEPRECATED: Alias for NullMacro */
deprecated class NULLMacro = NullMacro;
/** A use of the NULL macro. */ /** A use of the NULL macro. */
class NULL extends Literal { class NULL extends Literal {
NULL() { exists(NULLMacro nm | this = nm.getAnInvocation().getAnExpandedElement()) } NULL() { exists(NullMacro nm | this = nm.getAnInvocation().getAnExpandedElement()) }
} }

View File

@@ -474,7 +474,7 @@ module FlowVar_internal {
} }
/** Type-specialized version of `getEnclosingElement`. */ /** Type-specialized version of `getEnclosingElement`. */
private ControlFlowNode getCFNParent(ControlFlowNode node) { result = node.getEnclosingElement() } private ControlFlowNode getCfnParent(ControlFlowNode node) { result = node.getEnclosingElement() }
/** /**
* A for-loop or while-loop whose condition is always true upon entry but not * A for-loop or while-loop whose condition is always true upon entry but not
@@ -526,7 +526,7 @@ module FlowVar_internal {
} }
private predicate bbInLoopCondition(BasicBlock bb) { private predicate bbInLoopCondition(BasicBlock bb) {
getCFNParent*(bb.getANode()) = this.(Loop).getCondition() getCfnParent*(bb.getANode()) = this.(Loop).getCondition()
} }
private predicate bbInLoop(BasicBlock bb) { private predicate bbInLoop(BasicBlock bb) {

View File

@@ -165,7 +165,7 @@ private ControlFlowNode mostRecentSideEffect(ControlFlowNode node) {
/** Used to represent the "global value number" of an expression. */ /** Used to represent the "global value number" of an expression. */
cached cached
private newtype GVNBase = private newtype GvnBase =
GVN_IntConst(int val, Type t) { mk_IntConst(val, t, _) } or GVN_IntConst(int val, Type t) { mk_IntConst(val, t, _) } or
GVN_FloatConst(float val, Type t) { mk_FloatConst(val, t, _) } or GVN_FloatConst(float val, Type t) { mk_FloatConst(val, t, _) } or
// If the local variable does not have a defining value, then // If the local variable does not have a defining value, then
@@ -221,8 +221,8 @@ private newtype GVNBase =
* expression with this `GVN` and using its `toString` and `getLocation` * expression with this `GVN` and using its `toString` and `getLocation`
* methods. * methods.
*/ */
class GVN extends GVNBase { class GVN extends GvnBase {
GVN() { this instanceof GVNBase } GVN() { this instanceof GvnBase }
/** Gets an expression that has this GVN. */ /** Gets an expression that has this GVN. */
Expr getAnExpr() { this = globalValueNumber(result) } Expr getAnExpr() { this = globalValueNumber(result) }

View File

@@ -63,17 +63,17 @@ class VariableDeclarationLine extends TVariableDeclarationInfo {
/** /**
* Gets a `VariableDeclarationEntry` on this line. * Gets a `VariableDeclarationEntry` on this line.
*/ */
VariableDeclarationEntry getAVDE() { vdeInfo(result, c, f, line) } VariableDeclarationEntry getAVde() { vdeInfo(result, c, f, line) }
/** /**
* Gets the start column of the first `VariableDeclarationEntry` on this line. * Gets the start column of the first `VariableDeclarationEntry` on this line.
*/ */
int getStartColumn() { result = min(this.getAVDE().getLocation().getStartColumn()) } int getStartColumn() { result = min(this.getAVde().getLocation().getStartColumn()) }
/** /**
* Gets the end column of the last `VariableDeclarationEntry` on this line. * Gets the end column of the last `VariableDeclarationEntry` on this line.
*/ */
int getEndColumn() { result = max(this.getAVDE().getLocation().getEndColumn()) } int getEndColumn() { result = max(this.getAVde().getLocation().getEndColumn()) }
/** /**
* Gets the rank of this `VariableDeclarationLine` in its file and class * Gets the rank of this `VariableDeclarationLine` in its file and class
@@ -134,13 +134,13 @@ class VariableDeclarationGroup extends VariableDeclarationLine {
count(VariableDeclarationLine l | count(VariableDeclarationLine l |
l = this.getProximateNext*() l = this.getProximateNext*()
| |
l.getAVDE().getVariable().getName() l.getAVde().getVariable().getName()
) )
} }
override string toString() { override string toString() {
this.getCount() = 1 and this.getCount() = 1 and
result = "declaration of " + this.getAVDE().getVariable().getName() result = "declaration of " + this.getAVde().getVariable().getName()
or or
this.getCount() > 1 and this.getCount() > 1 and
result = "group of " + this.getCount() + " fields here" result = "group of " + this.getCount() + " fields here"

View File

@@ -16,7 +16,7 @@ import cpp
class JumpTarget extends Stmt { class JumpTarget extends Stmt {
JumpTarget() { exists(GotoStmt g | g.getTarget() = this) } JumpTarget() { exists(GotoStmt g | g.getTarget() = this) }
FunctionDeclarationEntry getFDE() { result.getBlock() = this.getParentStmt+() } FunctionDeclarationEntry getFde() { result.getBlock() = this.getParentStmt+() }
predicate isForward() { predicate isForward() {
exists(GotoStmt g | g.getTarget() = this | exists(GotoStmt g | g.getTarget() = this |
@@ -33,8 +33,8 @@ class JumpTarget extends Stmt {
from FunctionDeclarationEntry fde, int nforward, int nbackward from FunctionDeclarationEntry fde, int nforward, int nbackward
where where
nforward = strictcount(JumpTarget t | t.getFDE() = fde and t.isForward()) and nforward = strictcount(JumpTarget t | t.getFde() = fde and t.isForward()) and
nbackward = strictcount(JumpTarget t | t.getFDE() = fde and t.isBackward()) and nbackward = strictcount(JumpTarget t | t.getFde() = fde and t.isBackward()) and
nforward != 1 and nforward != 1 and
nbackward != 1 nbackward != 1
select fde, select fde,

View File

@@ -13,7 +13,7 @@ import SAL
from Parameter p, Call c, Expr arg from Parameter p, Call c, Expr arg
where where
any(SALNotNull a).getDeclaration() = p and any(SalNotNull a).getDeclaration() = p and
c.getTarget() = p.getFunction() and c.getTarget() = p.getFunction() and
arg = c.getArgument(p.getIndex()) and arg = c.getArgument(p.getIndex()) and
nullValue(arg) nullValue(arg)

View File

@@ -18,7 +18,7 @@ from Function f, FunctionCall call
where where
call.getTarget() = f and call.getTarget() = f and
call instanceof ExprInVoidContext and call instanceof ExprInVoidContext and
any(SALCheckReturn a).getDeclaration() = f and any(SalCheckReturn a).getDeclaration() = f and
not getOptions().okToIgnoreReturnValue(call) not getOptions().okToIgnoreReturnValue(call)
select call, "Return value of $@ discarded although a SAL annotation " + "requires inspecting it.", select call, "Return value of $@ discarded although a SAL annotation " + "requires inspecting it.",
f, f.getName() f, f.getName()

View File

@@ -11,7 +11,7 @@ import SAL
/** Holds if `e` has SAL annotation `name`. */ /** Holds if `e` has SAL annotation `name`. */
predicate hasAnnotation(DeclarationEntry e, string name) { predicate hasAnnotation(DeclarationEntry e, string name) {
exists(SALAnnotation a | exists(SalAnnotation a |
a.getMacro().getName() = name and a.getMacro().getName() = name and
a.getDeclarationEntry() = e a.getDeclarationEntry() = e
) )
@@ -21,7 +21,7 @@ predicate hasAnnotation(DeclarationEntry e, string name) {
predicate inheritsDeclAnnotations(DeclarationEntry e) { predicate inheritsDeclAnnotations(DeclarationEntry e) {
// Is directly annotated // Is directly annotated
e.isDefinition() and e.isDefinition() and
exists(SALAnnotation a | a.getMacro().getName() = "_Use_decl_annotations_" | exists(SalAnnotation a | a.getMacro().getName() = "_Use_decl_annotations_" |
a.getDeclarationEntry() = e a.getDeclarationEntry() = e
) )
or or

View File

@@ -8,8 +8,8 @@ import cpp
/** /**
* A SAL macro defined in `sal.h` or a similar header file. * A SAL macro defined in `sal.h` or a similar header file.
*/ */
class SALMacro extends Macro { class SalMacro extends Macro {
SALMacro() { SalMacro() {
this.getFile().getBaseName() = this.getFile().getBaseName() =
["sal.h", "specstrings_strict.h", "specstrings.h", "w32p.h", "minwindef.h"] and ["sal.h", "specstrings_strict.h", "specstrings.h", "w32p.h", "minwindef.h"] and
( (
@@ -22,15 +22,18 @@ class SALMacro extends Macro {
} }
} }
/** DEPRECATED: Alias for SalMacro */
deprecated class SALMacro = SalMacro;
pragma[noinline] pragma[noinline]
private predicate isTopLevelMacroAccess(MacroAccess ma) { not exists(ma.getParentInvocation()) } private predicate isTopLevelMacroAccess(MacroAccess ma) { not exists(ma.getParentInvocation()) }
/** /**
* An invocation of a SAL macro (excluding invocations inside other macros). * An invocation of a SAL macro (excluding invocations inside other macros).
*/ */
class SALAnnotation extends MacroInvocation { class SalAnnotation extends MacroInvocation {
SALAnnotation() { SalAnnotation() {
this.getMacro() instanceof SALMacro and this.getMacro() instanceof SalMacro and
isTopLevelMacroAccess(this) isTopLevelMacroAccess(this)
} }
@@ -47,23 +50,29 @@ class SALAnnotation extends MacroInvocation {
} }
} }
/** DEPRECATED: Alias for SalAnnotation */
deprecated class SALAnnotation = SalAnnotation;
/** /**
* A SAL macro indicating that the return value of a function should always be * A SAL macro indicating that the return value of a function should always be
* checked. * checked.
*/ */
class SALCheckReturn extends SALAnnotation { class SalCheckReturn extends SalAnnotation {
SALCheckReturn() { SalCheckReturn() {
this.getMacro().(SALMacro).getName() = ["_Check_return_", "_Must_inspect_result_"] this.getMacro().(SalMacro).getName() = ["_Check_return_", "_Must_inspect_result_"]
} }
} }
/** DEPRECATED: Alias for SalCheckReturn */
deprecated class SALCheckReturn = SalCheckReturn;
/** /**
* A SAL macro indicating that a pointer variable or return value should not be * A SAL macro indicating that a pointer variable or return value should not be
* `NULL`. * `NULL`.
*/ */
class SALNotNull extends SALAnnotation { class SalNotNull extends SalAnnotation {
SALNotNull() { SalNotNull() {
exists(SALMacro m | m = this.getMacro() | exists(SalMacro m | m = this.getMacro() |
not m.getName().matches("%\\_opt\\_%") and not m.getName().matches("%\\_opt\\_%") and
( (
m.getName().matches("_In%") or m.getName().matches("_In%") or
@@ -80,12 +89,15 @@ class SALNotNull extends SALAnnotation {
} }
} }
/** DEPRECATED: Alias for SalNotNull */
deprecated class SALNotNull = SalNotNull;
/** /**
* A SAL macro indicating that a value may be `NULL`. * A SAL macro indicating that a value may be `NULL`.
*/ */
class SALMaybeNull extends SALAnnotation { class SalMaybeNull extends SalAnnotation {
SALMaybeNull() { SalMaybeNull() {
exists(SALMacro m | m = this.getMacro() | exists(SalMacro m | m = this.getMacro() |
m.getName().matches("%\\_opt\\_%") or m.getName().matches("%\\_opt\\_%") or
m.getName().matches("\\_Ret_maybenull\\_%") or m.getName().matches("\\_Ret_maybenull\\_%") or
m.getName() = "_Result_nullonfailure_" m.getName() = "_Result_nullonfailure_"
@@ -93,14 +105,17 @@ class SALMaybeNull extends SALAnnotation {
} }
} }
/** DEPRECATED: Alias for SalMaybeNull */
deprecated class SALMaybeNull = SalMaybeNull;
/** /**
* A parameter annotated by one or more SAL annotations. * A parameter annotated by one or more SAL annotations.
*/ */
class SALParameter extends Parameter { class SalParameter extends Parameter {
/** One of this parameter's annotations. */ /** One of this parameter's annotations. */
SALAnnotation a; SalAnnotation a;
SALParameter() { annotatesAt(a, this.getADeclarationEntry(), _, _) } SalParameter() { annotatesAt(a, this.getADeclarationEntry(), _, _) }
predicate isIn() { a.getMacroName().toLowerCase().matches("%\\_in%") } predicate isIn() { a.getMacroName().toLowerCase().matches("%\\_in%") }
@@ -109,14 +124,17 @@ class SALParameter extends Parameter {
predicate isInOut() { a.getMacroName().toLowerCase().matches("%\\_inout%") } predicate isInOut() { a.getMacroName().toLowerCase().matches("%\\_inout%") }
} }
/** DEPRECATED: Alias for SalParameter */
deprecated class SALParameter = SalParameter;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Implementation details // Implementation details
/** /**
* Holds if `a` annotates the declaration entry `d` and * Holds if `a` annotates the declaration entry `d` and
* its start position is the `idx`th position in `file` that holds a SAL element. * its start position is the `idx`th position in `file` that holds a SAL element.
*/ */
private predicate annotatesAt(SALAnnotation a, DeclarationEntry d, File file, int idx) { private predicate annotatesAt(SalAnnotation a, DeclarationEntry d, File file, int idx) {
annotatesAtPosition(a.(SALElement).getStartPosition(), d, file, idx) annotatesAtPosition(a.(SalElement).getStartPosition(), d, file, idx)
} }
/** /**
@@ -127,12 +145,12 @@ private predicate annotatesAt(SALAnnotation a, DeclarationEntry d, File file, in
// For performance reasons, do not mention the annotation itself here, // For performance reasons, do not mention the annotation itself here,
// but compute with positions instead. This performs better on databases // but compute with positions instead. This performs better on databases
// with many annotations at the same position. // with many annotations at the same position.
private predicate annotatesAtPosition(SALPosition pos, DeclarationEntry d, File file, int idx) { private predicate annotatesAtPosition(SalPosition pos, DeclarationEntry d, File file, int idx) {
pos = salRelevantPositionAt(file, idx) and pos = salRelevantPositionAt(file, idx) and
salAnnotationPos(pos) and salAnnotationPos(pos) and
( (
// Base case: `pos` right before `d` // Base case: `pos` right before `d`
d.(SALElement).getStartPosition() = salRelevantPositionAt(file, idx + 1) d.(SalElement).getStartPosition() = salRelevantPositionAt(file, idx + 1)
or or
// Recursive case: `pos` right before some annotation on `d` // Recursive case: `pos` right before some annotation on `d`
annotatesAtPosition(_, d, file, idx + 1) annotatesAtPosition(_, d, file, idx + 1)
@@ -143,10 +161,10 @@ private predicate annotatesAtPosition(SALPosition pos, DeclarationEntry d, File
* A SAL element, that is, a SAL annotation or a declaration entry * A SAL element, that is, a SAL annotation or a declaration entry
* that may have SAL annotations. * that may have SAL annotations.
*/ */
library class SALElement extends Element { library class SalElement extends Element {
SALElement() { SalElement() {
containsSALAnnotation(this.(DeclarationEntry).getFile()) or containsSalAnnotation(this.(DeclarationEntry).getFile()) or
this instanceof SALAnnotation this instanceof SalAnnotation
} }
predicate hasStartPosition(File file, int line, int col) { predicate hasStartPosition(File file, int line, int col) {
@@ -173,25 +191,28 @@ library class SALElement extends Element {
) )
} }
SALPosition getStartPosition() { SalPosition getStartPosition() {
exists(File file, int line, int col | exists(File file, int line, int col |
this.hasStartPosition(file, line, col) and this.hasStartPosition(file, line, col) and
result = MkSALPosition(file, line, col) result = MkSalPosition(file, line, col)
) )
} }
} }
/** DEPRECATED: Alias for SalElement */
deprecated class SALElement = SalElement;
/** Holds if `file` contains a SAL annotation. */ /** Holds if `file` contains a SAL annotation. */
pragma[noinline] pragma[noinline]
private predicate containsSALAnnotation(File file) { any(SALAnnotation a).getFile() = file } private predicate containsSalAnnotation(File file) { any(SalAnnotation a).getFile() = file }
/** /**
* A source-file position of a `SALElement`. Unlike location, this denotes a * A source-file position of a `SALElement`. Unlike location, this denotes a
* point in the file rather than a range. * point in the file rather than a range.
*/ */
private newtype SALPosition = private newtype SalPosition =
MkSALPosition(File file, int line, int col) { MkSalPosition(File file, int line, int col) {
exists(SALElement e | exists(SalElement e |
e.hasStartPosition(file, line, col) e.hasStartPosition(file, line, col)
or or
e.hasEndPosition(file, line, col) e.hasEndPosition(file, line, col)
@@ -200,18 +221,18 @@ private newtype SALPosition =
/** Holds if `pos` is the start position of a SAL annotation. */ /** Holds if `pos` is the start position of a SAL annotation. */
pragma[noinline] pragma[noinline]
private predicate salAnnotationPos(SALPosition pos) { private predicate salAnnotationPos(SalPosition pos) {
any(SALAnnotation a).(SALElement).getStartPosition() = pos any(SalAnnotation a).(SalElement).getStartPosition() = pos
} }
/** /**
* Gets the `idx`th position in `file` that holds a SAL element, * Gets the `idx`th position in `file` that holds a SAL element,
* ordering positions lexicographically by their start line and start column. * ordering positions lexicographically by their start line and start column.
*/ */
private SALPosition salRelevantPositionAt(File file, int idx) { private SalPosition salRelevantPositionAt(File file, int idx) {
result = result =
rank[idx](SALPosition pos, int line, int col | rank[idx](SalPosition pos, int line, int col |
pos = MkSALPosition(file, line, col) pos = MkSalPosition(file, line, col)
| |
pos order by line, col pos order by line, col
) )

View File

@@ -24,7 +24,7 @@ where
if e = DefinitionInSnapshot() if e = DefinitionInSnapshot()
then defined = "" then defined = ""
else else
if e = SuggestiveSALAnnotation() if e = SuggestiveSalAnnotation()
then defined = "externally defined (SAL) " then defined = "externally defined (SAL) "
else defined = "externally defined (CSV) " else defined = "externally defined (CSV) "
) )

View File

@@ -149,7 +149,7 @@ newtype Evidence =
* The function is externally defined, but the parameter has an `_out` SAL annotation which * The function is externally defined, but the parameter has an `_out` SAL annotation which
* suggests that it is initialized in the function. * suggests that it is initialized in the function.
*/ */
SuggestiveSALAnnotation() or SuggestiveSalAnnotation() or
/** /**
* We have been given a CSV file which indicates this parameter is conditionally initialized. * We have been given a CSV file which indicates this parameter is conditionally initialized.
*/ */
@@ -198,8 +198,8 @@ class InitializationFunction extends Function {
or or
// If we have no definition, we look at SAL annotations // If we have no definition, we look at SAL annotations
not this.hasDefinition() and not this.hasDefinition() and
this.getParameter(i).(SALParameter).isOut() and this.getParameter(i).(SalParameter).isOut() and
evidence = SuggestiveSALAnnotation() evidence = SuggestiveSalAnnotation()
or or
// We have some external information that this function conditionally initializes // We have some external information that this function conditionally initializes
not this.hasDefinition() and not this.hasDefinition() and

View File

@@ -19,8 +19,8 @@ import DataFlow::PathGraph
/** /**
* A configuration for tracking XML objects and their states. * A configuration for tracking XML objects and their states.
*/ */
class XXEConfiguration extends DataFlow::Configuration { class XxeConfiguration extends DataFlow::Configuration {
XXEConfiguration() { this = "XXEConfiguration" } XxeConfiguration() { this = "XXEConfiguration" }
override predicate isSource(DataFlow::Node node, string flowstate) { override predicate isSource(DataFlow::Node node, string flowstate) {
any(XmlLibrary l).configurationSource(node, flowstate) any(XmlLibrary l).configurationSource(node, flowstate)
@@ -45,7 +45,7 @@ class XXEConfiguration extends DataFlow::Configuration {
} }
} }
from XXEConfiguration conf, DataFlow::PathNode source, DataFlow::PathNode sink from XxeConfiguration conf, DataFlow::PathNode source, DataFlow::PathNode sink
where conf.hasFlowPath(source, sink) where conf.hasFlowPath(source, sink)
select sink, source, sink, select sink, source, sink,
"This $@ is not configured to prevent an XML external entity (XXE) attack.", source, "XML parser" "This $@ is not configured to prevent an XML external entity (XXE) attack.", source, "XML parser"

View File

@@ -16,17 +16,17 @@ import cpp
// pointers. This will obviously not catch code that uses inline assembly to achieve // pointers. This will obviously not catch code that uses inline assembly to achieve
// self-modification, nor will it spot the use of OS mechanisms to write into process // self-modification, nor will it spot the use of OS mechanisms to write into process
// memory (such as WriteProcessMemory under Windows). // memory (such as WriteProcessMemory under Windows).
predicate maybeSMCConversion(Type t1, Type t2) { predicate maybeSmcConversion(Type t1, Type t2) {
t1 instanceof FunctionPointerType and t1 instanceof FunctionPointerType and
t2 instanceof PointerType and t2 instanceof PointerType and
not t2 instanceof FunctionPointerType and not t2 instanceof FunctionPointerType and
not t2 instanceof VoidPointerType not t2 instanceof VoidPointerType
or or
maybeSMCConversion(t2, t1) maybeSmcConversion(t2, t1)
} }
from Expr e from Expr e
where where
e.fromSource() and e.fromSource() and
maybeSMCConversion(e.getUnderlyingType(), e.getActualType()) maybeSmcConversion(e.getUnderlyingType(), e.getActualType())
select e, "AV Rule 2: There shall not be any self-modifying code." select e, "AV Rule 2: There shall not be any self-modifying code."

View File

@@ -1,5 +1,5 @@
import cpp import cpp
from Class c, boolean ispod from Class c, boolean ispod
where if c.isPOD() then ispod = true else ispod = false where if c.isPod() then ispod = true else ispod = false
select c, ispod select c, ispod

View File

@@ -1,5 +1,5 @@
import semmle.code.cpp.PODType03 import semmle.code.cpp.PODType03
from Class c, boolean ispod from Class c, boolean ispod
where if isPODClass03(c) then ispod = true else ispod = false where if isPodClass03(c) then ispod = true else ispod = false
select c, ispod select c, ispod

View File

@@ -1,4 +1,4 @@
import Microsoft.SAL import Microsoft.SAL
from SALAnnotation a from SalAnnotation a
select a, a.getDeclaration() select a, a.getDeclaration()

View File

@@ -15,7 +15,7 @@ import experimental.code.csharp.Cryptography.NonCryptographicHashes
from Variable v, Literal l, LoopStmt loop, Expr additional_xor from Variable v, Literal l, LoopStmt loop, Expr additional_xor
where where
maybeUsedInFNVFunction(v, _, _, loop) and maybeUsedInFnvFunction(v, _, _, loop) and
( (
exists(BitwiseXorExpr xor2 | xor2.getAnOperand() = l and additional_xor = xor2 | exists(BitwiseXorExpr xor2 | xor2.getAnOperand() = l and additional_xor = xor2 |
loop.getAControlFlowExitNode().getASuccessor*() = xor2.getAControlFlowNode() and loop.getAControlFlowExitNode().getASuccessor*() = xor2.getAControlFlowNode() and

View File

@@ -13,7 +13,7 @@ private import semmle.code.csharp.dataflow.TaintTracking2
predicate maybeANonCryptogrphicHash(Callable callable, Variable v, Expr xor, Expr mul, LoopStmt loop) { predicate maybeANonCryptogrphicHash(Callable callable, Variable v, Expr xor, Expr mul, LoopStmt loop) {
callable = loop.getEnclosingCallable() and callable = loop.getEnclosingCallable() and
( (
maybeUsedInFNVFunction(v, xor, mul, loop) or maybeUsedInFnvFunction(v, xor, mul, loop) or
maybeUsedInElfHashFunction(v, xor, mul, loop) maybeUsedInElfHashFunction(v, xor, mul, loop)
) )
} }
@@ -23,7 +23,7 @@ predicate maybeANonCryptogrphicHash(Callable callable, Variable v, Expr xor, Exp
* where there is a loop statement `loop` where the variable `v` is used in an xor `xor` expression * where there is a loop statement `loop` where the variable `v` is used in an xor `xor` expression
* followed by a multiplication `mul` expression. * followed by a multiplication `mul` expression.
*/ */
predicate maybeUsedInFNVFunction(Variable v, Operation xor, Operation mul, LoopStmt loop) { predicate maybeUsedInFnvFunction(Variable v, Operation xor, Operation mul, LoopStmt loop) {
exists(Expr e1, Expr e2 | exists(Expr e1, Expr e2 |
e1.getAChild*() = v.getAnAccess() and e1.getAChild*() = v.getAnAccess() and
e2.getAChild*() = v.getAnAccess() and e2.getAChild*() = v.getAnAccess() and
@@ -37,6 +37,9 @@ predicate maybeUsedInFNVFunction(Variable v, Operation xor, Operation mul, LoopS
loop.getAChild*() = xor.getEnclosingStmt() loop.getAChild*() = xor.getEnclosingStmt()
} }
/** DEPRECATED: Alias for maybeUsedInFnvFunction */
deprecated predicate maybeUsedInFNVFunction = maybeUsedInFnvFunction/4;
/** /**
* Holds if the arguments are used in a way that resembles an Elf-Hash hash function * Holds if the arguments are used in a way that resembles an Elf-Hash hash function
* where there is a loop statement `loop` where the variable `v` is used in an xor `xor` expression * where there is a loop statement `loop` where the variable `v` is used in an xor `xor` expression

View File

@@ -6,7 +6,7 @@ import csharp
private import Email::Email private import Email::Email
private import ExternalLocationSink private import ExternalLocationSink
private import Html private import Html
private import semmle.code.csharp.security.dataflow.XSSSinks as XSSSinks private import semmle.code.csharp.security.dataflow.XSSSinks as XssSinks
private import semmle.code.csharp.frameworks.system.web.UI private import semmle.code.csharp.frameworks.system.web.UI
/** A data flow sink of remote user output. */ /** A data flow sink of remote user output. */

View File

@@ -24,7 +24,7 @@ predicate incorrectUseOfRC2(Assignment e, string msg) {
msg = "Key size should be at least 128 bits for RC2 encryption." msg = "Key size should be at least 128 bits for RC2 encryption."
} }
predicate incorrectUseOfDSA(ObjectCreation e, string msg) { predicate incorrectUseOfDsa(ObjectCreation e, string msg) {
e.getTarget() e.getTarget()
.getDeclaringType() .getDeclaringType()
.hasQualifiedName("System.Security.Cryptography", "DSACryptoServiceProvider") and .hasQualifiedName("System.Security.Cryptography", "DSACryptoServiceProvider") and
@@ -32,7 +32,7 @@ predicate incorrectUseOfDSA(ObjectCreation e, string msg) {
msg = "Key size should be at least 2048 bits for DSA encryption." msg = "Key size should be at least 2048 bits for DSA encryption."
} }
predicate incorrectUseOfRSA(ObjectCreation e, string msg) { predicate incorrectUseOfRsa(ObjectCreation e, string msg) {
e.getTarget() e.getTarget()
.getDeclaringType() .getDeclaringType()
.hasQualifiedName("System.Security.Cryptography", "RSACryptoServiceProvider") and .hasQualifiedName("System.Security.Cryptography", "RSACryptoServiceProvider") and
@@ -43,6 +43,6 @@ predicate incorrectUseOfRSA(ObjectCreation e, string msg) {
from Expr e, string msg from Expr e, string msg
where where
incorrectUseOfRC2(e, msg) or incorrectUseOfRC2(e, msg) or
incorrectUseOfDSA(e, msg) or incorrectUseOfDsa(e, msg) or
incorrectUseOfRSA(e, msg) incorrectUseOfRsa(e, msg)
select e, msg select e, msg

View File

@@ -65,7 +65,7 @@ newtype TInstructionTag =
PointerAddTag(int index) { index in [0 .. 255] } or PointerAddTag(int index) { index in [0 .. 255] } or
ElementsAddressTag(int index) { index in [0 .. 255] } or ElementsAddressTag(int index) { index in [0 .. 255] } or
ConvertTag() or ConvertTag() or
GeneratedNEQTag() or GeneratedNeqTag() or
GeneratedConstantTag() or GeneratedConstantTag() or
GeneratedBranchTag() GeneratedBranchTag()
@@ -181,7 +181,7 @@ string getInstructionTagId(TInstructionTag tag) {
or or
tag = ConvertTag() and result = "Convert" tag = ConvertTag() and result = "Convert"
or or
tag = GeneratedNEQTag() and result = "GeneratedNEQTag" tag = GeneratedNeqTag() and result = "GeneratedNEQTag"
or or
tag = GeneratedConstantTag() and result = "GeneratedConstantTag" tag = GeneratedConstantTag() and result = "GeneratedConstantTag"
or or

View File

@@ -1710,7 +1710,7 @@ class TranslatedIsExpr extends TranslatedNonConstantExpr {
result = this.getParent().getChildSuccessor(this) result = this.getParent().getChildSuccessor(this)
or or
( (
tag = GeneratedNEQTag() and tag = GeneratedNeqTag() and
kind instanceof GotoEdge and kind instanceof GotoEdge and
if this.hasVar() if this.hasVar()
then result = this.getInstruction(GeneratedBranchTag()) then result = this.getInstruction(GeneratedBranchTag())
@@ -1733,7 +1733,7 @@ class TranslatedIsExpr extends TranslatedNonConstantExpr {
kind instanceof GotoEdge and kind instanceof GotoEdge and
if this.hasVar() if this.hasVar()
then result = this.getPatternVarDecl().getFirstInstruction() then result = this.getPatternVarDecl().getFirstInstruction()
else result = this.getInstruction(GeneratedNEQTag()) else result = this.getInstruction(GeneratedNeqTag())
} }
override Instruction getChildSuccessor(TranslatedElement child) { override Instruction getChildSuccessor(TranslatedElement child) {
@@ -1742,7 +1742,7 @@ class TranslatedIsExpr extends TranslatedNonConstantExpr {
or or
this.hasVar() and this.hasVar() and
child = this.getPatternVarDecl() and child = this.getPatternVarDecl() and
result = this.getInstruction(GeneratedNEQTag()) result = this.getInstruction(GeneratedNeqTag())
} }
override predicate hasInstruction(Opcode opcode, InstructionTag tag, CSharpType resultType) { override predicate hasInstruction(Opcode opcode, InstructionTag tag, CSharpType resultType) {
@@ -1755,7 +1755,7 @@ class TranslatedIsExpr extends TranslatedNonConstantExpr {
opcode instanceof Opcode::CheckedConvertOrNull and opcode instanceof Opcode::CheckedConvertOrNull and
resultType = getTypeForPRValue(expr.getPattern().getType()) resultType = getTypeForPRValue(expr.getPattern().getType())
or or
tag = GeneratedNEQTag() and tag = GeneratedNeqTag() and
opcode instanceof Opcode::CompareNE and opcode instanceof Opcode::CompareNE and
resultType = getTypeForPRValue(expr.getType()) resultType = getTypeForPRValue(expr.getType())
or or
@@ -1775,7 +1775,7 @@ class TranslatedIsExpr extends TranslatedNonConstantExpr {
result = "0" result = "0"
} }
override Instruction getResult() { result = this.getInstruction(GeneratedNEQTag()) } override Instruction getResult() { result = this.getInstruction(GeneratedNeqTag()) }
override Instruction getInstructionOperand(InstructionTag tag, OperandTag operandTag) { override Instruction getInstructionOperand(InstructionTag tag, OperandTag operandTag) {
tag = ConvertTag() and tag = ConvertTag() and
@@ -1792,7 +1792,7 @@ class TranslatedIsExpr extends TranslatedNonConstantExpr {
result = this.getPatternVarDecl().getTargetAddress() result = this.getPatternVarDecl().getTargetAddress()
) )
or or
tag = GeneratedNEQTag() and tag = GeneratedNeqTag() and
( (
operandTag instanceof LeftOperandTag and operandTag instanceof LeftOperandTag and
result = this.getInstruction(ConvertTag()) result = this.getInstruction(ConvertTag())
@@ -1804,7 +1804,7 @@ class TranslatedIsExpr extends TranslatedNonConstantExpr {
this.hasVar() and this.hasVar() and
tag = GeneratedBranchTag() and tag = GeneratedBranchTag() and
operandTag instanceof ConditionOperandTag and operandTag instanceof ConditionOperandTag and
result = this.getInstruction(GeneratedNEQTag()) result = this.getInstruction(GeneratedNeqTag())
} }
private TranslatedExpr getIsExpr() { result = getTranslatedExpr(expr.getExpr()) } private TranslatedExpr getIsExpr() { result = getTranslatedExpr(expr.getExpr()) }

View File

@@ -12,7 +12,10 @@ class Boolean extends boolean {
/** /**
* Gets a regexp pattern that matches common top-level domain names. * Gets a regexp pattern that matches common top-level domain names.
*/ */
string commonTLD() { string commonTld() {
// according to ranking by http://google.com/search?q=site:.<<TLD>> // according to ranking by http://google.com/search?q=site:.<<TLD>>
result = "(?:com|org|edu|gov|uk|net|io)(?![a-z0-9])" result = "(?:com|org|edu|gov|uk|net|io)(?![a-z0-9])"
} }
/** DEPRECATED: Alias for commonTld */
deprecated string commonTLD() { result = commonTld() }

View File

@@ -114,7 +114,7 @@ private predicate entryNode(ControlFlow::Node node) { node.isEntryNode() }
* graph so that we can use the dominator tree to find the most recent * graph so that we can use the dominator tree to find the most recent
* side-effect. * side-effect.
*/ */
private predicate sideEffectCFG(ControlFlow::Node src, ControlFlow::Node dst) { private predicate sideEffectCfg(ControlFlow::Node src, ControlFlow::Node dst) {
src.getASuccessor() = dst src.getASuccessor() = dst
or or
// Add an edge from the entry point to any node that might have a side // Add an edge from the entry point to any node that might have a side
@@ -128,7 +128,7 @@ private predicate sideEffectCFG(ControlFlow::Node src, ControlFlow::Node dst) {
* the side-effect CFG. * the side-effect CFG.
*/ */
private predicate iDomEffect(ControlFlow::Node dominator, ControlFlow::Node node) = private predicate iDomEffect(ControlFlow::Node dominator, ControlFlow::Node node) =
idominance(entryNode/1, sideEffectCFG/2)(_, dominator, node) idominance(entryNode/1, sideEffectCfg/2)(_, dominator, node)
/** /**
* Gets the most recent side effect. To be more precise, `result` is a * Gets the most recent side effect. To be more precise, `result` is a
@@ -190,7 +190,7 @@ private ControlFlow::Node mostRecentSideEffect(ControlFlow::Node node) {
/** Used to represent the "global value number" of an expression. */ /** Used to represent the "global value number" of an expression. */
cached cached
private newtype GVNBase = private newtype GvnBase =
MkNumericConst(string val) { mkNumericConst(_, val) } or MkNumericConst(string val) { mkNumericConst(_, val) } or
MkStringConst(string val) { mkStringConst(_, val) } or MkStringConst(string val) { mkStringConst(_, val) } or
MkBoolConst(boolean val) { mkBoolConst(_, val) } or MkBoolConst(boolean val) { mkBoolConst(_, val) } or
@@ -204,7 +204,7 @@ private newtype GVNBase =
MkOtherVariable(ValueEntity x, ControlFlow::Node dominator) { mkOtherVariable(_, x, dominator) } or MkOtherVariable(ValueEntity x, ControlFlow::Node dominator) { mkOtherVariable(_, x, dominator) } or
MkMethodAccess(GVN base, Function m) { mkMethodAccess(_, base, m) } or MkMethodAccess(GVN base, Function m) { mkMethodAccess(_, base, m) } or
MkFieldRead(GVN base, Field f, ControlFlow::Node dominator) { mkFieldRead(_, base, f, dominator) } or MkFieldRead(GVN base, Field f, ControlFlow::Node dominator) { mkFieldRead(_, base, f, dominator) } or
MkPureCall(Function f, GVN callee, GVNList args) { mkPureCall(_, f, callee, args) } or MkPureCall(Function f, GVN callee, GvnList args) { mkPureCall(_, f, callee, args) } or
MkIndex(GVN base, GVN index, ControlFlow::Node dominator) { mkIndex(_, base, index, dominator) } or MkIndex(GVN base, GVN index, ControlFlow::Node dominator) { mkIndex(_, base, index, dominator) } or
// Dereference a pointer. The value might have changed since the last // Dereference a pointer. The value might have changed since the last
// time the pointer was dereferenced, so we need to include a definition // time the pointer was dereferenced, so we need to include a definition
@@ -217,22 +217,22 @@ private newtype GVNBase =
// given a unique number based on the expression itself. // given a unique number based on the expression itself.
MkUnanalyzable(DataFlow::Node e) { not analyzableExpr(e) } MkUnanalyzable(DataFlow::Node e) { not analyzableExpr(e) }
private newtype GVNList = private newtype GvnList =
MkNil() or MkNil() or
MkCons(GVN head, GVNList tail) { globalValueNumbers(_, _, head, tail) } MkCons(GVN head, GvnList tail) { globalValueNumbers(_, _, head, tail) }
private GVNList globalValueNumbers(DataFlow::CallNode ce, int start) { private GvnList globalValueNumbers(DataFlow::CallNode ce, int start) {
analyzableCall(ce, _) and analyzableCall(ce, _) and
start = ce.getNumArgument() and start = ce.getNumArgument() and
result = MkNil() result = MkNil()
or or
exists(GVN head, GVNList tail | exists(GVN head, GvnList tail |
globalValueNumbers(ce, start, head, tail) and globalValueNumbers(ce, start, head, tail) and
result = MkCons(head, tail) result = MkCons(head, tail)
) )
} }
private predicate globalValueNumbers(DataFlow::CallNode ce, int start, GVN head, GVNList tail) { private predicate globalValueNumbers(DataFlow::CallNode ce, int start, GVN head, GvnList tail) {
analyzableCall(ce, _) and analyzableCall(ce, _) and
head = globalValueNumber(ce.getArgument(start)) and head = globalValueNumber(ce.getArgument(start)) and
tail = globalValueNumbers(ce, start + 1) tail = globalValueNumbers(ce, start + 1)
@@ -254,8 +254,8 @@ private predicate globalValueNumbers(DataFlow::CallNode ce, int start, GVN head,
* expression with this `GVN` and using its `toString` and `getLocation` * expression with this `GVN` and using its `toString` and `getLocation`
* methods. * methods.
*/ */
class GVN extends GVNBase { class GVN extends GvnBase {
GVN() { this instanceof GVNBase } GVN() { this instanceof GvnBase }
/** Gets a data-flow node that has this GVN. */ /** Gets a data-flow node that has this GVN. */
DataFlow::Node getANode() { this = globalValueNumber(result) } DataFlow::Node getANode() { this = globalValueNumber(result) }
@@ -386,7 +386,7 @@ private predicate analyzableCall(DataFlow::CallNode ce, Function f) {
not ce.isConst() not ce.isConst()
} }
private predicate mkPureCall(DataFlow::CallNode ce, Function f, GVN callee, GVNList args) { private predicate mkPureCall(DataFlow::CallNode ce, Function f, GVN callee, GvnList args) {
analyzableCall(ce, f) and analyzableCall(ce, f) and
callee = globalValueNumber(ce.getCalleeNode()) and callee = globalValueNumber(ce.getCalleeNode()) and
args = globalValueNumbers(ce, 0) args = globalValueNumbers(ce, 0)
@@ -523,7 +523,7 @@ GVN globalValueNumber(DataFlow::Node nd) {
result = MkFieldRead(qualifier, target, dominator) result = MkFieldRead(qualifier, target, dominator)
) )
or or
exists(Function f, GVN callee, GVNList args | exists(Function f, GVN callee, GvnList args |
mkPureCall(nd, f, callee, args) and mkPureCall(nd, f, callee, args) and
result = MkPureCall(f, callee, args) result = MkPureCall(f, callee, args)
) )

View File

@@ -24,10 +24,10 @@ Expr getCondition(IfStmt stmt, int i) {
} }
/** Gets the global value number of `e`, which is the `i`th condition of `is`. */ /** Gets the global value number of `e`, which is the `i`th condition of `is`. */
GVN conditionGVN(IfStmt is, int i, Expr e) { GVN conditionGvn(IfStmt is, int i, Expr e) {
e = getCondition(is, i) and result = e.getGlobalValueNumber() e = getCondition(is, i) and result = e.getGlobalValueNumber()
} }
from IfStmt is, Expr e, Expr f, int i, int j from IfStmt is, Expr e, Expr f, int i, int j
where conditionGVN(is, i, e) = conditionGVN(is, j, f) and i < j where conditionGvn(is, i, e) = conditionGvn(is, j, f) and i < j
select f, "This condition is a duplicate of $@.", e, "an earlier condition" select f, "This condition is a duplicate of $@.", e, "an earlier condition"

View File

@@ -14,10 +14,10 @@
import go import go
/** Gets the global value number of `e`, which is the `i`th case label of `switch`. */ /** Gets the global value number of `e`, which is the `i`th case label of `switch`. */
GVN switchCaseGVN(SwitchStmt switch, int i, Expr e) { GVN switchCaseGvn(SwitchStmt switch, int i, Expr e) {
e = switch.getCase(i).getExpr(0) and result = e.getGlobalValueNumber() e = switch.getCase(i).getExpr(0) and result = e.getGlobalValueNumber()
} }
from SwitchStmt switch, int i, Expr e, int j, Expr f from SwitchStmt switch, int i, Expr e, int j, Expr f
where switchCaseGVN(switch, i, e) = switchCaseGVN(switch, j, f) and i < j where switchCaseGvn(switch, i, e) = switchCaseGvn(switch, j, f) and i < j
select f, "This case is a duplicate of $@.", e, "an earlier case" select f, "This case is a duplicate of $@.", e, "an earlier case"

View File

@@ -28,7 +28,7 @@ predicate isIncompleteHostNameRegexpPattern(string pattern, string hostPart) {
"(?<!\\\\)[.]" + "(?<!\\\\)[.]" +
// immediately followed by a sequence of subdomains, perhaps with some regex characters mixed in, // immediately followed by a sequence of subdomains, perhaps with some regex characters mixed in,
// followed by a known TLD // followed by a known TLD
"(([():|?a-z0-9-]+(\\\\)?[.])?" + commonTLD() + ")" + ".*", 1) "(([():|?a-z0-9-]+(\\\\)?[.])?" + commonTld() + ")" + ".*", 1)
} }
/** Holds if `b` sets the HTTP status code (represented by a pseudo-header named `status`) */ /** Holds if `b` sets the HTTP status code (represented by a pseudo-header named `status`) */

View File

@@ -52,7 +52,7 @@ predicate isInterestingSemiAnchoredRegexpString(string re, string msg) {
bindingset[re] bindingset[re]
predicate isInterestingUnanchoredRegexpString(string re, string msg) { predicate isInterestingUnanchoredRegexpString(string re, string msg) {
// a substring sequence of a protocol and subdomains, perhaps with some regex characters mixed in, followed by a known TLD // a substring sequence of a protocol and subdomains, perhaps with some regex characters mixed in, followed by a known TLD
re.regexpMatch("(?i)[():|?a-z0-9-\\\\./]+[.]" + commonTLD() + "([/#?():]\\S*)?") and re.regexpMatch("(?i)[():|?a-z0-9-\\\\./]+[.]" + commonTld() + "([/#?():]\\S*)?") and
// without any anchors // without any anchors
not re.regexpMatch(".*(\\$|\\^|\\\\A|\\\\z).*") and not re.regexpMatch(".*(\\$|\\^|\\\\A|\\\\z).*") and
msg = msg =

View File

@@ -27,7 +27,7 @@ class MXBean extends ManagedBean {
class RegisteredManagedBeanImpl extends Class { class RegisteredManagedBeanImpl extends Class {
RegisteredManagedBeanImpl() { RegisteredManagedBeanImpl() {
this.getAnAncestor() instanceof ManagedBean and this.getAnAncestor() instanceof ManagedBean and
exists(JMXRegistrationCall registerCall | registerCall.getObjectArgument().getType() = this) exists(JmxRegistrationCall registerCall | registerCall.getObjectArgument().getType() = this)
} }
/** /**
@@ -39,32 +39,35 @@ class RegisteredManagedBeanImpl extends Class {
/** /**
* A call that registers an object with the `MBeanServer`, directly or indirectly. * A call that registers an object with the `MBeanServer`, directly or indirectly.
*/ */
class JMXRegistrationCall extends MethodAccess { class JmxRegistrationCall extends MethodAccess {
JMXRegistrationCall() { this.getCallee() instanceof JMXRegistrationMethod } JmxRegistrationCall() { this.getCallee() instanceof JmxRegistrationMethod }
/** /**
* Gets the argument that represents the object in the registration call. * Gets the argument that represents the object in the registration call.
*/ */
Expr getObjectArgument() { Expr getObjectArgument() {
result = this.getArgument(this.getCallee().(JMXRegistrationMethod).getObjectPosition()) result = this.getArgument(this.getCallee().(JmxRegistrationMethod).getObjectPosition())
} }
} }
/** DEPRECATED: Alias for JmxRegistrationCall */
deprecated class JMXRegistrationCall = JmxRegistrationCall;
/** /**
* A method used to register `MBean` and `MXBean` instances with the `MBeanServer`. * A method used to register `MBean` and `MXBean` instances with the `MBeanServer`.
* *
* This is either the `registerMBean` method on `MBeanServer`, or it is a wrapper around that * This is either the `registerMBean` method on `MBeanServer`, or it is a wrapper around that
* registration method. * registration method.
*/ */
class JMXRegistrationMethod extends Method { class JmxRegistrationMethod extends Method {
JMXRegistrationMethod() { JmxRegistrationMethod() {
// A direct registration with the `MBeanServer`. // A direct registration with the `MBeanServer`.
this.getDeclaringType().hasQualifiedName("javax.management", "MBeanServer") and this.getDeclaringType().hasQualifiedName("javax.management", "MBeanServer") and
this.getName() = "registerMBean" this.getName() = "registerMBean"
or or
// The `MBeanServer` is often wrapped by an application specific management class, so identify // The `MBeanServer` is often wrapped by an application specific management class, so identify
// methods that wrap a call to another `JMXRegistrationMethod`. // methods that wrap a call to another `JmxRegistrationMethod`.
exists(JMXRegistrationCall c | exists(JmxRegistrationCall c |
// This must be a call to another JMX registration method, where the object argument is an access // This must be a call to another JMX registration method, where the object argument is an access
// of one of the parameters of this method. // of one of the parameters of this method.
c.getObjectArgument().(VarAccess).getVariable() = this.getAParameter() c.getObjectArgument().(VarAccess).getVariable() = this.getAParameter()
@@ -81,25 +84,37 @@ class JMXRegistrationMethod extends Method {
result = 0 result = 0
or or
// Identify the position in this method where the object parameter should be passed. // Identify the position in this method where the object parameter should be passed.
exists(JMXRegistrationCall c | exists(JmxRegistrationCall c |
c.getObjectArgument().(VarAccess).getVariable() = this.getParameter(result) c.getObjectArgument().(VarAccess).getVariable() = this.getParameter(result)
) )
} }
} }
/** DEPRECATED: Alias for JmxRegistrationMethod */
deprecated class JMXRegistrationMethod = JmxRegistrationMethod;
/** The class `javax.management.remote.JMXConnectorFactory`. */ /** The class `javax.management.remote.JMXConnectorFactory`. */
class TypeJMXConnectorFactory extends Class { class TypeJmxConnectorFactory extends Class {
TypeJMXConnectorFactory() { TypeJmxConnectorFactory() {
this.hasQualifiedName("javax.management.remote", "JMXConnectorFactory") this.hasQualifiedName("javax.management.remote", "JMXConnectorFactory")
} }
} }
/** DEPRECATED: Alias for TypeJmxConnectorFactory */
deprecated class TypeJMXConnectorFactory = TypeJmxConnectorFactory;
/** The class `javax.management.remote.JMXServiceURL`. */ /** The class `javax.management.remote.JMXServiceURL`. */
class TypeJMXServiceURL extends Class { class TypeJmxServiceUrl extends Class {
TypeJMXServiceURL() { this.hasQualifiedName("javax.management.remote", "JMXServiceURL") } TypeJmxServiceUrl() { this.hasQualifiedName("javax.management.remote", "JMXServiceURL") }
} }
/** DEPRECATED: Alias for TypeJmxServiceUrl */
deprecated class TypeJMXServiceURL = TypeJmxServiceUrl;
/** The class `javax.management.remote.rmi.RMIConnector`. */ /** The class `javax.management.remote.rmi.RMIConnector`. */
class TypeRMIConnector extends Class { class TypeRmiConnector extends Class {
TypeRMIConnector() { this.hasQualifiedName("javax.management.remote.rmi", "RMIConnector") } TypeRmiConnector() { this.hasQualifiedName("javax.management.remote.rmi", "RMIConnector") }
} }
/** DEPRECATED: Alias for TypeRmiConnector */
deprecated class TypeRMIConnector = TypeRmiConnector;

View File

@@ -15,7 +15,7 @@ private class SpecialMethodAccess extends MethodAccess {
this.getQualifier().getType().(RefType).hasQualifiedName("java.lang", klass) this.getQualifier().getType().(RefType).hasQualifiedName("java.lang", klass)
} }
predicate throwsNFE() { predicate throwsNfe() {
this.isParseMethod("Byte", "parseByte") or this.isParseMethod("Byte", "parseByte") or
this.isParseMethod("Short", "parseShort") or this.isParseMethod("Short", "parseShort") or
this.isParseMethod("Integer", "parseInt") or this.isParseMethod("Integer", "parseInt") or
@@ -33,6 +33,9 @@ private class SpecialMethodAccess extends MethodAccess {
this.isValueOfMethod("Float") or this.isValueOfMethod("Float") or
this.isValueOfMethod("Double") this.isValueOfMethod("Double")
} }
/** DEPRECATED: Alias for throwsNfe */
deprecated predicate throwsNFE() { this.throwsNfe() }
} }
/** A `ClassInstanceExpr` that constructs a number from its string representation. */ /** A `ClassInstanceExpr` that constructs a number from its string representation. */
@@ -43,7 +46,7 @@ private class SpecialClassInstanceExpr extends ClassInstanceExpr {
this.getNumArgument() = 1 this.getNumArgument() = 1
} }
predicate throwsNFE() { predicate throwsNfe() {
this.isStringConstructor("Byte") or this.isStringConstructor("Byte") or
this.isStringConstructor("Short") or this.isStringConstructor("Short") or
this.isStringConstructor("Integer") or this.isStringConstructor("Integer") or
@@ -51,6 +54,9 @@ private class SpecialClassInstanceExpr extends ClassInstanceExpr {
this.isStringConstructor("Float") or this.isStringConstructor("Float") or
this.isStringConstructor("Double") this.isStringConstructor("Double")
} }
/** DEPRECATED: Alias for throwsNfe */
deprecated predicate throwsNFE() { this.throwsNfe() }
} }
/** The class `java.lang.NumberFormatException`. */ /** The class `java.lang.NumberFormatException`. */
@@ -59,7 +65,7 @@ class NumberFormatException extends RefType {
} }
/** Holds if `java.lang.NumberFormatException` is caught. */ /** Holds if `java.lang.NumberFormatException` is caught. */
predicate catchesNFE(TryStmt t) { predicate catchesNfe(TryStmt t) {
exists(CatchClause cc, LocalVariableDeclExpr v | exists(CatchClause cc, LocalVariableDeclExpr v |
t.getACatchClause() = cc and t.getACatchClause() = cc and
cc.getVariable() = v and cc.getVariable() = v and
@@ -67,7 +73,13 @@ predicate catchesNFE(TryStmt t) {
) )
} }
/** DEPRECATED: Alias for catchesNfe */
deprecated predicate catchesNFE = catchesNfe/1;
/** Holds if `java.lang.NumberFormatException` can be thrown. */ /** Holds if `java.lang.NumberFormatException` can be thrown. */
predicate throwsNFE(Expr e) { predicate throwsNfe(Expr e) {
e.(SpecialClassInstanceExpr).throwsNFE() or e.(SpecialMethodAccess).throwsNFE() e.(SpecialClassInstanceExpr).throwsNfe() or e.(SpecialMethodAccess).throwsNfe()
} }
/** DEPRECATED: Alias for throwsNfe */
deprecated predicate throwsNFE = throwsNfe/1;

View File

@@ -88,7 +88,7 @@ private class ReverseDnsSource extends RemoteFlowSource {
ReverseDnsSource() { ReverseDnsSource() {
// Try not to trigger on `localhost`. // Try not to trigger on `localhost`.
exists(MethodAccess m | m = this.asExpr() | exists(MethodAccess m | m = this.asExpr() |
m.getMethod() instanceof ReverseDNSMethod and m.getMethod() instanceof ReverseDnsMethod and
not exists(MethodAccess l | not exists(MethodAccess l |
(variableStep(l, m.getQualifier()) or l = m.getQualifier()) and (variableStep(l, m.getQualifier()) or l = m.getQualifier()) and
l.getMethod().getName() = "getLocalHost" l.getMethod().getName() = "getLocalHost"
@@ -221,8 +221,8 @@ class TypeInetAddr extends RefType {
} }
/** A reverse DNS method. */ /** A reverse DNS method. */
class ReverseDNSMethod extends Method { class ReverseDnsMethod extends Method {
ReverseDNSMethod() { ReverseDnsMethod() {
this.getDeclaringType() instanceof TypeInetAddr and this.getDeclaringType() instanceof TypeInetAddr and
( (
this.getName() = "getHostName" or this.getName() = "getHostName" or
@@ -231,6 +231,9 @@ class ReverseDNSMethod extends Method {
} }
} }
/** DEPRECATED: Alias for ReverseDnsMethod */
deprecated class ReverseDNSMethod = ReverseDnsMethod;
/** Android `Intent` that may have come from a hostile application. */ /** Android `Intent` that may have come from a hostile application. */
class AndroidIntentInput extends DataFlow::Node { class AndroidIntentInput extends DataFlow::Node {
Type receiverType; Type receiverType;

View File

@@ -162,7 +162,7 @@ class LiveClass extends SourceClassOrInterface {
exists(LiveField f | f.getDeclaringType() = this | exists(LiveField f | f.getDeclaringType() = this |
// A `serialVersionUID` field is considered to be a live field, but is // A `serialVersionUID` field is considered to be a live field, but is
// not be enough to be make this class live. // not be enough to be make this class live.
not f instanceof SerialVersionUIDField not f instanceof SerialVersionUidField
) )
or or
// If this is a namespace class, it is live if there is at least one live nested class. // If this is a namespace class, it is live if there is at least one live nested class.
@@ -250,7 +250,7 @@ class DeadMethod extends Callable {
// These getters and setters are often generated in an ad-hoc way by the developer, which leads to // These getters and setters are often generated in an ad-hoc way by the developer, which leads to
// methods that are theoretically dead, but uninteresting. We therefore ignore them, so long as // methods that are theoretically dead, but uninteresting. We therefore ignore them, so long as
// they are "simple". // they are "simple".
not exists(JPAReadField readField | this.getDeclaringType() = readField.getDeclaringType() | not exists(JpaReadField readField | this.getDeclaringType() = readField.getDeclaringType() |
this.(GetterMethod).getField() = readField or this.(GetterMethod).getField() = readField or
this.(SetterMethod).getField() = readField this.(SetterMethod).getField() = readField
) )

View File

@@ -87,8 +87,8 @@ abstract class WhitelistedLiveField extends Field { }
* A static, final, long field named `serialVersionUID` in a class that extends `Serializable` acts as * A static, final, long field named `serialVersionUID` in a class that extends `Serializable` acts as
* a version number for the serialization framework. * a version number for the serialization framework.
*/ */
class SerialVersionUIDField extends ReflectivelyReadField { class SerialVersionUidField extends ReflectivelyReadField {
SerialVersionUIDField() { SerialVersionUidField() {
this.hasName("serialVersionUID") and this.hasName("serialVersionUID") and
this.isStatic() and this.isStatic() and
this.isFinal() and this.isFinal() and
@@ -97,6 +97,9 @@ class SerialVersionUIDField extends ReflectivelyReadField {
} }
} }
/** DEPRECATED: Alias for SerialVersionUidField */
deprecated class SerialVersionUIDField = SerialVersionUidField;
/** /**
* A field is read by the JAXB during serialization if it is a JAXB bound field, and if the * A field is read by the JAXB during serialization if it is a JAXB bound field, and if the
* containing class is considered "live". * containing class is considered "live".
@@ -154,8 +157,8 @@ class JacksonMixinReflextivelyReadField extends ReflectivelyReadField {
/** /**
* A field which is read by a JPA compatible Java persistence framework. * A field which is read by a JPA compatible Java persistence framework.
*/ */
class JPAReadField extends ReflectivelyReadField { class JpaReadField extends ReflectivelyReadField {
JPAReadField() { JpaReadField() {
exists(PersistentEntity entity | exists(PersistentEntity entity |
this = entity.getAField() and this = entity.getAField() and
( (
@@ -169,3 +172,6 @@ class JPAReadField extends ReflectivelyReadField {
) )
} }
} }
/** DEPRECATED: Alias for JpaReadField */
deprecated class JPAReadField = JpaReadField;

View File

@@ -128,8 +128,8 @@ class JacksonMixinCallableEntryPoint extends EntryPoint {
override Callable getALiveCallable() { result = this } override Callable getALiveCallable() { result = this }
} }
class JAXAnnotationReflectivelyConstructedClass extends ReflectivelyConstructedClass { class JaxAnnotationReflectivelyConstructedClass extends ReflectivelyConstructedClass {
JAXAnnotationReflectivelyConstructedClass() { JaxAnnotationReflectivelyConstructedClass() {
this instanceof JaxWsEndpoint or this instanceof JaxWsEndpoint or
this instanceof JaxbXmlRegistry or this instanceof JaxbXmlRegistry or
this instanceof JaxRsResourceClass or this instanceof JaxRsResourceClass or
@@ -137,6 +137,10 @@ class JAXAnnotationReflectivelyConstructedClass extends ReflectivelyConstructedC
} }
} }
/** DEPRECATED: Alias for JaxAnnotationReflectivelyConstructedClass */
deprecated class JAXAnnotationReflectivelyConstructedClass =
JaxAnnotationReflectivelyConstructedClass;
class DeserializedClass extends ReflectivelyConstructedClass { class DeserializedClass extends ReflectivelyConstructedClass {
DeserializedClass() { DeserializedClass() {
exists(CastingExpr cast, ReadObjectMethod readObject | exists(CastingExpr cast, ReadObjectMethod readObject |
@@ -342,8 +346,8 @@ class GsonDeserializationEntryPoint extends ReflectivelyConstructedClass {
} }
} }
class JAXBDeserializationEntryPoint extends ReflectivelyConstructedClass { class JaxbDeserializationEntryPoint extends ReflectivelyConstructedClass {
JAXBDeserializationEntryPoint() { JaxbDeserializationEntryPoint() {
// A class can be deserialized by JAXB if it's an `XmlRootElement`... // A class can be deserialized by JAXB if it's an `XmlRootElement`...
this.getAnAnnotation().getType().hasQualifiedName("javax.xml.bind.annotation", "XmlRootElement") this.getAnAnnotation().getType().hasQualifiedName("javax.xml.bind.annotation", "XmlRootElement")
or or
@@ -356,6 +360,9 @@ class JAXBDeserializationEntryPoint extends ReflectivelyConstructedClass {
} }
} }
/** DEPRECATED: Alias for JaxbDeserializationEntryPoint */
deprecated class JAXBDeserializationEntryPoint = JaxbDeserializationEntryPoint;
/** /**
* A `javax.annotation` for a method that is called after or before dependency injection on a type. * A `javax.annotation` for a method that is called after or before dependency injection on a type.
* *

View File

@@ -104,8 +104,8 @@ class SpringAspect extends CallableEntryPoint {
/** /**
* Spring Shell provides annotations for identifying methods that contribute CLI commands. * Spring Shell provides annotations for identifying methods that contribute CLI commands.
*/ */
class SpringCLI extends CallableEntryPoint { class SpringCli extends CallableEntryPoint {
SpringCLI() { SpringCli() {
( (
hasAnnotation("org.springframework.shell.core.annotation", "CliCommand") or hasAnnotation("org.springframework.shell.core.annotation", "CliCommand") or
hasAnnotation("org.springframework.shell.core.annotation", "CliAvailabilityIndicator") hasAnnotation("org.springframework.shell.core.annotation", "CliAvailabilityIndicator")
@@ -116,6 +116,9 @@ class SpringCLI extends CallableEntryPoint {
} }
} }
/** DEPRECATED: Alias for SpringCli */
deprecated class SpringCLI = SpringCli;
/** /**
* An entry point which acts as a remote API for a Flex application to access a Spring application. * An entry point which acts as a remote API for a Flex application to access a Spring application.
*/ */

View File

@@ -58,15 +58,18 @@ class ServletFilterClass extends ReflectivelyConstructedClass {
/** /**
* An entry point into a GWT application. * An entry point into a GWT application.
*/ */
class GWTEntryPointConstructedClass extends ReflectivelyConstructedClass { class GwtEntryPointConstructedClass extends ReflectivelyConstructedClass {
GWTEntryPointConstructedClass() { this.(GwtEntryPointClass).isLive() } GwtEntryPointConstructedClass() { this.(GwtEntryPointClass).isLive() }
} }
/** DEPRECATED: Alias for GwtEntryPointConstructedClass */
deprecated class GWTEntryPointConstructedClass = GwtEntryPointConstructedClass;
/** /**
* Servlets referred to from a GWT module config file. * Servlets referred to from a GWT module config file.
*/ */
class GWTServletClass extends ReflectivelyConstructedClass { class GwtServletClass extends ReflectivelyConstructedClass {
GWTServletClass() { GwtServletClass() {
this instanceof ServletClass and this instanceof ServletClass and
// There must be evidence that GWT is being used, otherwise missing `*.gwt.xml` files could cause // There must be evidence that GWT is being used, otherwise missing `*.gwt.xml` files could cause
// all `Servlet`s to be live. // all `Servlet`s to be live.
@@ -81,6 +84,9 @@ class GWTServletClass extends ReflectivelyConstructedClass {
} }
} }
/** DEPRECATED: Alias for GwtServletClass */
deprecated class GWTServletClass = GwtServletClass;
/** /**
* Methods that may be called reflectively by the UiHandler framework. * Methods that may be called reflectively by the UiHandler framework.
*/ */

View File

@@ -13,7 +13,7 @@ import semmle.code.java.frameworks.camel.CamelJavaAnnotations
class CamelToUri extends string { class CamelToUri extends string {
CamelToUri() { CamelToUri() {
exists(SpringCamelXmlToElement toXmlElement | this = toXmlElement.getUri()) or exists(SpringCamelXmlToElement toXmlElement | this = toXmlElement.getUri()) or
exists(CamelJavaDSLToDecl toJavaDSL | this = toJavaDSL.getUri()) exists(CamelJavaDslToDecl toJavaDsl | this = toJavaDsl.getUri())
} }
} }
@@ -77,13 +77,13 @@ class CamelTargetClass extends Class {
this = xmlMethod.getBeanType() this = xmlMethod.getBeanType()
) )
or or
exists(CamelJavaDSLMethodDecl methodDecl | this = methodDecl.getABean()) exists(CamelJavaDslMethodDecl methodDecl | this = methodDecl.getABean())
or or
// Any beans referred to in Java DSL bean or beanRef elements are considered as possible // Any beans referred to in Java DSL bean or beanRef elements are considered as possible
// targets. Whether the route builder is ever constructed or called is not considered. // targets. Whether the route builder is ever constructed or called is not considered.
exists(CamelJavaDSLBeanDecl beanDecl | this = beanDecl.getABeanClass()) exists(CamelJavaDslBeanDecl beanDecl | this = beanDecl.getABeanClass())
or or
exists(CamelJavaDSLBeanRefDecl beanRefDecl | this = beanRefDecl.getABeanClass()) exists(CamelJavaDslBeanRefDecl beanRefDecl | this = beanRefDecl.getABeanClass())
} }
/** /**

View File

@@ -2,20 +2,26 @@
import semmle.code.java.Type import semmle.code.java.Type
library class JAXBElement extends Class { library class JaxbElement extends Class {
JAXBElement() { JaxbElement() {
this.getAnAncestor().getQualifiedName() = "javax.xml.bind.JAXBElement" or this.getAnAncestor().getQualifiedName() = "javax.xml.bind.JAXBElement" or
this.getAnAnnotation().getType().getName() = "XmlRootElement" this.getAnAnnotation().getType().getName() = "XmlRootElement"
} }
} }
library class JAXBMarshalMethod extends Method { /** DEPRECATED: Alias for JaxbElement */
JAXBMarshalMethod() { deprecated class JAXBElement = JaxbElement;
library class JaxbMarshalMethod extends Method {
JaxbMarshalMethod() {
this.getDeclaringType().getQualifiedName() = "javax.xml.bind.Marshaller" and this.getDeclaringType().getQualifiedName() = "javax.xml.bind.Marshaller" and
this.getName() = "marshal" this.getName() = "marshal"
} }
} }
/** DEPRECATED: Alias for JaxbMarshalMethod */
deprecated class JAXBMarshalMethod = JaxbMarshalMethod;
class JaxbAnnotationType extends AnnotationType { class JaxbAnnotationType extends AnnotationType {
JaxbAnnotationType() { this.getPackage().getName() = "javax.xml.bind.annotation" } JaxbAnnotationType() { this.getPackage().getName() = "javax.xml.bind.annotation" }
} }

View File

@@ -58,13 +58,16 @@ class MethodUnboundIdFilterCreate extends Method {
} }
/** A method with the name `createANDFilter` declared in `com.unboundid.ldap.sdk.Filter`. */ /** A method with the name `createANDFilter` declared in `com.unboundid.ldap.sdk.Filter`. */
class MethodUnboundIdFilterCreateANDFilter extends Method { class MethodUnboundIdFilterCreateAndFilter extends Method {
MethodUnboundIdFilterCreateANDFilter() { MethodUnboundIdFilterCreateAndFilter() {
this.getDeclaringType() instanceof TypeUnboundIdLdapFilter and this.getDeclaringType() instanceof TypeUnboundIdLdapFilter and
this.hasName("createANDFilter") this.hasName("createANDFilter")
} }
} }
/** DEPRECATED: Alias for MethodUnboundIdFilterCreateAndFilter */
deprecated class MethodUnboundIdFilterCreateANDFilter = MethodUnboundIdFilterCreateAndFilter;
/** A method with the name `createORFilter` declared in `com.unboundid.ldap.sdk.Filter`. */ /** A method with the name `createORFilter` declared in `com.unboundid.ldap.sdk.Filter`. */
class MethodUnboundIdFilterCreateORFilter extends Method { class MethodUnboundIdFilterCreateORFilter extends Method {
MethodUnboundIdFilterCreateORFilter() { MethodUnboundIdFilterCreateORFilter() {
@@ -73,9 +76,12 @@ class MethodUnboundIdFilterCreateORFilter extends Method {
} }
} }
/** DEPRECATED: Alias for MethodUnboundIdFilterCreateNOTFilter */
deprecated class MethodUnboundIdFilterCreateNOTFilter = MethodUnboundIdFilterCreateNotFilter;
/** A method with the name `createNOTFilter` declared in `com.unboundid.ldap.sdk.Filter`. */ /** A method with the name `createNOTFilter` declared in `com.unboundid.ldap.sdk.Filter`. */
class MethodUnboundIdFilterCreateNOTFilter extends Method { class MethodUnboundIdFilterCreateNotFilter extends Method {
MethodUnboundIdFilterCreateNOTFilter() { MethodUnboundIdFilterCreateNotFilter() {
this.getDeclaringType() instanceof TypeUnboundIdLdapFilter and this.getDeclaringType() instanceof TypeUnboundIdLdapFilter and
this.hasName("createNOTFilter") this.hasName("createNOTFilter")
} }

View File

@@ -35,8 +35,8 @@ library class ProcessorDefinitionElement extends MethodAccess {
* *
* This declares a "target" for this route, described by the URI given as the first argument. * This declares a "target" for this route, described by the URI given as the first argument.
*/ */
class CamelJavaDSLToDecl extends ProcessorDefinitionElement { class CamelJavaDslToDecl extends ProcessorDefinitionElement {
CamelJavaDSLToDecl() { getMethod().hasName("to") } CamelJavaDslToDecl() { getMethod().hasName("to") }
/** /**
* Gets the URI specified by this `to` declaration. * Gets the URI specified by this `to` declaration.
@@ -47,14 +47,17 @@ class CamelJavaDSLToDecl extends ProcessorDefinitionElement {
deprecated string getURI() { result = getUri() } deprecated string getURI() { result = getUri() }
} }
/** DEPRECATED: Alias for CamelJavaDslToDecl */
deprecated class CamelJavaDSLToDecl = CamelJavaDslToDecl;
/** /**
* A declaration of a "bean" target in the Apache Camel Java DSL. * A declaration of a "bean" target in the Apache Camel Java DSL.
* *
* This declares a bean to call for this route. The bean is defined either by a Class<?> reference, * This declares a bean to call for this route. The bean is defined either by a Class<?> reference,
* or the bean object itself. * or the bean object itself.
*/ */
class CamelJavaDSLBeanDecl extends ProcessorDefinitionElement { class CamelJavaDslBeanDecl extends ProcessorDefinitionElement {
CamelJavaDSLBeanDecl() { getMethod().hasName("bean") } CamelJavaDslBeanDecl() { getMethod().hasName("bean") }
/** /**
* Gets a bean class that may be registered as a target by this `bean()` declaration. * Gets a bean class that may be registered as a target by this `bean()` declaration.
@@ -71,6 +74,9 @@ class CamelJavaDSLBeanDecl extends ProcessorDefinitionElement {
} }
} }
/** DEPRECATED: Alias for CamelJavaDslBeanDecl */
deprecated class CamelJavaDSLBeanDecl = CamelJavaDslBeanDecl;
/** /**
* A declaration of a "beanRef" target in the Apache Camel Java DSL. * A declaration of a "beanRef" target in the Apache Camel Java DSL.
* *
@@ -78,8 +84,8 @@ class CamelJavaDSLBeanDecl extends ProcessorDefinitionElement {
* the bean reference is dependent on which registries are used by Apache Camel, but we make the * the bean reference is dependent on which registries are used by Apache Camel, but we make the
* assumption that it either represetns a qualified name, or a Srping bean identifier. * assumption that it either represetns a qualified name, or a Srping bean identifier.
*/ */
class CamelJavaDSLBeanRefDecl extends ProcessorDefinitionElement { class CamelJavaDslBeanRefDecl extends ProcessorDefinitionElement {
CamelJavaDSLBeanRefDecl() { getMethod().hasName("beanRef") } CamelJavaDslBeanRefDecl() { getMethod().hasName("beanRef") }
/** /**
* Gets the string describing the bean referred to. * Gets the string describing the bean referred to.
@@ -98,13 +104,16 @@ class CamelJavaDSLBeanRefDecl extends ProcessorDefinitionElement {
} }
} }
/** DEPRECATED: Alias for CamelJavaDslBeanRefDecl */
deprecated class CamelJavaDSLBeanRefDecl = CamelJavaDslBeanRefDecl;
/** /**
* A "method" Camel expression in the Apache Camel Java DSL. * A "method" Camel expression in the Apache Camel Java DSL.
* *
* An expression that represents a call to a bean, or particular method on a bean. * An expression that represents a call to a bean, or particular method on a bean.
*/ */
class CamelJavaDSLMethodDecl extends MethodAccess { class CamelJavaDslMethodDecl extends MethodAccess {
CamelJavaDSLMethodDecl() { CamelJavaDslMethodDecl() {
getMethod() getMethod()
.getDeclaringType() .getDeclaringType()
.getSourceDeclaration() .getSourceDeclaration()
@@ -129,3 +138,6 @@ class CamelJavaDSLMethodDecl extends MethodAccess {
else result = getArgument(0).getType() else result = getArgument(0).getType()
} }
} }
/** DEPRECATED: Alias for CamelJavaDslMethodDecl */
deprecated class CamelJavaDSLMethodDecl = CamelJavaDslMethodDecl;

View File

@@ -49,7 +49,7 @@ private class Serializable extends ClassStore {
/** The instantiation of a marshallable class, which can be stored to disk as XML. */ /** The instantiation of a marshallable class, which can be stored to disk as XML. */
private class Marshallable extends ClassStore { private class Marshallable extends ClassStore {
Marshallable() { this.getConstructor().getDeclaringType() instanceof JAXBElement } Marshallable() { this.getConstructor().getDeclaringType() instanceof JaxbElement }
/** Gets a store, for example `marshaller.marshal(instance)`. */ /** Gets a store, for example `marshaller.marshal(instance)`. */
override Expr getAStore() { override Expr getAStore() {
@@ -69,7 +69,7 @@ private Expr getInstanceInput(DataFlow::Node instance, RefType t) {
fa.getField().getDeclaringType() = t fa.getField().getDeclaringType() = t
| |
t.getASourceSupertype*() instanceof TypeSerializable or t.getASourceSupertype*() instanceof TypeSerializable or
t instanceof JAXBElement t instanceof JaxbElement
) )
} }
@@ -98,7 +98,7 @@ private predicate serializableStore(DataFlow::Node instance, Expr store) {
private predicate marshallableStore(DataFlow::Node instance, Expr store) { private predicate marshallableStore(DataFlow::Node instance, Expr store) {
exists(MethodAccess m | exists(MethodAccess m |
store = m and store = m and
m.getMethod() instanceof JAXBMarshalMethod and m.getMethod() instanceof JaxbMarshalMethod and
instance.asExpr() = m.getArgument(0) instance.asExpr() = m.getArgument(0)
) )
} }

View File

@@ -176,7 +176,7 @@ private predicate nameAddStep(DataFlow::ExprNode n1, DataFlow::ExprNode n2) {
* by calling `new JMXServiceURL(tainted)`. * by calling `new JMXServiceURL(tainted)`.
*/ */
private predicate jmxServiceUrlStep(DataFlow::ExprNode n1, DataFlow::ExprNode n2) { private predicate jmxServiceUrlStep(DataFlow::ExprNode n1, DataFlow::ExprNode n2) {
exists(ConstructorCall cc | cc.getConstructedType() instanceof TypeJMXServiceURL | exists(ConstructorCall cc | cc.getConstructedType() instanceof TypeJmxServiceUrl |
n1.asExpr() = cc.getAnArgument() and n1.asExpr() = cc.getAnArgument() and
n2.asExpr() = cc n2.asExpr() = cc
) )
@@ -189,7 +189,7 @@ private predicate jmxServiceUrlStep(DataFlow::ExprNode n1, DataFlow::ExprNode n2
private predicate jmxConnectorStep(DataFlow::ExprNode n1, DataFlow::ExprNode n2) { private predicate jmxConnectorStep(DataFlow::ExprNode n1, DataFlow::ExprNode n2) {
exists(MethodAccess ma, Method m | n1.asExpr() = ma.getArgument(0) and n2.asExpr() = ma | exists(MethodAccess ma, Method m | n1.asExpr() = ma.getArgument(0) and n2.asExpr() = ma |
ma.getMethod() = m and ma.getMethod() = m and
m.getDeclaringType() instanceof TypeJMXConnectorFactory and m.getDeclaringType() instanceof TypeJmxConnectorFactory and
m.hasName("newJMXConnector") m.hasName("newJMXConnector")
) )
} }
@@ -199,7 +199,7 @@ private predicate jmxConnectorStep(DataFlow::ExprNode n1, DataFlow::ExprNode n2)
* `RMIConnector` by calling `new RMIConnector(tainted)`. * `RMIConnector` by calling `new RMIConnector(tainted)`.
*/ */
private predicate rmiConnectorStep(DataFlow::ExprNode n1, DataFlow::ExprNode n2) { private predicate rmiConnectorStep(DataFlow::ExprNode n1, DataFlow::ExprNode n2) {
exists(ConstructorCall cc | cc.getConstructedType() instanceof TypeRMIConnector | exists(ConstructorCall cc | cc.getConstructedType() instanceof TypeRmiConnector |
n1.asExpr() = cc.getAnArgument() and n1.asExpr() = cc.getAnArgument() and
n2.asExpr() = cc n2.asExpr() = cc
) )

View File

@@ -140,8 +140,8 @@ private predicate filterStep(DataFlow::ExprNode n1, DataFlow::ExprNode n2) {
ma.getMethod() = m ma.getMethod() = m
| |
m instanceof MethodUnboundIdFilterCreate or m instanceof MethodUnboundIdFilterCreate or
m instanceof MethodUnboundIdFilterCreateANDFilter or m instanceof MethodUnboundIdFilterCreateAndFilter or
m instanceof MethodUnboundIdFilterCreateNOTFilter or m instanceof MethodUnboundIdFilterCreateNotFilter or
m instanceof MethodUnboundIdFilterCreateORFilter or m instanceof MethodUnboundIdFilterCreateORFilter or
m instanceof MethodUnboundIdFilterSimplifyFilter m instanceof MethodUnboundIdFilterSimplifyFilter
) )

View File

@@ -15,10 +15,10 @@ import semmle.code.java.NumberFormatException
from Expr e from Expr e
where where
throwsNFE(e) and throwsNfe(e) and
not exists(TryStmt t | not exists(TryStmt t |
t.getBlock() = e.getEnclosingStmt().getEnclosingStmt*() and t.getBlock() = e.getEnclosingStmt().getEnclosingStmt*() and
catchesNFE(t) catchesNfe(t)
) and ) and
not exists(Callable c | not exists(Callable c |
e.getEnclosingCallable() = c and e.getEnclosingCallable() = c and

View File

@@ -117,12 +117,12 @@ predicate hasShortAsymmetricKeyPair(MethodAccess ma, string msg, string type) {
} }
/** Holds if a DSA `KeyPairGenerator` initialized by `ma` uses an insufficient key size. `msg` provides a human-readable description of the problem. */ /** Holds if a DSA `KeyPairGenerator` initialized by `ma` uses an insufficient key size. `msg` provides a human-readable description of the problem. */
predicate hasShortDSAKeyPair(MethodAccess ma, string msg) { predicate hasShortDsaKeyPair(MethodAccess ma, string msg) {
hasShortAsymmetricKeyPair(ma, msg, "DSA") or hasShortAsymmetricKeyPair(ma, msg, "DH") hasShortAsymmetricKeyPair(ma, msg, "DSA") or hasShortAsymmetricKeyPair(ma, msg, "DH")
} }
/** Holds if a RSA `KeyPairGenerator` initialized by `ma` uses an insufficient key size. `msg` provides a human-readable description of the problem. */ /** Holds if a RSA `KeyPairGenerator` initialized by `ma` uses an insufficient key size. `msg` provides a human-readable description of the problem. */
predicate hasShortRSAKeyPair(MethodAccess ma, string msg) { predicate hasShortRsaKeyPair(MethodAccess ma, string msg) {
hasShortAsymmetricKeyPair(ma, msg, "RSA") hasShortAsymmetricKeyPair(ma, msg, "RSA")
} }
@@ -147,7 +147,7 @@ predicate hasShortECKeyPair(MethodAccess ma, string msg) {
from Expr e, string msg from Expr e, string msg
where where
hasShortAESKey(e, msg) or hasShortAESKey(e, msg) or
hasShortDSAKeyPair(e, msg) or hasShortDsaKeyPair(e, msg) or
hasShortRSAKeyPair(e, msg) or hasShortRsaKeyPair(e, msg) or
hasShortECKeyPair(e, msg) hasShortECKeyPair(e, msg)
select e, msg select e, msg

View File

@@ -21,8 +21,8 @@ import DataFlow::PathGraph
/** /**
* Taint configuration tracking flow from untrusted inputs to number conversion calls in exported Android compononents. * Taint configuration tracking flow from untrusted inputs to number conversion calls in exported Android compononents.
*/ */
class NFELocalDoSConfiguration extends TaintTracking::Configuration { class NfeLocalDoSConfiguration extends TaintTracking::Configuration {
NFELocalDoSConfiguration() { this = "NFELocalDoSConfiguration" } NfeLocalDoSConfiguration() { this = "NFELocalDoSConfiguration" }
/** Holds if source is a remote flow source */ /** Holds if source is a remote flow source */
override predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } override predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
@@ -31,17 +31,17 @@ class NFELocalDoSConfiguration extends TaintTracking::Configuration {
override predicate isSink(DataFlow::Node sink) { override predicate isSink(DataFlow::Node sink) {
exists(Expr e | exists(Expr e |
e.getEnclosingCallable().getDeclaringType().(ExportableAndroidComponent).isExported() and e.getEnclosingCallable().getDeclaringType().(ExportableAndroidComponent).isExported() and
throwsNFE(e) and throwsNfe(e) and
not exists(TryStmt t | not exists(TryStmt t |
t.getBlock() = e.getAnEnclosingStmt() and t.getBlock() = e.getAnEnclosingStmt() and
catchesNFE(t) catchesNfe(t)
) and ) and
sink.asExpr() = e sink.asExpr() = e
) )
} }
} }
from DataFlow::PathNode source, DataFlow::PathNode sink, NFELocalDoSConfiguration conf from DataFlow::PathNode source, DataFlow::PathNode sink, NfeLocalDoSConfiguration conf
where conf.hasFlowPath(source, sink) where conf.hasFlowPath(source, sink)
select sink.getNode(), source, sink, select sink.getNode(), source, sink,
"Uncaught NumberFormatException in an exported Android component due to $@.", source.getNode(), "Uncaught NumberFormatException in an exported Android component due to $@.", source.getNode(),

View File

@@ -15,16 +15,16 @@ import extraction.ExtractEndpointData
string getAReasonSinkExcluded(DataFlow::Node sinkCandidate, Query query) { string getAReasonSinkExcluded(DataFlow::Node sinkCandidate, Query query) {
query instanceof NosqlInjectionQuery and query instanceof NosqlInjectionQuery and
result = NosqlInjectionATM::SinkEndpointFilter::getAReasonSinkExcluded(sinkCandidate) result = NosqlInjectionAtm::SinkEndpointFilter::getAReasonSinkExcluded(sinkCandidate)
or or
query instanceof SqlInjectionQuery and query instanceof SqlInjectionQuery and
result = SqlInjectionATM::SinkEndpointFilter::getAReasonSinkExcluded(sinkCandidate) result = SqlInjectionAtm::SinkEndpointFilter::getAReasonSinkExcluded(sinkCandidate)
or or
query instanceof TaintedPathQuery and query instanceof TaintedPathQuery and
result = TaintedPathATM::SinkEndpointFilter::getAReasonSinkExcluded(sinkCandidate) result = TaintedPathAtm::SinkEndpointFilter::getAReasonSinkExcluded(sinkCandidate)
or or
query instanceof XssQuery and query instanceof XssQuery and
result = XssATM::SinkEndpointFilter::getAReasonSinkExcluded(sinkCandidate) result = XssAtm::SinkEndpointFilter::getAReasonSinkExcluded(sinkCandidate)
} }
pragma[inline] pragma[inline]

View File

@@ -14,10 +14,26 @@ import experimental.adaptivethreatmodeling.EndpointFeatures as EndpointFeatures
import experimental.adaptivethreatmodeling.EndpointScoring as EndpointScoring import experimental.adaptivethreatmodeling.EndpointScoring as EndpointScoring
import experimental.adaptivethreatmodeling.EndpointTypes import experimental.adaptivethreatmodeling.EndpointTypes
import experimental.adaptivethreatmodeling.FilteringReasons import experimental.adaptivethreatmodeling.FilteringReasons
import experimental.adaptivethreatmodeling.NosqlInjectionATM as NosqlInjectionATM import experimental.adaptivethreatmodeling.NosqlInjectionATM as NosqlInjectionAtm
import experimental.adaptivethreatmodeling.SqlInjectionATM as SqlInjectionATM
import experimental.adaptivethreatmodeling.TaintedPathATM as TaintedPathATM /** DEPRECATED: Alias for NosqlInjectionAtm */
import experimental.adaptivethreatmodeling.XssATM as XssATM deprecated module NosqlInjectionATM = NosqlInjectionAtm;
import experimental.adaptivethreatmodeling.SqlInjectionATM as SqlInjectionAtm
/** DEPRECATED: Alias for SqlInjectionAtm */
deprecated module SqlInjectionATM = SqlInjectionAtm;
import experimental.adaptivethreatmodeling.TaintedPathATM as TaintedPathAtm
/** DEPRECATED: Alias for TaintedPathAtm */
deprecated module TaintedPathATM = TaintedPathAtm;
import experimental.adaptivethreatmodeling.XssATM as XssAtm
/** DEPRECATED: Alias for XssAtm */
deprecated module XssATM = XssAtm;
import Labels import Labels
import NoFeaturizationRestrictionsConfig import NoFeaturizationRestrictionsConfig
import Queries import Queries
@@ -25,13 +41,13 @@ import Queries
/** Gets the ATM configuration object for the specified query. */ /** Gets the ATM configuration object for the specified query. */
AtmConfig getAtmCfg(Query query) { AtmConfig getAtmCfg(Query query) {
query instanceof NosqlInjectionQuery and query instanceof NosqlInjectionQuery and
result instanceof NosqlInjectionATM::NosqlInjectionAtmConfig result instanceof NosqlInjectionAtm::NosqlInjectionAtmConfig
or or
query instanceof SqlInjectionQuery and result instanceof SqlInjectionATM::SqlInjectionAtmConfig query instanceof SqlInjectionQuery and result instanceof SqlInjectionAtm::SqlInjectionAtmConfig
or or
query instanceof TaintedPathQuery and result instanceof TaintedPathATM::TaintedPathAtmConfig query instanceof TaintedPathQuery and result instanceof TaintedPathAtm::TaintedPathAtmConfig
or or
query instanceof XssQuery and result instanceof XssATM::DomBasedXssAtmConfig query instanceof XssQuery and result instanceof XssAtm::DomBasedXssAtmConfig
} }
/** DEPRECATED: Alias for getAtmCfg */ /** DEPRECATED: Alias for getAtmCfg */
@@ -39,13 +55,13 @@ deprecated ATMConfig getATMCfg(Query query) { result = getAtmCfg(query) }
/** Gets the ATM data flow configuration for the specified query. */ /** Gets the ATM data flow configuration for the specified query. */
DataFlow::Configuration getDataFlowCfg(Query query) { DataFlow::Configuration getDataFlowCfg(Query query) {
query instanceof NosqlInjectionQuery and result instanceof NosqlInjectionATM::Configuration query instanceof NosqlInjectionQuery and result instanceof NosqlInjectionAtm::Configuration
or or
query instanceof SqlInjectionQuery and result instanceof SqlInjectionATM::Configuration query instanceof SqlInjectionQuery and result instanceof SqlInjectionAtm::Configuration
or or
query instanceof TaintedPathQuery and result instanceof TaintedPathATM::Configuration query instanceof TaintedPathQuery and result instanceof TaintedPathAtm::Configuration
or or
query instanceof XssQuery and result instanceof XssATM::Configuration query instanceof XssQuery and result instanceof XssAtm::Configuration
} }
/** Gets a known sink for the specified query. */ /** Gets a known sink for the specified query. */

View File

@@ -4,25 +4,25 @@
* Maps ML-powered queries to their `EndpointType` for clearer labelling while evaluating ML model during training. * Maps ML-powered queries to their `EndpointType` for clearer labelling while evaluating ML model during training.
*/ */
import experimental.adaptivethreatmodeling.SqlInjectionATM as SqlInjectionATM import experimental.adaptivethreatmodeling.SqlInjectionATM as SqlInjectionAtm
import experimental.adaptivethreatmodeling.NosqlInjectionATM as NosqlInjectionATM import experimental.adaptivethreatmodeling.NosqlInjectionATM as NosqlInjectionAtm
import experimental.adaptivethreatmodeling.TaintedPathATM as TaintedPathATM import experimental.adaptivethreatmodeling.TaintedPathATM as TaintedPathAtm
import experimental.adaptivethreatmodeling.XssATM as XssATM import experimental.adaptivethreatmodeling.XssATM as XssAtm
import experimental.adaptivethreatmodeling.AdaptiveThreatModeling import experimental.adaptivethreatmodeling.AdaptiveThreatModeling
from string queryName, AtmConfig c, EndpointType e from string queryName, AtmConfig c, EndpointType e
where where
( (
queryName = "SqlInjection" and queryName = "SqlInjection" and
c instanceof SqlInjectionATM::SqlInjectionAtmConfig c instanceof SqlInjectionAtm::SqlInjectionAtmConfig
or or
queryName = "NosqlInjection" and queryName = "NosqlInjection" and
c instanceof NosqlInjectionATM::NosqlInjectionAtmConfig c instanceof NosqlInjectionAtm::NosqlInjectionAtmConfig
or or
queryName = "TaintedPath" and queryName = "TaintedPath" and
c instanceof TaintedPathATM::TaintedPathAtmConfig c instanceof TaintedPathAtm::TaintedPathAtmConfig
or or
queryName = "Xss" and c instanceof XssATM::DomBasedXssAtmConfig queryName = "Xss" and c instanceof XssAtm::DomBasedXssAtmConfig
) and ) and
e = c.getASinkEndpointType() e = c.getASinkEndpointType()
select queryName, e.getEncoding() as label select queryName, e.getEncoding() as label

View File

@@ -7,20 +7,20 @@
*/ */
import javascript import javascript
import experimental.adaptivethreatmodeling.NosqlInjectionATM as NosqlInjectionATM import experimental.adaptivethreatmodeling.NosqlInjectionATM as NosqlInjectionAtm
import experimental.adaptivethreatmodeling.SqlInjectionATM as SqlInjectionATM import experimental.adaptivethreatmodeling.SqlInjectionATM as SqlInjectionAtm
import experimental.adaptivethreatmodeling.TaintedPathATM as TaintedPathATM import experimental.adaptivethreatmodeling.TaintedPathATM as TaintedPathAtm
import experimental.adaptivethreatmodeling.XssATM as XssATM import experimental.adaptivethreatmodeling.XssATM as XssAtm
import experimental.adaptivethreatmodeling.EndpointFeatures as EndpointFeatures import experimental.adaptivethreatmodeling.EndpointFeatures as EndpointFeatures
import experimental.adaptivethreatmodeling.StandardEndpointFilters as StandardEndpointFilters import experimental.adaptivethreatmodeling.StandardEndpointFilters as StandardEndpointFilters
import extraction.NoFeaturizationRestrictionsConfig import extraction.NoFeaturizationRestrictionsConfig
query predicate tokenFeatures(DataFlow::Node endpoint, string featureName, string featureValue) { query predicate tokenFeatures(DataFlow::Node endpoint, string featureName, string featureValue) {
( (
not exists(NosqlInjectionATM::SinkEndpointFilter::getAReasonSinkExcluded(endpoint)) or not exists(NosqlInjectionAtm::SinkEndpointFilter::getAReasonSinkExcluded(endpoint)) or
not exists(SqlInjectionATM::SinkEndpointFilter::getAReasonSinkExcluded(endpoint)) or not exists(SqlInjectionAtm::SinkEndpointFilter::getAReasonSinkExcluded(endpoint)) or
not exists(TaintedPathATM::SinkEndpointFilter::getAReasonSinkExcluded(endpoint)) or not exists(TaintedPathAtm::SinkEndpointFilter::getAReasonSinkExcluded(endpoint)) or
not exists(XssATM::SinkEndpointFilter::getAReasonSinkExcluded(endpoint)) or not exists(XssAtm::SinkEndpointFilter::getAReasonSinkExcluded(endpoint)) or
StandardEndpointFilters::isArgumentToModeledFunction(endpoint) StandardEndpointFilters::isArgumentToModeledFunction(endpoint)
) and ) and
EndpointFeatures::tokenFeatures(endpoint, featureName, featureValue) EndpointFeatures::tokenFeatures(endpoint, featureName, featureValue)

View File

@@ -17,31 +17,31 @@ import semmle.javascript.security.dataflow.SqlInjectionCustomizations
import semmle.javascript.security.dataflow.TaintedPathCustomizations import semmle.javascript.security.dataflow.TaintedPathCustomizations
import semmle.javascript.security.dataflow.DomBasedXssCustomizations import semmle.javascript.security.dataflow.DomBasedXssCustomizations
import experimental.adaptivethreatmodeling.StandardEndpointFilters as StandardEndpointFilters import experimental.adaptivethreatmodeling.StandardEndpointFilters as StandardEndpointFilters
import experimental.adaptivethreatmodeling.NosqlInjectionATM as NosqlInjectionATM import experimental.adaptivethreatmodeling.NosqlInjectionATM as NosqlInjectionAtm
import experimental.adaptivethreatmodeling.SqlInjectionATM as SqlInjectionATM import experimental.adaptivethreatmodeling.SqlInjectionATM as SqlInjectionAtm
import experimental.adaptivethreatmodeling.TaintedPathATM as TaintedPathATM import experimental.adaptivethreatmodeling.TaintedPathATM as TaintedPathAtm
import experimental.adaptivethreatmodeling.XssATM as XssATM import experimental.adaptivethreatmodeling.XssATM as XssAtm
query predicate nosqlFilteredTruePositives(DataFlow::Node endpoint, string reason) { query predicate nosqlFilteredTruePositives(DataFlow::Node endpoint, string reason) {
endpoint instanceof NosqlInjection::Sink and endpoint instanceof NosqlInjection::Sink and
reason = NosqlInjectionATM::SinkEndpointFilter::getAReasonSinkExcluded(endpoint) and reason = NosqlInjectionAtm::SinkEndpointFilter::getAReasonSinkExcluded(endpoint) and
not reason = ["argument to modeled function", "modeled sink", "modeled database access"] not reason = ["argument to modeled function", "modeled sink", "modeled database access"]
} }
query predicate sqlFilteredTruePositives(DataFlow::Node endpoint, string reason) { query predicate sqlFilteredTruePositives(DataFlow::Node endpoint, string reason) {
endpoint instanceof SqlInjection::Sink and endpoint instanceof SqlInjection::Sink and
reason = SqlInjectionATM::SinkEndpointFilter::getAReasonSinkExcluded(endpoint) and reason = SqlInjectionAtm::SinkEndpointFilter::getAReasonSinkExcluded(endpoint) and
reason != "argument to modeled function" reason != "argument to modeled function"
} }
query predicate taintedPathFilteredTruePositives(DataFlow::Node endpoint, string reason) { query predicate taintedPathFilteredTruePositives(DataFlow::Node endpoint, string reason) {
endpoint instanceof TaintedPath::Sink and endpoint instanceof TaintedPath::Sink and
reason = TaintedPathATM::SinkEndpointFilter::getAReasonSinkExcluded(endpoint) and reason = TaintedPathAtm::SinkEndpointFilter::getAReasonSinkExcluded(endpoint) and
reason != "argument to modeled function" reason != "argument to modeled function"
} }
query predicate xssFilteredTruePositives(DataFlow::Node endpoint, string reason) { query predicate xssFilteredTruePositives(DataFlow::Node endpoint, string reason) {
endpoint instanceof DomBasedXss::Sink and endpoint instanceof DomBasedXss::Sink and
reason = XssATM::SinkEndpointFilter::getAReasonSinkExcluded(endpoint) and reason = XssAtm::SinkEndpointFilter::getAReasonSinkExcluded(endpoint) and
reason != "argument to modeled function" reason != "argument to modeled function"
} }

View File

@@ -1,6 +1,6 @@
import javascript import javascript
import experimental.adaptivethreatmodeling.NosqlInjectionATM as NosqlInjectionATM import experimental.adaptivethreatmodeling.NosqlInjectionATM as NosqlInjectionAtm
query predicate effectiveSinks(DataFlow::Node node) { query predicate effectiveSinks(DataFlow::Node node) {
not exists(NosqlInjectionATM::SinkEndpointFilter::getAReasonSinkExcluded(node)) not exists(NosqlInjectionAtm::SinkEndpointFilter::getAReasonSinkExcluded(node))
} }

View File

@@ -11,7 +11,7 @@ import javascript
*/ */
module Actions { module Actions {
/** A YAML node in a GitHub Actions workflow file. */ /** A YAML node in a GitHub Actions workflow file. */
private class Node extends YAMLNode { private class Node extends YamlNode {
Node() { Node() {
this.getLocation() this.getLocation()
.getFile() .getFile()
@@ -24,12 +24,12 @@ module Actions {
* An Actions workflow. This is a mapping at the top level of an Actions YAML workflow file. * An Actions workflow. This is a mapping at the top level of an Actions YAML workflow file.
* See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions. * See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions.
*/ */
class Workflow extends Node, YAMLDocument, YAMLMapping { class Workflow extends Node, YamlDocument, YamlMapping {
/** Gets the `jobs` mapping from job IDs to job definitions in this workflow. */ /** Gets the `jobs` mapping from job IDs to job definitions in this workflow. */
YAMLMapping getJobs() { result = this.lookup("jobs") } YamlMapping getJobs() { result = this.lookup("jobs") }
/** Gets the name of the workflow. */ /** Gets the name of the workflow. */
string getName() { result = this.lookup("name").(YAMLString).getValue() } string getName() { result = this.lookup("name").(YamlString).getValue() }
/** Gets the name of the workflow file. */ /** Gets the name of the workflow file. */
string getFileName() { result = this.getFile().getBaseName() } string getFileName() { result = this.getFile().getBaseName() }
@@ -45,7 +45,7 @@ module Actions {
* An Actions On trigger within a workflow. * An Actions On trigger within a workflow.
* See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#on. * See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#on.
*/ */
class On extends YAMLNode, YAMLMappingLikeNode { class On extends YamlNode, YamlMappingLikeNode {
Workflow workflow; Workflow workflow;
On() { workflow.lookup("on") = this } On() { workflow.lookup("on") = this }
@@ -58,7 +58,7 @@ module Actions {
* An Actions job within a workflow. * An Actions job within a workflow.
* See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobs. * See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobs.
*/ */
class Job extends YAMLNode, YAMLMapping { class Job extends YamlNode, YamlMapping {
string jobId; string jobId;
Workflow workflow; Workflow workflow;
@@ -74,19 +74,19 @@ module Actions {
* Gets the ID of this job, as a YAML scalar node. * Gets the ID of this job, as a YAML scalar node.
* This is the job's key within the `jobs` mapping. * This is the job's key within the `jobs` mapping.
*/ */
YAMLString getIdNode() { workflow.getJobs().maps(result, this) } YamlString getIdNode() { workflow.getJobs().maps(result, this) }
/** Gets the human-readable name of this job, if any, as a string. */ /** Gets the human-readable name of this job, if any, as a string. */
string getName() { result = this.getNameNode().getValue() } string getName() { result = this.getNameNode().getValue() }
/** Gets the human-readable name of this job, if any, as a YAML scalar node. */ /** Gets the human-readable name of this job, if any, as a YAML scalar node. */
YAMLString getNameNode() { result = this.lookup("name") } YamlString getNameNode() { result = this.lookup("name") }
/** Gets the step at the given index within this job. */ /** Gets the step at the given index within this job. */
Step getStep(int index) { result.getJob() = this and result.getIndex() = index } Step getStep(int index) { result.getJob() = this and result.getIndex() = index }
/** Gets the sequence of `steps` within this job. */ /** Gets the sequence of `steps` within this job. */
YAMLSequence getSteps() { result = this.lookup("steps") } YamlSequence getSteps() { result = this.lookup("steps") }
/** Gets the workflow this job belongs to. */ /** Gets the workflow this job belongs to. */
Workflow getWorkflow() { result = workflow } Workflow getWorkflow() { result = workflow }
@@ -99,7 +99,7 @@ module Actions {
* An `if` within a job. * An `if` within a job.
* See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idif. * See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idif.
*/ */
class JobIf extends YAMLNode, YAMLScalar { class JobIf extends YamlNode, YamlScalar {
Job job; Job job;
JobIf() { job.lookup("if") = this } JobIf() { job.lookup("if") = this }
@@ -112,7 +112,7 @@ module Actions {
* A step within an Actions job. * A step within an Actions job.
* See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idsteps. * See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idsteps.
*/ */
class Step extends YAMLNode, YAMLMapping { class Step extends YamlNode, YamlMapping {
int index; int index;
Job job; Job job;
@@ -134,14 +134,14 @@ module Actions {
StepIf getIf() { result.getStep() = this } StepIf getIf() { result.getStep() = this }
/** Gets the ID of this step, if any. */ /** Gets the ID of this step, if any. */
string getId() { result = this.lookup("id").(YAMLString).getValue() } string getId() { result = this.lookup("id").(YamlString).getValue() }
} }
/** /**
* An `if` within a step. * An `if` within a step.
* See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsif. * See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsif.
*/ */
class StepIf extends YAMLNode, YAMLScalar { class StepIf extends YamlNode, YamlScalar {
Step step; Step step;
StepIf() { step.lookup("if") = this } StepIf() { step.lookup("if") = this }
@@ -170,7 +170,7 @@ module Actions {
* *
* Does not handle local repository references, e.g. `.github/actions/action-name`. * Does not handle local repository references, e.g. `.github/actions/action-name`.
*/ */
class Uses extends YAMLNode, YAMLScalar { class Uses extends YamlNode, YamlScalar {
Step step; Step step;
Uses() { step.lookup("uses") = this } Uses() { step.lookup("uses") = this }
@@ -200,7 +200,7 @@ module Actions {
* arg2: abc * arg2: abc
* ``` * ```
*/ */
class With extends YAMLNode, YAMLMapping { class With extends YamlNode, YamlMapping {
Step step; Step step;
With() { step.lookup("with") = this } With() { step.lookup("with") = this }
@@ -219,7 +219,7 @@ module Actions {
* ref: ${{ github.event.pull_request.head.sha }} * ref: ${{ github.event.pull_request.head.sha }}
* ``` * ```
*/ */
class Ref extends YAMLNode, YAMLString { class Ref extends YamlNode, YamlString {
With with; With with;
Ref() { with.lookup("ref") = this } Ref() { with.lookup("ref") = this }
@@ -232,7 +232,7 @@ module Actions {
* A `run` field within an Actions job step, which runs command-line programs using an operating system shell. * A `run` field within an Actions job step, which runs command-line programs using an operating system shell.
* See https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsrun. * See https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsrun.
*/ */
class Run extends YAMLNode, YAMLString { class Run extends YamlNode, YamlString {
Step step; Step step;
Run() { step.lookup("run") = this } Run() { step.lookup("run") = this }

View File

@@ -178,7 +178,7 @@ predicate isGeneratedFileName(File f) {
predicate isGenerated(TopLevel tl) { predicate isGenerated(TopLevel tl) {
tl.isMinified() or tl.isMinified() or
isBundle(tl) or isBundle(tl) or
tl instanceof GWTGeneratedTopLevel or tl instanceof GwtGeneratedTopLevel or
tl instanceof DartGeneratedTopLevel or tl instanceof DartGeneratedTopLevel or
exists(GeneratedCodeMarkerComment gcmc | tl = gcmc.getTopLevel()) or exists(GeneratedCodeMarkerComment gcmc | tl = gcmc.getTopLevel()) or
hasManyInvocations(tl) or hasManyInvocations(tl) or

View File

@@ -43,7 +43,7 @@ class JsonStringifyCall extends DataFlow::CallNode {
/** /**
* A taint step through the [`json2csv`](https://www.npmjs.com/package/json2csv) library. * A taint step through the [`json2csv`](https://www.npmjs.com/package/json2csv) library.
*/ */
class JSON2CSVTaintStep extends TaintTracking::SharedTaintStep { class Json2CsvTaintStep extends TaintTracking::SharedTaintStep {
override predicate step(DataFlow::Node pred, DataFlow::Node succ) { override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
exists(API::CallNode call | exists(API::CallNode call |
call = call =
@@ -59,6 +59,9 @@ class JSON2CSVTaintStep extends TaintTracking::SharedTaintStep {
} }
} }
/** DEPRECATED: Alias for Json2CsvTaintStep */
deprecated class JSON2CSVTaintStep = Json2CsvTaintStep;
/** /**
* A step through the [`prettyjson`](https://www.npmjs.com/package/prettyjson) library. * A step through the [`prettyjson`](https://www.npmjs.com/package/prettyjson) library.
* This is not quite a `JSON.stringify` call, as it e.g. does not wrap keys in double quotes. * This is not quite a `JSON.stringify` call, as it e.g. does not wrap keys in double quotes.

View File

@@ -168,18 +168,24 @@ class PackageJson extends JsonObject {
JsonArray getCPUs() { result = this.getPropValue("cpu") } JsonArray getCPUs() { result = this.getPropValue("cpu") }
/** Gets a platform supported by this package. */ /** Gets a platform supported by this package. */
string getWhitelistedCPU() { string getWhitelistedCpu() {
result = this.getCPUs().getElementStringValue(_) and result = this.getCPUs().getElementStringValue(_) and
not result.matches("!%") not result.matches("!%")
} }
/** DEPRECATED: Alias for getWhitelistedCpu */
deprecated string getWhitelistedCPU() { result = this.getWhitelistedCpu() }
/** Gets a platform not supported by this package. */ /** Gets a platform not supported by this package. */
string getBlacklistedCPU() { string getBlacklistedCpu() {
exists(string str | str = this.getCPUs().getElementStringValue(_) | exists(string str | str = this.getCPUs().getElementStringValue(_) |
result = str.regexpCapture("!(.*)", 1) result = str.regexpCapture("!(.*)", 1)
) )
} }
/** DEPRECATED: Alias for getBlacklistedCpu */
deprecated string getBlacklistedCPU() { result = this.getBlacklistedCpu() }
/** Holds if this package prefers to be installed globally. */ /** Holds if this package prefers to be installed globally. */
predicate isPreferGlobal() { this.getPropValue("preferGlobal").(JsonBoolean).getValue() = "true" } predicate isPreferGlobal() { this.getPropValue("preferGlobal").(JsonBoolean).getValue() = "true" }

View File

@@ -64,8 +64,8 @@ private newtype TPrintAstNode =
// JSON // JSON
TJsonNode(JsonValue value) { shouldPrint(value, _) and not isNotNeeded(value) } or TJsonNode(JsonValue value) { shouldPrint(value, _) and not isNotNeeded(value) } or
// YAML // YAML
TYamlNode(YAMLNode n) { shouldPrint(n, _) and not isNotNeeded(n) } or TYamlNode(YamlNode n) { shouldPrint(n, _) and not isNotNeeded(n) } or
TYamlMappingNode(YAMLMapping mapping, int i) { TYamlMappingNode(YamlMapping mapping, int i) {
shouldPrint(mapping, _) and not isNotNeeded(mapping) and exists(mapping.getKeyNode(i)) shouldPrint(mapping, _) and not isNotNeeded(mapping) and exists(mapping.getKeyNode(i))
} or } or
// HTML // HTML
@@ -628,7 +628,7 @@ module PrintYaml {
* A print node representing a YAML value in a .yml file. * A print node representing a YAML value in a .yml file.
*/ */
class YamlNodeNode extends PrintAstNode, TYamlNode { class YamlNodeNode extends PrintAstNode, TYamlNode {
YAMLNode node; YamlNode node;
YamlNodeNode() { this = TYamlNode(node) } YamlNodeNode() { this = TYamlNode(node) }
@@ -639,10 +639,10 @@ module PrintYaml {
/** /**
* Gets the `YAMLNode` represented by this node. * Gets the `YAMLNode` represented by this node.
*/ */
final YAMLNode getValue() { result = node } final YamlNode getValue() { result = node }
override PrintAstNode getChild(int childIndex) { override PrintAstNode getChild(int childIndex) {
exists(YAMLNode child | result.(YamlNodeNode).getValue() = child | exists(YamlNode child | result.(YamlNodeNode).getValue() = child |
child = node.getChildNode(childIndex) child = node.getChildNode(childIndex)
) )
} }
@@ -657,7 +657,7 @@ module PrintYaml {
* Each child of this node aggregates the key and value of a mapping. * Each child of this node aggregates the key and value of a mapping.
*/ */
class YamlMappingNode extends YamlNodeNode { class YamlMappingNode extends YamlNodeNode {
override YAMLMapping node; override YamlMapping node;
override PrintAstNode getChild(int childIndex) { override PrintAstNode getChild(int childIndex) {
exists(YamlMappingMapNode map | map = result | map.maps(node, childIndex)) exists(YamlMappingMapNode map | map = result | map.maps(node, childIndex))
@@ -671,21 +671,21 @@ module PrintYaml {
* A print node representing the `i`th mapping in `mapping`. * A print node representing the `i`th mapping in `mapping`.
*/ */
class YamlMappingMapNode extends PrintAstNode, TYamlMappingNode { class YamlMappingMapNode extends PrintAstNode, TYamlMappingNode {
YAMLMapping mapping; YamlMapping mapping;
int i; int i;
YamlMappingMapNode() { this = TYamlMappingNode(mapping, i) } YamlMappingMapNode() { this = TYamlMappingNode(mapping, i) }
override string toString() { override string toString() {
result = "(Mapping " + i + ")" and not exists(mapping.getKeyNode(i).(YAMLScalar).getValue()) result = "(Mapping " + i + ")" and not exists(mapping.getKeyNode(i).(YamlScalar).getValue())
or or
result = "(Mapping " + i + ") " + mapping.getKeyNode(i).(YAMLScalar).getValue() + ":" result = "(Mapping " + i + ") " + mapping.getKeyNode(i).(YamlScalar).getValue() + ":"
} }
/** /**
* Holds if this print node represents the `index`th mapping of `m`. * Holds if this print node represents the `index`th mapping of `m`.
*/ */
predicate maps(YAMLMapping m, int index) { predicate maps(YamlMapping m, int index) {
m = mapping and m = mapping and
index = i index = i
} }

View File

@@ -1005,7 +1005,10 @@ module RegExpPatterns {
* Gets a pattern that matches common top-level domain names in lower case. * Gets a pattern that matches common top-level domain names in lower case.
* DEPRECATED: use `getACommonTld` instead * DEPRECATED: use `getACommonTld` instead
*/ */
deprecated predicate commonTLD = getACommonTld/0; deprecated predicate commonTld = getACommonTld/0;
/** DEPRECATED: Alias for commonTld */
deprecated predicate commonTLD = commonTld/0;
} }
/** /**

View File

@@ -291,10 +291,13 @@ class StrictModeDecl extends KnownDirective {
* "use asm"; * "use asm";
* ``` * ```
*/ */
class ASMJSDirective extends KnownDirective { class AsmJSDirective extends KnownDirective {
ASMJSDirective() { this.getDirectiveText() = "use asm" } AsmJSDirective() { this.getDirectiveText() = "use asm" }
} }
/** DEPRECATED: Alias for AsmJSDirective */
deprecated class ASMJSDirective = AsmJSDirective;
/** /**
* A Babel directive. * A Babel directive.
* *

View File

@@ -20,13 +20,13 @@ import javascript
* << : *DEFAULTS # an alias node referring to anchor `DEFAULTS` * << : *DEFAULTS # an alias node referring to anchor `DEFAULTS`
* ``` * ```
*/ */
class YAMLNode extends @yaml_node, Locatable { class YamlNode extends @yaml_node, Locatable {
override Location getLocation() { yaml_locations(this, result) } override Location getLocation() { yaml_locations(this, result) }
/** /**
* Gets the parent node of this node, which is always a collection. * Gets the parent node of this node, which is always a collection.
*/ */
YAMLCollection getParentNode() { yaml(this, _, result, _, _, _) } YamlCollection getParentNode() { yaml(this, _, result, _, _, _) }
/** /**
* Gets the `i`th child node of this node. * Gets the `i`th child node of this node.
@@ -34,12 +34,12 @@ class YAMLNode extends @yaml_node, Locatable {
* _Note_: The index of a child node relative to its parent is considered * _Note_: The index of a child node relative to its parent is considered
* an implementation detail and may change between versions of the extractor. * an implementation detail and may change between versions of the extractor.
*/ */
YAMLNode getChildNode(int i) { yaml(result, _, this, i, _, _) } YamlNode getChildNode(int i) { yaml(result, _, this, i, _, _) }
/** /**
* Gets a child node of this node. * Gets a child node of this node.
*/ */
YAMLNode getAChildNode() { result = this.getChildNode(_) } YamlNode getAChildNode() { result = this.getChildNode(_) }
/** /**
* Gets the number of child nodes of this node. * Gets the number of child nodes of this node.
@@ -49,12 +49,12 @@ class YAMLNode extends @yaml_node, Locatable {
/** /**
* Gets the `i`th child of this node, as a YAML value. * Gets the `i`th child of this node, as a YAML value.
*/ */
YAMLValue getChild(int i) { result = this.getChildNode(i).eval() } YamlValue getChild(int i) { result = this.getChildNode(i).eval() }
/** /**
* Gets a child of this node, as a YAML value. * Gets a child of this node, as a YAML value.
*/ */
YAMLValue getAChild() { result = this.getChild(_) } YamlValue getAChild() { result = this.getChild(_) }
/** /**
* Gets the tag of this node. * Gets the tag of this node.
@@ -79,16 +79,19 @@ class YAMLNode extends @yaml_node, Locatable {
/** /**
* Gets the toplevel document to which this node belongs. * Gets the toplevel document to which this node belongs.
*/ */
YAMLDocument getDocument() { result = this.getParentNode*() } YamlDocument getDocument() { result = this.getParentNode*() }
/** /**
* Gets the YAML value this node corresponds to after resolving aliases and includes. * Gets the YAML value this node corresponds to after resolving aliases and includes.
*/ */
YAMLValue eval() { result = this } YamlValue eval() { result = this }
override string getAPrimaryQlClass() { result = "YAMLNode" } override string getAPrimaryQlClass() { result = "YAMLNode" }
} }
/** DEPRECATED: Alias for YamlNode */
deprecated class YAMLNode = YamlNode;
/** /**
* A YAML value; that is, either a scalar or a collection. * A YAML value; that is, either a scalar or a collection.
* *
@@ -102,7 +105,10 @@ class YAMLNode extends @yaml_node, Locatable {
* - sequence * - sequence
* ``` * ```
*/ */
abstract class YAMLValue extends YAMLNode { } abstract class YamlValue extends YamlNode { }
/** DEPRECATED: Alias for YamlValue */
deprecated class YAMLValue = YamlValue;
/** /**
* A YAML scalar. * A YAML scalar.
@@ -118,7 +124,7 @@ abstract class YAMLValue extends YAMLNode { }
* "hello" * "hello"
* ``` * ```
*/ */
class YAMLScalar extends YAMLValue, @yaml_scalar_node { class YamlScalar extends YamlValue, @yaml_scalar_node {
/** /**
* Gets the style of this scalar, which is one of the following: * Gets the style of this scalar, which is one of the following:
* *
@@ -150,6 +156,9 @@ class YAMLScalar extends YAMLValue, @yaml_scalar_node {
override string getAPrimaryQlClass() { result = "YAMLScalar" } override string getAPrimaryQlClass() { result = "YAMLScalar" }
} }
/** DEPRECATED: Alias for YamlScalar */
deprecated class YAMLScalar = YamlScalar;
/** /**
* A YAML scalar representing an integer value. * A YAML scalar representing an integer value.
* *
@@ -160,8 +169,8 @@ class YAMLScalar extends YAMLValue, @yaml_scalar_node {
* 0xffff * 0xffff
* ``` * ```
*/ */
class YAMLInteger extends YAMLScalar { class YamlInteger extends YamlScalar {
YAMLInteger() { this.hasStandardTypeTag("int") } YamlInteger() { this.hasStandardTypeTag("int") }
/** /**
* Gets the value of this scalar, as an integer. * Gets the value of this scalar, as an integer.
@@ -169,6 +178,9 @@ class YAMLInteger extends YAMLScalar {
int getIntValue() { result = this.getValue().toInt() } int getIntValue() { result = this.getValue().toInt() }
} }
/** DEPRECATED: Alias for YamlInteger */
deprecated class YAMLInteger = YamlInteger;
/** /**
* A YAML scalar representing a floating point value. * A YAML scalar representing a floating point value.
* *
@@ -179,8 +191,8 @@ class YAMLInteger extends YAMLScalar {
* 6.626e-34 * 6.626e-34
* ``` * ```
*/ */
class YAMLFloat extends YAMLScalar { class YamlFloat extends YamlScalar {
YAMLFloat() { this.hasStandardTypeTag("float") } YamlFloat() { this.hasStandardTypeTag("float") }
/** /**
* Gets the value of this scalar, as a floating point number. * Gets the value of this scalar, as a floating point number.
@@ -188,6 +200,9 @@ class YAMLFloat extends YAMLScalar {
float getFloatValue() { result = this.getValue().toFloat() } float getFloatValue() { result = this.getValue().toFloat() }
} }
/** DEPRECATED: Alias for YamlFloat */
deprecated class YAMLFloat = YamlFloat;
/** /**
* A YAML scalar representing a time stamp. * A YAML scalar representing a time stamp.
* *
@@ -197,8 +212,8 @@ class YAMLFloat extends YAMLScalar {
* 2001-12-15T02:59:43.1Z * 2001-12-15T02:59:43.1Z
* ``` * ```
*/ */
class YAMLTimestamp extends YAMLScalar { class YamlTimestamp extends YamlScalar {
YAMLTimestamp() { this.hasStandardTypeTag("timestamp") } YamlTimestamp() { this.hasStandardTypeTag("timestamp") }
/** /**
* Gets the value of this scalar, as a date. * Gets the value of this scalar, as a date.
@@ -206,6 +221,9 @@ class YAMLTimestamp extends YAMLScalar {
date getDateValue() { result = this.getValue().toDate() } date getDateValue() { result = this.getValue().toDate() }
} }
/** DEPRECATED: Alias for YamlTimestamp */
deprecated class YAMLTimestamp = YamlTimestamp;
/** /**
* A YAML scalar representing a Boolean value. * A YAML scalar representing a Boolean value.
* *
@@ -215,8 +233,8 @@ class YAMLTimestamp extends YAMLScalar {
* true * true
* ``` * ```
*/ */
class YAMLBool extends YAMLScalar { class YamlBool extends YamlScalar {
YAMLBool() { this.hasStandardTypeTag("bool") } YamlBool() { this.hasStandardTypeTag("bool") }
/** /**
* Gets the value of this scalar, as a Boolean. * Gets the value of this scalar, as a Boolean.
@@ -224,6 +242,9 @@ class YAMLBool extends YAMLScalar {
boolean getBoolValue() { if this.getValue() = "true" then result = true else result = false } boolean getBoolValue() { if this.getValue() = "true" then result = true else result = false }
} }
/** DEPRECATED: Alias for YamlBool */
deprecated class YAMLBool = YamlBool;
/** /**
* A YAML scalar representing the null value. * A YAML scalar representing the null value.
* *
@@ -233,10 +254,13 @@ class YAMLBool extends YAMLScalar {
* null * null
* ``` * ```
*/ */
class YAMLNull extends YAMLScalar { class YamlNull extends YamlScalar {
YAMLNull() { this.hasStandardTypeTag("null") } YamlNull() { this.hasStandardTypeTag("null") }
} }
/** DEPRECATED: Alias for YamlNull */
deprecated class YAMLNull = YamlNull;
/** /**
* A YAML scalar representing a string value. * A YAML scalar representing a string value.
* *
@@ -246,10 +270,13 @@ class YAMLNull extends YAMLScalar {
* "hello" * "hello"
* ``` * ```
*/ */
class YAMLString extends YAMLScalar { class YamlString extends YamlScalar {
YAMLString() { this.hasStandardTypeTag("str") } YamlString() { this.hasStandardTypeTag("str") }
} }
/** DEPRECATED: Alias for YamlString */
deprecated class YAMLString = YamlString;
/** /**
* A YAML scalar representing a merge key. * A YAML scalar representing a merge key.
* *
@@ -260,10 +287,13 @@ class YAMLString extends YAMLScalar {
* << : *DEFAULTS # merge key * << : *DEFAULTS # merge key
* ``` * ```
*/ */
class YAMLMergeKey extends YAMLScalar { class YamlMergeKey extends YamlScalar {
YAMLMergeKey() { this.hasStandardTypeTag("merge") } YamlMergeKey() { this.hasStandardTypeTag("merge") }
} }
/** DEPRECATED: Alias for YamlMergeKey */
deprecated class YAMLMergeKey = YamlMergeKey;
/** /**
* A YAML scalar representing an `!include` directive. * A YAML scalar representing an `!include` directive.
* *
@@ -271,11 +301,11 @@ class YAMLMergeKey extends YAMLScalar {
* !include common.yaml * !include common.yaml
* ``` * ```
*/ */
class YAMLInclude extends YAMLScalar { class YamlInclude extends YamlScalar {
YAMLInclude() { this.getTag() = "!include" } YamlInclude() { this.getTag() = "!include" }
override YAMLValue eval() { override YamlValue eval() {
exists(YAMLDocument targetDoc | exists(YamlDocument targetDoc |
targetDoc.getFile().getAbsolutePath() = this.getTargetPath() and targetDoc.getFile().getAbsolutePath() = this.getTargetPath() and
result = targetDoc.eval() result = targetDoc.eval()
) )
@@ -293,6 +323,9 @@ class YAMLInclude extends YAMLScalar {
} }
} }
/** DEPRECATED: Alias for YamlInclude */
deprecated class YAMLInclude = YamlInclude;
/** /**
* A YAML collection, that is, either a mapping or a sequence. * A YAML collection, that is, either a mapping or a sequence.
* *
@@ -310,10 +343,13 @@ class YAMLInclude extends YAMLScalar {
* - -blue * - -blue
* ``` * ```
*/ */
class YAMLCollection extends YAMLValue, @yaml_collection_node { class YamlCollection extends YamlValue, @yaml_collection_node {
override string getAPrimaryQlClass() { result = "YAMLCollection" } override string getAPrimaryQlClass() { result = "YAMLCollection" }
} }
/** DEPRECATED: Alias for YamlCollection */
deprecated class YAMLCollection = YamlCollection;
/** /**
* A YAML mapping. * A YAML mapping.
* *
@@ -324,11 +360,11 @@ class YAMLCollection extends YAMLValue, @yaml_collection_node {
* y: 1 * y: 1
* ``` * ```
*/ */
class YAMLMapping extends YAMLCollection, @yaml_mapping_node { class YamlMapping extends YamlCollection, @yaml_mapping_node {
/** /**
* Gets the `i`th key of this mapping. * Gets the `i`th key of this mapping.
*/ */
YAMLNode getKeyNode(int i) { YamlNode getKeyNode(int i) {
i >= 0 and i >= 0 and
exists(int j | i = j - 1 and result = this.getChildNode(j)) exists(int j | i = j - 1 and result = this.getChildNode(j))
} }
@@ -336,7 +372,7 @@ class YAMLMapping extends YAMLCollection, @yaml_mapping_node {
/** /**
* Gets the `i`th value of this mapping. * Gets the `i`th value of this mapping.
*/ */
YAMLNode getValueNode(int i) { YamlNode getValueNode(int i) {
i >= 0 and i >= 0 and
exists(int j | i = -j - 1 and result = this.getChildNode(j)) exists(int j | i = -j - 1 and result = this.getChildNode(j))
} }
@@ -344,30 +380,33 @@ class YAMLMapping extends YAMLCollection, @yaml_mapping_node {
/** /**
* Gets the `i`th key of this mapping, as a YAML value. * Gets the `i`th key of this mapping, as a YAML value.
*/ */
YAMLValue getKey(int i) { result = this.getKeyNode(i).eval() } YamlValue getKey(int i) { result = this.getKeyNode(i).eval() }
/** /**
* Gets the `i`th value of this mapping, as a YAML value. * Gets the `i`th value of this mapping, as a YAML value.
*/ */
YAMLValue getValue(int i) { result = this.getValueNode(i).eval() } YamlValue getValue(int i) { result = this.getValueNode(i).eval() }
/** /**
* Holds if this mapping maps `key` to `value`. * Holds if this mapping maps `key` to `value`.
*/ */
predicate maps(YAMLValue key, YAMLValue value) { predicate maps(YamlValue key, YamlValue value) {
exists(int i | key = this.getKey(i) and value = this.getValue(i)) exists(int i | key = this.getKey(i) and value = this.getValue(i))
or or
exists(YAMLMergeKey merge, YAMLMapping that | this.maps(merge, that) | that.maps(key, value)) exists(YamlMergeKey merge, YamlMapping that | this.maps(merge, that) | that.maps(key, value))
} }
/** /**
* Gets the value that this mapping maps `key` to. * Gets the value that this mapping maps `key` to.
*/ */
YAMLValue lookup(string key) { exists(YAMLScalar s | s.getValue() = key | this.maps(s, result)) } YamlValue lookup(string key) { exists(YamlScalar s | s.getValue() = key | this.maps(s, result)) }
override string getAPrimaryQlClass() { result = "YAMLMapping" } override string getAPrimaryQlClass() { result = "YAMLMapping" }
} }
/** DEPRECATED: Alias for YamlMapping */
deprecated class YAMLMapping = YamlMapping;
/** /**
* A YAML sequence. * A YAML sequence.
* *
@@ -379,20 +418,23 @@ class YAMLMapping extends YAMLCollection, @yaml_mapping_node {
* - blue * - blue
* ``` * ```
*/ */
class YAMLSequence extends YAMLCollection, @yaml_sequence_node { class YamlSequence extends YamlCollection, @yaml_sequence_node {
/** /**
* Gets the `i`th element in this sequence. * Gets the `i`th element in this sequence.
*/ */
YAMLNode getElementNode(int i) { result = this.getChildNode(i) } YamlNode getElementNode(int i) { result = this.getChildNode(i) }
/** /**
* Gets the `i`th element in this sequence, as a YAML value. * Gets the `i`th element in this sequence, as a YAML value.
*/ */
YAMLValue getElement(int i) { result = this.getElementNode(i).eval() } YamlValue getElement(int i) { result = this.getElementNode(i).eval() }
override string getAPrimaryQlClass() { result = "YAMLSequence" } override string getAPrimaryQlClass() { result = "YAMLSequence" }
} }
/** DEPRECATED: Alias for YamlSequence */
deprecated class YAMLSequence = YamlSequence;
/** /**
* A YAML alias node referring to a target anchor. * A YAML alias node referring to a target anchor.
* *
@@ -402,8 +444,8 @@ class YAMLSequence extends YAMLCollection, @yaml_sequence_node {
* *DEFAULTS * *DEFAULTS
* ``` * ```
*/ */
class YAMLAliasNode extends YAMLNode, @yaml_alias_node { class YamlAliasNode extends YamlNode, @yaml_alias_node {
override YAMLValue eval() { override YamlValue eval() {
result.getAnchor() = this.getTarget() and result.getAnchor() = this.getTarget() and
result.getDocument() = this.getDocument() result.getDocument() = this.getDocument()
} }
@@ -416,6 +458,9 @@ class YAMLAliasNode extends YAMLNode, @yaml_alias_node {
override string getAPrimaryQlClass() { result = "YAMLAliasNode" } override string getAPrimaryQlClass() { result = "YAMLAliasNode" }
} }
/** DEPRECATED: Alias for YamlAliasNode */
deprecated class YAMLAliasNode = YamlAliasNode;
/** /**
* A YAML document. * A YAML document.
* *
@@ -427,14 +472,17 @@ class YAMLAliasNode extends YAMLNode, @yaml_alias_node {
* y: 1 * y: 1
* ``` * ```
*/ */
class YAMLDocument extends YAMLNode { class YamlDocument extends YamlNode {
YAMLDocument() { not exists(this.getParentNode()) } YamlDocument() { not exists(this.getParentNode()) }
} }
/** DEPRECATED: Alias for YamlDocument */
deprecated class YAMLDocument = YamlDocument;
/** /**
* An error message produced by the YAML parser while processing a YAML file. * An error message produced by the YAML parser while processing a YAML file.
*/ */
class YAMLParseError extends @yaml_error, Error { class YamlParseError extends @yaml_error, Error {
override Location getLocation() { yaml_locations(this, result) } override Location getLocation() { yaml_locations(this, result) }
override string getMessage() { yaml_errors(this, result) } override string getMessage() { yaml_errors(this, result) }
@@ -442,6 +490,9 @@ class YAMLParseError extends @yaml_error, Error {
override string toString() { result = this.getMessage() } override string toString() { result = this.getMessage() }
} }
/** DEPRECATED: Alias for YamlParseError */
deprecated class YAMLParseError = YamlParseError;
/** /**
* A YAML node that may contain sub-nodes that can be identified by a name. * A YAML node that may contain sub-nodes that can be identified by a name.
* I.e. a mapping, sequence, or scalar. * I.e. a mapping, sequence, or scalar.
@@ -464,30 +515,30 @@ class YAMLParseError extends @yaml_error, Error {
* *
* are equivalent. * are equivalent.
*/ */
class YAMLMappingLikeNode extends YAMLNode { class YamlMappingLikeNode extends YamlNode {
YAMLMappingLikeNode() { YamlMappingLikeNode() {
this instanceof YAMLMapping this instanceof YamlMapping
or or
this instanceof YAMLSequence this instanceof YamlSequence
or or
this instanceof YAMLScalar this instanceof YamlScalar
} }
/** Gets sub-name identified by `name`. */ /** Gets sub-name identified by `name`. */
YAMLNode getNode(string name) { YamlNode getNode(string name) {
exists(YAMLMapping mapping | exists(YamlMapping mapping |
mapping = this and mapping = this and
result = mapping.lookup(name) result = mapping.lookup(name)
) )
or or
exists(YAMLSequence sequence, YAMLNode node | exists(YamlSequence sequence, YamlNode node |
sequence = this and sequence = this and
sequence.getAChildNode() = node and sequence.getAChildNode() = node and
node.eval().toString() = name and node.eval().toString() = name and
result = node result = node
) )
or or
exists(YAMLScalar scalar | exists(YamlScalar scalar |
scalar = this and scalar = this and
scalar.getValue() = name and scalar.getValue() = name and
result = scalar result = scalar
@@ -496,19 +547,22 @@ class YAMLMappingLikeNode extends YAMLNode {
/** Gets the number of elements in this mapping or sequence. */ /** Gets the number of elements in this mapping or sequence. */
int getElementCount() { int getElementCount() {
exists(YAMLMapping mapping | exists(YamlMapping mapping |
mapping = this and mapping = this and
result = mapping.getNumChild() / 2 result = mapping.getNumChild() / 2
) )
or or
exists(YAMLSequence sequence | exists(YamlSequence sequence |
sequence = this and sequence = this and
result = sequence.getNumChild() result = sequence.getNumChild()
) )
or or
exists(YAMLScalar scalar | exists(YamlScalar scalar |
scalar = this and scalar = this and
result = 1 result = 1
) )
} }
} }
/** DEPRECATED: Alias for YamlMappingLikeNode */
deprecated class YAMLMappingLikeNode = YamlMappingLikeNode;

View File

@@ -171,10 +171,10 @@ abstract class CallWithNonLocalAnalyzedReturnFlow extends DataFlow::AnalyzedValu
/** /**
* Flow analysis for the return value of IIFEs. * Flow analysis for the return value of IIFEs.
*/ */
private class IIFEWithAnalyzedReturnFlow extends CallWithAnalyzedReturnFlow { private class IifeWithAnalyzedReturnFlow extends CallWithAnalyzedReturnFlow {
ImmediatelyInvokedFunctionExpr iife; ImmediatelyInvokedFunctionExpr iife;
IIFEWithAnalyzedReturnFlow() { astNode = iife.getInvocation() } IifeWithAnalyzedReturnFlow() { astNode = iife.getInvocation() }
override AnalyzedFunction getACallee() { result = iife.analyze() } override AnalyzedFunction getACallee() { result = iife.analyze() }
} }

View File

@@ -692,10 +692,10 @@ abstract private class CallWithAnalyzedParameters extends FunctionWithAnalyzedPa
/** /**
* Flow analysis for simple parameters of IIFEs. * Flow analysis for simple parameters of IIFEs.
*/ */
private class IIFEWithAnalyzedParameters extends CallWithAnalyzedParameters { private class IifeWithAnalyzedParameters extends CallWithAnalyzedParameters {
ImmediatelyInvokedFunctionExpr iife; ImmediatelyInvokedFunctionExpr iife;
IIFEWithAnalyzedParameters() { IifeWithAnalyzedParameters() {
this = iife and this = iife and
iife.getInvocationKind() = "direct" iife.getInvocationKind() = "direct"
} }

View File

@@ -276,15 +276,15 @@ class ExternalScriptDependency extends ScriptDependency, @xmlattribute {
/** /**
* A dependency on GWT indicated by a GWT header script. * A dependency on GWT indicated by a GWT header script.
*/ */
private class GWTDependency extends ScriptDependency { private class GwtDependency extends ScriptDependency {
GWTDependency() { this instanceof GWTHeader } GwtDependency() { this instanceof GwtHeader }
override predicate info(string id, string v) { override predicate info(string id, string v) {
id = "gwt" and id = "gwt" and
exists(GWTHeader h | h = this | exists(GwtHeader h | h = this |
v = h.getGWTVersion() v = h.getGwtVersion()
or or
not exists(h.getGWTVersion()) and v = "unknown" not exists(h.getGwtVersion()) and v = "unknown"
) )
} }

View File

@@ -904,8 +904,8 @@ private class SinonJS extends FrameworkLibraryWithGenericUrl, FrameworkLibraryWi
/** /**
* The TinyMCE framework. * The TinyMCE framework.
*/ */
private class TinyMCE extends FrameworkLibraryWithGenericUrl { private class TinyMce extends FrameworkLibraryWithGenericUrl {
TinyMCE() { this = "tinymce" } TinyMce() { this = "tinymce" }
override string getAnAlias() { result = "jquery.tinymce" or result = "tinymce.jquery" } override string getAnAlias() { result = "jquery.tinymce" or result = "tinymce.jquery" }
} }

View File

@@ -112,7 +112,7 @@ module Electron {
*/ */
class ProcessSender extends Process { class ProcessSender extends Process {
ProcessSender() { ProcessSender() {
exists(IPCSendRegistration reg | reg.getEmitter() instanceof MainProcess | exists(IpcSendRegistration reg | reg.getEmitter() instanceof MainProcess |
this = reg.getABoundCallbackParameter(1, 0).getAPropertyRead("sender") this = reg.getABoundCallbackParameter(1, 0).getAPropertyRead("sender")
) )
} }
@@ -123,28 +123,31 @@ module Electron {
* Does mostly the same as an EventEmitter event handler, * Does mostly the same as an EventEmitter event handler,
* except that values can be returned through the `event.returnValue` property. * except that values can be returned through the `event.returnValue` property.
*/ */
class IPCSendRegistration extends EventRegistration::DefaultEventRegistration, class IpcSendRegistration extends EventRegistration::DefaultEventRegistration,
DataFlow::MethodCallNode { DataFlow::MethodCallNode {
override Process emitter; override Process emitter;
IPCSendRegistration() { this = emitter.ref().getAMethodCall(EventEmitter::on()) } IpcSendRegistration() { this = emitter.ref().getAMethodCall(EventEmitter::on()) }
override DataFlow::Node getAReturnedValue() { override DataFlow::Node getAReturnedValue() {
result = this.getABoundCallbackParameter(1, 0).getAPropertyWrite("returnValue").getRhs() result = this.getABoundCallbackParameter(1, 0).getAPropertyWrite("returnValue").getRhs()
} }
override IPCDispatch getAReturnDispatch() { result.getCalleeName() = "sendSync" } override IpcDispatch getAReturnDispatch() { result.getCalleeName() = "sendSync" }
} }
/** DEPRECATED: Alias for IpcSendRegistration */
deprecated class IPCSendRegistration = IpcSendRegistration;
/** /**
* A dispatch of an IPC event. * A dispatch of an IPC event.
* An IPC event is sent from the renderer to the main process. * An IPC event is sent from the renderer to the main process.
* And a value can be returned through the `returnValue` property of the event (first parameter in the callback). * And a value can be returned through the `returnValue` property of the event (first parameter in the callback).
*/ */
class IPCDispatch extends EventDispatch::DefaultEventDispatch, DataFlow::InvokeNode { class IpcDispatch extends EventDispatch::DefaultEventDispatch, DataFlow::InvokeNode {
override Process emitter; override Process emitter;
IPCDispatch() { IpcDispatch() {
exists(string methodName | methodName = "sendSync" or methodName = "send" | exists(string methodName | methodName = "sendSync" or methodName = "send" |
this = emitter.ref().getAMemberCall(methodName) this = emitter.ref().getAMemberCall(methodName)
) )
@@ -163,7 +166,7 @@ module Electron {
/** /**
* Gets a registration that this dispatch can send an event to. * Gets a registration that this dispatch can send an event to.
*/ */
override IPCSendRegistration getAReceiver() { override IpcSendRegistration getAReceiver() {
this.getEmitter() instanceof RendererProcess and this.getEmitter() instanceof RendererProcess and
result.getEmitter() instanceof MainProcess result.getEmitter() instanceof MainProcess
or or
@@ -171,6 +174,9 @@ module Electron {
result.getEmitter() instanceof RendererProcess result.getEmitter() instanceof RendererProcess
} }
} }
/** DEPRECATED: Alias for IpcDispatch */
deprecated class IPCDispatch = IpcDispatch;
} }
/** /**

View File

@@ -13,10 +13,13 @@ abstract class EmscriptenMarkerComment extends GeneratedCodeMarkerComment { }
/** /**
* An `EMSCRIPTEN_START_ASM` marker comment. * An `EMSCRIPTEN_START_ASM` marker comment.
*/ */
class EmscriptenStartASMComment extends EmscriptenMarkerComment { class EmscriptenStartAsmComment extends EmscriptenMarkerComment {
EmscriptenStartASMComment() { getText().trim() = "EMSCRIPTEN_START_ASM" } EmscriptenStartAsmComment() { getText().trim() = "EMSCRIPTEN_START_ASM" }
} }
/** DEPRECATED: Alias for EmscriptenStartAsmComment */
deprecated class EmscriptenStartASMComment = EmscriptenStartAsmComment;
/** /**
* An `EMSCRIPTEN_START_FUNCS` marker comment. * An `EMSCRIPTEN_START_FUNCS` marker comment.
*/ */
@@ -27,10 +30,13 @@ class EmscriptenStartFuncsComment extends EmscriptenMarkerComment {
/** /**
* An `EMSCRIPTEN_END_ASM` marker comment. * An `EMSCRIPTEN_END_ASM` marker comment.
*/ */
class EmscriptenEndASMComment extends EmscriptenMarkerComment { class EmscriptenEndAsmComment extends EmscriptenMarkerComment {
EmscriptenEndASMComment() { getText().trim() = "EMSCRIPTEN_END_ASM" } EmscriptenEndAsmComment() { getText().trim() = "EMSCRIPTEN_END_ASM" }
} }
/** DEPRECATED: Alias for EmscriptenEndAsmComment */
deprecated class EmscriptenEndASMComment = EmscriptenEndAsmComment;
/** /**
* An `EMSCRIPTEN_END_FUNCS` marker comment. * An `EMSCRIPTEN_END_FUNCS` marker comment.
*/ */

View File

@@ -7,32 +7,44 @@ import javascript
/** /**
* A `$gwt_version` variable. * A `$gwt_version` variable.
*/ */
class GWTVersionVariable extends GlobalVariable { class GwtVersionVariable extends GlobalVariable {
GWTVersionVariable() { getName() = "$gwt_version" } GwtVersionVariable() { getName() = "$gwt_version" }
} }
/** DEPRECATED: Alias for GwtVersionVariable */
deprecated class GWTVersionVariable = GwtVersionVariable;
/** /**
* A GWT header script that defines the `$gwt_version` variable. * A GWT header script that defines the `$gwt_version` variable.
*/ */
class GWTHeader extends InlineScript { class GwtHeader extends InlineScript {
GWTHeader() { GwtHeader() {
exists(GWTVersionVariable gwtVersion | gwtVersion.getADeclaration().getTopLevel() = this) exists(GwtVersionVariable gwtVersion | gwtVersion.getADeclaration().getTopLevel() = this)
} }
/** /**
* Gets the GWT version this script was generated with, if it can be determined. * Gets the GWT version this script was generated with, if it can be determined.
*/ */
string getGWTVersion() { string getGwtVersion() {
exists(Expr e | e.getTopLevel() = this | exists(Expr e | e.getTopLevel() = this |
e = any(GWTVersionVariable v).getAnAssignedExpr() and e = any(GwtVersionVariable v).getAnAssignedExpr() and
result = e.getStringValue() result = e.getStringValue()
) )
} }
/** DEPRECATED: Alias for getGwtVersion */
deprecated string getGWTVersion() { result = getGwtVersion() }
} }
/** DEPRECATED: Alias for GwtHeader */
deprecated class GWTHeader = GwtHeader;
/** /**
* A toplevel in a file that appears to be GWT-generated. * A toplevel in a file that appears to be GWT-generated.
*/ */
class GWTGeneratedTopLevel extends TopLevel { class GwtGeneratedTopLevel extends TopLevel {
GWTGeneratedTopLevel() { exists(GWTHeader h | getFile() = h.getFile()) } GwtGeneratedTopLevel() { exists(GwtHeader h | getFile() = h.getFile()) }
} }
/** DEPRECATED: Alias for GwtGeneratedTopLevel */
deprecated class GWTGeneratedTopLevel = GwtGeneratedTopLevel;

View File

@@ -15,21 +15,21 @@ private module ServerLess {
* `codeURI` defaults to the empty string if no explicit value is set in the configuration. * `codeURI` defaults to the empty string if no explicit value is set in the configuration.
*/ */
private predicate hasServerlessHandler(File ymlFile, string handler, string codeUri) { private predicate hasServerlessHandler(File ymlFile, string handler, string codeUri) {
exists(YAMLMapping resource | ymlFile = resource.getFile() | exists(YamlMapping resource | ymlFile = resource.getFile() |
// There exists at least "AWS::Serverless::Function" and "Aliyun::Serverless::Function" // There exists at least "AWS::Serverless::Function" and "Aliyun::Serverless::Function"
resource.lookup("Type").(YAMLScalar).getValue().regexpMatch(".*::Serverless::Function") and resource.lookup("Type").(YamlScalar).getValue().regexpMatch(".*::Serverless::Function") and
exists(YAMLMapping properties | properties = resource.lookup("Properties") | exists(YamlMapping properties | properties = resource.lookup("Properties") |
handler = properties.lookup("Handler").(YAMLScalar).getValue() and handler = properties.lookup("Handler").(YamlScalar).getValue() and
if exists(properties.lookup("CodeUri")) if exists(properties.lookup("CodeUri"))
then codeUri = properties.lookup("CodeUri").(YAMLScalar).getValue() then codeUri = properties.lookup("CodeUri").(YamlScalar).getValue()
else codeUri = "" else codeUri = ""
) )
or or
// The `serverless` library, which specifies a top-level `functions` property // The `serverless` library, which specifies a top-level `functions` property
exists(YAMLMapping functions | exists(YamlMapping functions |
functions = resource.lookup("functions") and functions = resource.lookup("functions") and
not exists(resource.getParentNode()) and not exists(resource.getParentNode()) and
handler = functions.getValue(_).(YAMLMapping).lookup("handler").(YAMLScalar).getValue() and handler = functions.getValue(_).(YamlMapping).lookup("handler").(YamlScalar).getValue() and
codeUri = "" codeUri = ""
) )
) )

View File

@@ -27,8 +27,8 @@ class QUnitTest extends Test, @call_expr {
* that is, an invocation of a function named `it` where the first argument * that is, an invocation of a function named `it` where the first argument
* is a string and the second argument is a function. * is a string and the second argument is a function.
*/ */
class BDDTest extends Test, @call_expr { class BddTest extends Test, @call_expr {
BDDTest() { BddTest() {
exists(CallExpr call | call = this | exists(CallExpr call | call = this |
call.getCallee().(VarAccess).getName() = "it" and call.getCallee().(VarAccess).getName() = "it" and
exists(call.getArgument(0).getStringValue()) and exists(call.getArgument(0).getStringValue()) and
@@ -37,6 +37,9 @@ class BDDTest extends Test, @call_expr {
} }
} }
/** DEPRECATED: Alias for BddTest */
deprecated class BDDTest = BddTest;
/** /**
* Gets the test file for `f` with stem extension `stemExt`, where `stemExt` is "test" or "spec". * Gets the test file for `f` with stem extension `stemExt`, where `stemExt` is "test" or "spec".
* That is, a file named `<base>.<stemExt>.<ext>` in the * That is, a file named `<base>.<stemExt>.<ext>` in the

View File

@@ -281,7 +281,7 @@ private module JQueryClientRequest {
.getParameter(0) .getParameter(0)
or or
result = result =
getAResponseNodeFromAnXHRObject(this.getOptionArgument([0 .. 1], getAResponseNodeFromAnXhrObject(this.getOptionArgument([0 .. 1],
any(string method | method = "error" or method = "complete")) any(string method | method = "error" or method = "complete"))
.getALocalSource() .getALocalSource()
.(DataFlow::FunctionNode) .(DataFlow::FunctionNode)
@@ -303,15 +303,15 @@ private module JQueryClientRequest {
.getParameter(0) .getParameter(0)
or or
result = result =
getAResponseNodeFromAnXHRObject(request.getAMemberCall("fail").getCallback(0).getParameter(0)) getAResponseNodeFromAnXhrObject(request.getAMemberCall("fail").getCallback(0).getParameter(0))
} }
/** /**
* Gets a node referring to the response contained in an `jqXHR` object. * Gets a node referring to the response contained in an `jqXHR` object.
*/ */
private DataFlow::SourceNode getAResponseNodeFromAnXHRObject(DataFlow::SourceNode jqXHR) { private DataFlow::SourceNode getAResponseNodeFromAnXhrObject(DataFlow::SourceNode jqXhr) {
result = result =
jqXHR jqXhr
.getAPropertyRead(any(string s | .getAPropertyRead(any(string s |
s = "responseText" or s = "responseText" or
s = "responseXML" s = "responseXML"

View File

@@ -60,7 +60,7 @@ module ESLint {
} }
/** An `.eslintrc.yaml` file. */ /** An `.eslintrc.yaml` file. */
private class EslintrcYaml extends Configuration, YAMLDocument, YAMLMapping { private class EslintrcYaml extends Configuration, YamlDocument, YamlMapping {
EslintrcYaml() { EslintrcYaml() {
exists(string n | n = getFile().getBaseName() | exists(string n | n = getFile().getBaseName() |
n = ".eslintrc.yaml" or n = ".eslintrc.yml" or n = ".eslintrc" n = ".eslintrc.yaml" or n = ".eslintrc.yml" or n = ".eslintrc"
@@ -71,11 +71,11 @@ module ESLint {
} }
/** An ESLint configuration object in YAML format. */ /** An ESLint configuration object in YAML format. */
private class YamlConfigurationObject extends ConfigurationObject, YAMLMapping { private class YamlConfigurationObject extends ConfigurationObject, YamlMapping {
override Configuration getConfiguration() { this = result.(EslintrcYaml).getValue(_) } override Configuration getConfiguration() { this = result.(EslintrcYaml).getValue(_) }
override boolean getBooleanProperty(string p) { override boolean getBooleanProperty(string p) {
exists(string v | v = lookup(p).(YAMLBool).getValue() | exists(string v | v = lookup(p).(YamlBool).getValue() |
v = "true" and result = true v = "true" and result = true
or or
v = "false" and result = false v = "false" and result = false

View File

@@ -21,11 +21,11 @@ predicate config(string key, string val, Locatable valElement) {
val = valElement.(JsonString).getValue() val = valElement.(JsonString).getValue()
) )
or or
exists(YAMLMapping m, YAMLString keyElement | exists(YamlMapping m, YamlString keyElement |
m.maps(keyElement, valElement) and m.maps(keyElement, valElement) and
key = keyElement.getValue() and key = keyElement.getValue() and
( (
val = valElement.(YAMLString).getValue() val = valElement.(YamlString).getValue()
or or
valElement.toString() = "" and valElement.toString() = "" and
val = "" val = ""

View File

@@ -67,10 +67,10 @@ module XssThroughDom {
/** /**
* A source for text from a DOM property read by jQuery. * A source for text from a DOM property read by jQuery.
*/ */
class JQueryDOMPropertySource extends DomPropertySource instanceof JQuery::MethodCall { class JQueryDomPropertySource extends DomPropertySource instanceof JQuery::MethodCall {
string prop; string prop;
JQueryDOMPropertySource() { JQueryDomPropertySource() {
exists(string methodName | exists(string methodName |
this.getMethodName() = methodName and this.getMethodName() = methodName and
this.getNumArgument() = 1 and this.getNumArgument() = 1 and
@@ -87,6 +87,9 @@ module XssThroughDom {
override string getPropertyName() { result = prop } override string getPropertyName() { result = prop }
} }
/** DEPRECATED: Alias for JQueryDomPropertySource */
deprecated class JQueryDOMPropertySource = JQueryDomPropertySource;
/** /**
* A source for text from the DOM from a `d3` method call. * A source for text from the DOM from a `d3` method call.
*/ */

View File

@@ -61,8 +61,8 @@ module StaticCreation {
} }
/** A script element that refers to untrusted content. */ /** A script element that refers to untrusted content. */
class CDNScriptElementWithUntrustedContent extends AddsUntrustedUrl, HTML::ScriptElement { class CdnScriptElementWithUntrustedContent extends AddsUntrustedUrl, HTML::ScriptElement {
CDNScriptElementWithUntrustedContent() { CdnScriptElementWithUntrustedContent() {
not exists(string digest | not digest = "" | this.getIntegrityDigest() = digest) and not exists(string digest | not digest = "" | this.getIntegrityDigest() = digest) and
isCdnUrlWithCheckingRequired(this.getSourcePath()) isCdnUrlWithCheckingRequired(this.getSourcePath())
} }

View File

@@ -78,9 +78,9 @@ class ProbableJob extends Actions::Job {
/** /**
* An action step that doesn't contain `actor` or `label` check in `if:` or * An action step that doesn't contain `actor` or `label` check in `if:` or
*/ */
class ProbablePullRequestTarget extends Actions::On, YAMLMappingLikeNode { class ProbablePullRequestTarget extends Actions::On, YamlMappingLikeNode {
ProbablePullRequestTarget() { ProbablePullRequestTarget() {
exists(YAMLNode prtNode | exists(YamlNode prtNode |
// The `on:` is triggered on `pull_request_target` // The `on:` is triggered on `pull_request_target`
this.getNode("pull_request_target") = prtNode and this.getNode("pull_request_target") = prtNode and
( (
@@ -88,7 +88,7 @@ class ProbablePullRequestTarget extends Actions::On, YAMLMappingLikeNode {
not exists(prtNode.getAChild()) not exists(prtNode.getAChild())
or or
// or has the filter, that is something else than just [labeled] // or has the filter, that is something else than just [labeled]
exists(YAMLMappingLikeNode prt, YAMLMappingLikeNode types | exists(YamlMappingLikeNode prt, YamlMappingLikeNode types |
types = prt.getNode("types") and types = prt.getNode("types") and
prtNode = prt and prtNode = prt and
( (

View File

@@ -1,18 +1,18 @@
import javascript import javascript
query predicate anchors(YAMLNode n, string anchor) { n.getAnchor() = anchor } query predicate anchors(YamlNode n, string anchor) { n.getAnchor() = anchor }
query predicate eval(YAMLNode n, YAMLValue eval) { query predicate eval(YamlNode n, YamlValue eval) {
not n.eval() = n and not n.eval() = n and
eval = n.eval() eval = n.eval()
} }
query predicate yamlParseError(YAMLParseError err) { any() } query predicate yamlParseError(YamlParseError err) { any() }
query predicate yamlMapping_maps(YAMLMapping m, YAMLValue k, YAMLValue v) { m.maps(k, v) } query predicate yamlMapping_maps(YamlMapping m, YamlValue k, YamlValue v) { m.maps(k, v) }
query predicate yamlNode(YAMLNode n, string tag) { tag = n.getTag() } query predicate yamlNode(YamlNode n, string tag) { tag = n.getTag() }
query predicate yamlScalar(YAMLScalar s, string style, string value) { query predicate yamlScalar(YamlScalar s, string style, string value) {
style = s.getStyle() and value = s.getValue() style = s.getStyle() and value = s.getValue()
} }

View File

@@ -1,4 +1,4 @@
import semmle.javascript.frameworks.GWT import semmle.javascript.frameworks.GWT
from GWTGeneratedTopLevel g from GwtGeneratedTopLevel g
select g select g

View File

@@ -1,4 +1,4 @@
import semmle.javascript.frameworks.GWT import semmle.javascript.frameworks.GWT
from GWTHeader h from GwtHeader h
select h select h

View File

@@ -3,7 +3,7 @@ import javascript
import HTTP import HTTP
/** A RAML specification. */ /** A RAML specification. */
class RamlSpec extends YAMLDocument, YAMLMapping { class RamlSpec extends YamlDocument, YamlMapping {
RamlSpec() { getLocation().getFile().getExtension() = "raml" } RamlSpec() { getLocation().getFile().getExtension() = "raml" }
} }
@@ -11,10 +11,10 @@ class RamlSpec extends YAMLDocument, YAMLMapping {
deprecated class RAMLSpec = RamlSpec; deprecated class RAMLSpec = RamlSpec;
/** A RAML resource specification. */ /** A RAML resource specification. */
class RamlResource extends YAMLMapping { class RamlResource extends YamlMapping {
RamlResource() { RamlResource() {
getDocument() instanceof RamlSpec and getDocument() instanceof RamlSpec and
exists(YAMLMapping m, string name | exists(YamlMapping m, string name |
this = m.lookup(name) and this = m.lookup(name) and
name.matches("/%") name.matches("/%")
) )
@@ -41,16 +41,16 @@ class RamlResource extends YAMLMapping {
deprecated class RAMLResource = RamlResource; deprecated class RAMLResource = RamlResource;
/** A RAML method specification. */ /** A RAML method specification. */
class RamlMethod extends YAMLValue { class RamlMethod extends YamlValue {
RamlMethod() { RamlMethod() {
getDocument() instanceof RamlSpec and getDocument() instanceof RamlSpec and
exists(YAMLMapping obj | this = obj.lookup(httpVerb())) exists(YamlMapping obj | this = obj.lookup(httpVerb()))
} }
/** Get the response specification for the given status code. */ /** Get the response specification for the given status code. */
YAMLValue getResponse(int code) { YamlValue getResponse(int code) {
exists(YAMLMapping obj, string s | exists(YamlMapping obj, string s |
obj = this.(YAMLMapping).lookup("responses") and obj = this.(YamlMapping).lookup("responses") and
result = obj.lookup(s) and result = obj.lookup(s) and
code = s.toInt() code = s.toInt()
) )

View File

@@ -1,7 +1,7 @@
import javascript import javascript
/** A RAML specification. */ /** A RAML specification. */
class RamlSpec extends YAMLDocument, YAMLMapping { class RamlSpec extends YamlDocument, YamlMapping {
RamlSpec() { getLocation().getFile().getExtension() = "raml" } RamlSpec() { getLocation().getFile().getExtension() = "raml" }
} }

View File

@@ -3,15 +3,15 @@ import javascript
string httpVerb() { result = ["get", "put", "post", "delete"] } string httpVerb() { result = ["get", "put", "post", "delete"] }
/** A RAML specification. */ /** A RAML specification. */
class RamlSpec extends YAMLDocument, YAMLMapping { class RamlSpec extends YamlDocument, YamlMapping {
RamlSpec() { getLocation().getFile().getExtension() = "raml" } RamlSpec() { getLocation().getFile().getExtension() = "raml" }
} }
/** A RAML resource specification. */ /** A RAML resource specification. */
class RamlResource extends YAMLMapping { class RamlResource extends YamlMapping {
RamlResource() { RamlResource() {
getDocument() instanceof RamlSpec and getDocument() instanceof RamlSpec and
exists(YAMLMapping m, string name | exists(YamlMapping m, string name |
this = m.lookup(name) and this = m.lookup(name) and
name.matches("/%") name.matches("/%")
) )
@@ -35,16 +35,16 @@ class RamlResource extends YAMLMapping {
} }
/** A RAML method specification. */ /** A RAML method specification. */
class RamlMethod extends YAMLValue { class RamlMethod extends YamlValue {
RamlMethod() { RamlMethod() {
getDocument() instanceof RamlSpec and getDocument() instanceof RamlSpec and
exists(YAMLMapping obj | this = obj.lookup(httpVerb())) exists(YamlMapping obj | this = obj.lookup(httpVerb()))
} }
/** Get the response specification for the given status code. */ /** Get the response specification for the given status code. */
YAMLValue getResponse(int code) { YamlValue getResponse(int code) {
exists(YAMLMapping obj, string s | exists(YamlMapping obj, string s |
obj = this.(YAMLMapping).lookup("responses") and obj = this.(YamlMapping).lookup("responses") and
result = obj.lookup(s) and result = obj.lookup(s) and
code = s.toInt() code = s.toInt()
) )

View File

@@ -3,15 +3,15 @@ import javascript
string httpVerb() { result = ["get", "put", "post", "delete"] } string httpVerb() { result = ["get", "put", "post", "delete"] }
/** A RAML specification. */ /** A RAML specification. */
class RamlSpec extends YAMLDocument, YAMLMapping { class RamlSpec extends YamlDocument, YamlMapping {
RamlSpec() { getLocation().getFile().getExtension() = "raml" } RamlSpec() { getLocation().getFile().getExtension() = "raml" }
} }
/** A RAML resource specification. */ /** A RAML resource specification. */
class RamlResource extends YAMLMapping { class RamlResource extends YamlMapping {
RamlResource() { RamlResource() {
getDocument() instanceof RamlSpec and getDocument() instanceof RamlSpec and
exists(YAMLMapping m, string name | exists(YamlMapping m, string name |
this = m.lookup(name) and this = m.lookup(name) and
name.matches("/%") name.matches("/%")
) )
@@ -34,10 +34,10 @@ class RamlResource extends YAMLMapping {
} }
} }
class RamlMethod extends YAMLValue { class RamlMethod extends YamlValue {
RamlMethod() { RamlMethod() {
getDocument() instanceof RamlSpec and getDocument() instanceof RamlSpec and
exists(YAMLMapping obj | this = obj.lookup(httpVerb())) exists(YamlMapping obj | this = obj.lookup(httpVerb()))
} }
} }

View File

@@ -3,15 +3,15 @@ import javascript
string httpVerb() { result = ["get", "put", "post", "delete"] } string httpVerb() { result = ["get", "put", "post", "delete"] }
/** A RAML specification. */ /** A RAML specification. */
class RamlSpec extends YAMLDocument, YAMLMapping { class RamlSpec extends YamlDocument, YamlMapping {
RamlSpec() { getLocation().getFile().getExtension() = "raml" } RamlSpec() { getLocation().getFile().getExtension() = "raml" }
} }
/** A RAML resource specification. */ /** A RAML resource specification. */
class RamlResource extends YAMLMapping { class RamlResource extends YamlMapping {
RamlResource() { RamlResource() {
getDocument() instanceof RamlSpec and getDocument() instanceof RamlSpec and
exists(YAMLMapping m, string name | exists(YamlMapping m, string name |
this = m.lookup(name) and this = m.lookup(name) and
name.matches("/%") name.matches("/%")
) )
@@ -35,16 +35,16 @@ class RamlResource extends YAMLMapping {
} }
/** A RAML method specification. */ /** A RAML method specification. */
class RamlMethod extends YAMLValue { class RamlMethod extends YamlValue {
RamlMethod() { RamlMethod() {
getDocument() instanceof RamlSpec and getDocument() instanceof RamlSpec and
exists(YAMLMapping obj | this = obj.lookup(httpVerb())) exists(YamlMapping obj | this = obj.lookup(httpVerb()))
} }
/** Get the response specification for the given status code. */ /** Get the response specification for the given status code. */
YAMLValue getResponse(int code) { YamlValue getResponse(int code) {
exists(YAMLMapping obj, string s | exists(YamlMapping obj, string s |
obj = this.(YAMLMapping).lookup("responses") and obj = this.(YamlMapping).lookup("responses") and
result = obj.lookup(s) and result = obj.lookup(s) and
code = s.toInt() code = s.toInt()
) )

View File

@@ -2098,8 +2098,8 @@ private module StdlibPrivate {
* *
* See https://docs.python.org/3.10/library/wsgiref.html#wsgiref.simple_server.WSGIRequestHandler.get_environ * See https://docs.python.org/3.10/library/wsgiref.html#wsgiref.simple_server.WSGIRequestHandler.get_environ
*/ */
class WSGIEnvirontParameter extends RemoteFlowSource::Range, DataFlow::ParameterNode { class WsgiEnvirontParameter extends RemoteFlowSource::Range, DataFlow::ParameterNode {
WSGIEnvirontParameter() { WsgiEnvirontParameter() {
exists(WsgirefSimpleServerApplication func | exists(WsgirefSimpleServerApplication func |
if func.isMethod() if func.isMethod()
then this.getParameter() = func.getArg(1) then this.getParameter() = func.getArg(1)
@@ -2112,6 +2112,9 @@ private module StdlibPrivate {
} }
} }
/** DEPRECATED: Alias for WsgiEnvirontParameter */
deprecated class WSGIEnvirontParameter = WsgiEnvirontParameter;
/** /**
* Gets a reference to the parameter of a `WsgirefSimpleServerApplication` that * Gets a reference to the parameter of a `WsgirefSimpleServerApplication` that
* takes the `start_response` function. * takes the `start_response` function.

View File

@@ -22,11 +22,14 @@ private module ExperimentalPrivateDjango {
module Request { module Request {
module HttpRequest { module HttpRequest {
class DjangoGETParameter extends DataFlow::Node, RemoteFlowSource::Range { class DjangoGetParameter extends DataFlow::Node, RemoteFlowSource::Range {
DjangoGETParameter() { this = request().getMember("GET").getMember("get").getACall() } DjangoGetParameter() { this = request().getMember("GET").getMember("get").getACall() }
override string getSourceType() { result = "django.http.request.GET.get" } override string getSourceType() { result = "django.http.request.GET.get" }
} }
/** DEPRECATED: Alias for DjangoGetParameter */
deprecated class DjangoGETParameter = DjangoGetParameter;
} }
} }

View File

@@ -126,9 +126,9 @@ private module Ldap {
( (
// ldap_connection.start_tls_s() // ldap_connection.start_tls_s()
// see https://www.python-ldap.org/en/python-ldap-3.3.0/reference/ldap.html#ldap.LDAPObject.start_tls_s // see https://www.python-ldap.org/en/python-ldap-3.3.0/reference/ldap.html#ldap.LDAPObject.start_tls_s
exists(DataFlow::MethodCallNode startTLS | exists(DataFlow::MethodCallNode startTls |
startTLS.getObject().getALocalSource() = initialize and startTls.getObject().getALocalSource() = initialize and
startTLS.getMethodName() = "start_tls_s" startTls.getMethodName() = "start_tls_s"
) )
or or
// ldap_connection.set_option(ldap.OPT_X_TLS_%s, True) // ldap_connection.set_option(ldap.OPT_X_TLS_%s, True)
@@ -234,9 +234,9 @@ private module Ldap {
or or
// ldap_connection.start_tls_s() // ldap_connection.start_tls_s()
// see https://www.python-ldap.org/en/python-ldap-3.3.0/reference/ldap.html#ldap.LDAPObject.start_tls_s // see https://www.python-ldap.org/en/python-ldap-3.3.0/reference/ldap.html#ldap.LDAPObject.start_tls_s
exists(DataFlow::MethodCallNode startTLS | exists(DataFlow::MethodCallNode startTls |
startTLS.getMethodName() = "start_tls_s" and startTls.getMethodName() = "start_tls_s" and
startTLS.getObject().getALocalSource() = this startTls.getObject().getALocalSource() = this
) )
} }

View File

@@ -31,8 +31,8 @@ module SmtpLib {
* argument. Used because of the impossibility to get local source nodes from `_subparts`' * argument. Used because of the impossibility to get local source nodes from `_subparts`'
* `(List|Tuple)` elements. * `(List|Tuple)` elements.
*/ */
private class SMTPMessageConfig extends TaintTracking2::Configuration { private class SmtpMessageConfig extends TaintTracking2::Configuration {
SMTPMessageConfig() { this = "SMTPMessageConfig" } SmtpMessageConfig() { this = "SMTPMessageConfig" }
override predicate isSource(DataFlow::Node source) { source = mimeText(_) } override predicate isSource(DataFlow::Node source) { source = mimeText(_) }
@@ -87,7 +87,7 @@ module SmtpLib {
sink = sink =
[sendCall.getArg(2), sendCall.getArg(2).(DataFlow::MethodCallNode).getObject()] [sendCall.getArg(2), sendCall.getArg(2).(DataFlow::MethodCallNode).getObject()]
.getALocalSource() and .getALocalSource() and
any(SMTPMessageConfig a) any(SmtpMessageConfig a)
.hasFlow(source, sink.(DataFlow::CallCfgNode).getArgByName("_subparts")) .hasFlow(source, sink.(DataFlow::CallCfgNode).getArgByName("_subparts"))
or or
// via .attach() // via .attach()
@@ -117,7 +117,7 @@ module SmtpLib {
* * `sub` would be `message["Subject"]` (`Subscript`) * * `sub` would be `message["Subject"]` (`Subscript`)
* * `result` would be `"multipart test"` * * `result` would be `"multipart test"`
*/ */
private DataFlow::Node getSMTPSubscriptByIndex(DataFlow::CallCfgNode sendCall, string index) { private DataFlow::Node getSmtpSubscriptByIndex(DataFlow::CallCfgNode sendCall, string index) {
exists(DefinitionNode def, Subscript sub | exists(DefinitionNode def, Subscript sub |
sub = def.getNode() and sub = def.getNode() and
DataFlow::exprNode(sub.getObject()).getALocalSource() = DataFlow::exprNode(sub.getObject()).getALocalSource() =
@@ -163,15 +163,15 @@ module SmtpLib {
override DataFlow::Node getHtmlBody() { result = getSmtpMessage(this, "html") } override DataFlow::Node getHtmlBody() { result = getSmtpMessage(this, "html") }
override DataFlow::Node getTo() { override DataFlow::Node getTo() {
result in [this.getArg(1), getSMTPSubscriptByIndex(this, "To")] result in [this.getArg(1), getSmtpSubscriptByIndex(this, "To")]
} }
override DataFlow::Node getFrom() { override DataFlow::Node getFrom() {
result in [this.getArg(0), getSMTPSubscriptByIndex(this, "From")] result in [this.getArg(0), getSmtpSubscriptByIndex(this, "From")]
} }
override DataFlow::Node getSubject() { override DataFlow::Node getSubject() {
result in [this.getArg(2), getSMTPSubscriptByIndex(this, "Subject")] result in [this.getArg(2), getSmtpSubscriptByIndex(this, "Subject")]
} }
} }
} }

View File

@@ -13,7 +13,7 @@ class DataFlowTest extends FlowTest {
} }
} }
query predicate missingAnnotationOnSINK(Location location, string error, string element) { query predicate missingAnnotationOnSink(Location location, string error, string element) {
error = "ERROR, you should add `# $ MISSING: flow` annotation" and error = "ERROR, you should add `# $ MISSING: flow` annotation" and
exists(DataFlow::Node sink | exists(DataFlow::Node sink |
exists(DataFlow::CallCfgNode call | exists(DataFlow::CallCfgNode call |
@@ -31,3 +31,6 @@ query predicate missingAnnotationOnSINK(Location location, string error, string
) )
) )
} }
/** DEPRECATED: Alias for missingAnnotationOnSink */
deprecated predicate missingAnnotationOnSINK = missingAnnotationOnSink/3;

View File

@@ -2477,15 +2477,18 @@ class BindingSet extends Annotation {
*/ */
module YAML { module YAML {
/** A node in a YAML file */ /** A node in a YAML file */
class YAMLNode extends TYamlNode, AstNode { class YamlNode extends TYamlNode, AstNode {
/** Holds if the predicate is a root node (has no parent) */ /** Holds if the predicate is a root node (has no parent) */
predicate isRoot() { not exists(this.getParent()) } predicate isRoot() { not exists(this.getParent()) }
override AstNode getParent() { toGenerateYaml(result) = toGenerateYaml(this).getParent() } override AstNode getParent() { toGenerateYaml(result) = toGenerateYaml(this).getParent() }
} }
/** DEPRECATED: Alias for YamlNode */
deprecated class YAMLNode = YamlNode;
/** A YAML comment. */ /** A YAML comment. */
class YamlComment extends TYamlCommemt, YAMLNode { class YamlComment extends TYamlCommemt, YamlNode {
Yaml::Comment yamlcomment; Yaml::Comment yamlcomment;
YamlComment() { this = TYamlCommemt(yamlcomment) } YamlComment() { this = TYamlCommemt(yamlcomment) }
@@ -2497,7 +2500,7 @@ module YAML {
deprecated class YAMLComment = YamlComment; deprecated class YAMLComment = YamlComment;
/** A YAML entry. */ /** A YAML entry. */
class YamlEntry extends TYamlEntry, YAMLNode { class YamlEntry extends TYamlEntry, YamlNode {
Yaml::Entry yamle; Yaml::Entry yamle;
YamlEntry() { this = TYamlEntry(yamle) } YamlEntry() { this = TYamlEntry(yamle) }
@@ -2527,7 +2530,7 @@ module YAML {
deprecated class YAMLEntry = YamlEntry; deprecated class YAMLEntry = YamlEntry;
/** A YAML key. */ /** A YAML key. */
class YamlKey extends TYamlKey, YAMLNode { class YamlKey extends TYamlKey, YamlNode {
Yaml::Key yamlkey; Yaml::Key yamlkey;
YamlKey() { this = TYamlKey(yamlkey) } YamlKey() { this = TYamlKey(yamlkey) }
@@ -2566,7 +2569,7 @@ module YAML {
deprecated class YAMLKey = YamlKey; deprecated class YAMLKey = YamlKey;
/** A YAML list item. */ /** A YAML list item. */
class YamlListItem extends TYamlListitem, YAMLNode { class YamlListItem extends TYamlListitem, YamlNode {
Yaml::Listitem yamllistitem; Yaml::Listitem yamllistitem;
YamlListItem() { this = TYamlListitem(yamllistitem) } YamlListItem() { this = TYamlListitem(yamllistitem) }
@@ -2583,7 +2586,7 @@ module YAML {
deprecated class YAMLListItem = YamlListItem; deprecated class YAMLListItem = YamlListItem;
/** A YAML value. */ /** A YAML value. */
class YamlValue extends TYamlValue, YAMLNode { class YamlValue extends TYamlValue, YamlNode {
Yaml::Value yamlvalue; Yaml::Value yamlvalue;
YamlValue() { this = TYamlValue(yamlvalue) } YamlValue() { this = TYamlValue(yamlvalue) }
@@ -2691,7 +2694,7 @@ module YAML {
Location getLocation() { Location getLocation() {
// hacky, just pick the first node in the file. // hacky, just pick the first node in the file.
result = result =
min(YAMLNode entry, Location l, File f | min(YamlNode entry, Location l, File f |
entry.getLocation().getFile() = file and entry.getLocation().getFile() = file and
f = file and f = file and
l = entry.getLocation() l = entry.getLocation()

View File

@@ -97,13 +97,13 @@ class Feature extends TFeature {
abstract string getConstantName(); abstract string getConstantName();
} }
private class FeatureNOENT extends Feature, TNOENT { private class FeatureNoent extends Feature, TNOENT {
override int getValue() { result = 2 } override int getValue() { result = 2 }
override string getConstantName() { result = "NOENT" } override string getConstantName() { result = "NOENT" }
} }
private class FeatureNONET extends Feature, TNONET { private class FeatureNonet extends Feature, TNONET {
override int getValue() { result = 2048 } override int getValue() { result = 2048 }
override string getConstantName() { result = "NONET" } override string getConstantName() { result = "NONET" }