mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
rename more acronyms
This commit is contained in:
@@ -404,7 +404,10 @@ class Class extends UserType {
|
||||
* compiled for. For this reason, the `is_pod_class` predicate is
|
||||
* 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
|
||||
|
||||
@@ -79,17 +79,17 @@ predicate isAggregateType03(Type t) {
|
||||
* 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.
|
||||
*/
|
||||
predicate isPODClass03(Class c) {
|
||||
predicate isPodClass03(Class c) {
|
||||
isAggregateClass03(c) and
|
||||
not exists(Variable v |
|
||||
v.getDeclaringType() = c and
|
||||
not v.isStatic()
|
||||
|
|
||||
not isPODType03(v.getType())
|
||||
not isPodType03(v.getType())
|
||||
or
|
||||
exists(ArrayType at |
|
||||
at = v.getType() and
|
||||
not isPODType03(at.getBaseType())
|
||||
not isPodType03(at.getBaseType())
|
||||
)
|
||||
or
|
||||
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
|
||||
* 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
|
||||
* collectively called POD types.
|
||||
*/
|
||||
predicate isPODType03(Type t) {
|
||||
predicate isPodType03(Type t) {
|
||||
exists(Type ut | ut = t.getUnderlyingType() |
|
||||
isScalarType03(ut)
|
||||
or
|
||||
isPODClass03(ut)
|
||||
isPodClass03(ut)
|
||||
or
|
||||
exists(ArrayType at | at = ut and isPODType03(at.getBaseType()))
|
||||
exists(ArrayType at | at = ut and isPodType03(at.getBaseType()))
|
||||
or
|
||||
isPODType03(ut.(SpecifiedType).getUnspecifiedType())
|
||||
isPodType03(ut.(SpecifiedType).getUnspecifiedType())
|
||||
)
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for isPodType03 */
|
||||
deprecated predicate isPODType03 = isPodType03/1;
|
||||
|
||||
@@ -238,7 +238,7 @@ predicate dependsOnTransitive(DependsSource src, Element dest) {
|
||||
/**
|
||||
* 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
|
||||
getDeclarationEntries(t, dest)
|
||||
}
|
||||
@@ -247,8 +247,8 @@ private predicate dependsOnTDE(Element src, Type t, TypeDeclarationEntry dest) {
|
||||
* A dependency that targets a visible TypeDeclarationEntry.
|
||||
*/
|
||||
pragma[noopt]
|
||||
private predicate dependsOnVisibleTDE(Element src, Type t, TypeDeclarationEntry dest) {
|
||||
dependsOnTDE(src, t, dest) and
|
||||
private predicate dependsOnVisibleTde(Element src, Type t, TypeDeclarationEntry dest) {
|
||||
dependsOnTde(src, t, dest) and
|
||||
exists(File g | g = dest.getFile() |
|
||||
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) {
|
||||
exists(Type t |
|
||||
// dependency from a Type use -> unique visible TDE
|
||||
dependsOnVisibleTDE(src, t, dest) and
|
||||
strictcount(TypeDeclarationEntry alt | dependsOnVisibleTDE(src, t, alt)) = 1
|
||||
dependsOnVisibleTde(src, t, dest) and
|
||||
strictcount(TypeDeclarationEntry alt | dependsOnVisibleTde(src, t, alt)) = 1
|
||||
)
|
||||
or
|
||||
exists(TypedefType mid |
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import semmle.code.cpp.Macro
|
||||
|
||||
/** A macro defining NULL. */
|
||||
class NULLMacro extends Macro {
|
||||
NULLMacro() { this.getHead() = "NULL" }
|
||||
class NullMacro extends Macro {
|
||||
NullMacro() { this.getHead() = "NULL" }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for NullMacro */
|
||||
deprecated class NULLMacro = NullMacro;
|
||||
|
||||
/** A use of the NULL macro. */
|
||||
class NULL extends Literal {
|
||||
NULL() { exists(NULLMacro nm | this = nm.getAnInvocation().getAnExpandedElement()) }
|
||||
NULL() { exists(NullMacro nm | this = nm.getAnInvocation().getAnExpandedElement()) }
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ module FlowVar_internal {
|
||||
}
|
||||
|
||||
/** 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
|
||||
@@ -526,7 +526,7 @@ module FlowVar_internal {
|
||||
}
|
||||
|
||||
private predicate bbInLoopCondition(BasicBlock bb) {
|
||||
getCFNParent*(bb.getANode()) = this.(Loop).getCondition()
|
||||
getCfnParent*(bb.getANode()) = this.(Loop).getCondition()
|
||||
}
|
||||
|
||||
private predicate bbInLoop(BasicBlock bb) {
|
||||
|
||||
@@ -165,7 +165,7 @@ private ControlFlowNode mostRecentSideEffect(ControlFlowNode node) {
|
||||
|
||||
/** Used to represent the "global value number" of an expression. */
|
||||
cached
|
||||
private newtype GVNBase =
|
||||
private newtype GvnBase =
|
||||
GVN_IntConst(int val, Type t) { mk_IntConst(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
|
||||
@@ -221,8 +221,8 @@ private newtype GVNBase =
|
||||
* expression with this `GVN` and using its `toString` and `getLocation`
|
||||
* methods.
|
||||
*/
|
||||
class GVN extends GVNBase {
|
||||
GVN() { this instanceof GVNBase }
|
||||
class GVN extends GvnBase {
|
||||
GVN() { this instanceof GvnBase }
|
||||
|
||||
/** Gets an expression that has this GVN. */
|
||||
Expr getAnExpr() { this = globalValueNumber(result) }
|
||||
|
||||
@@ -63,17 +63,17 @@ class VariableDeclarationLine extends TVariableDeclarationInfo {
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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
|
||||
@@ -134,13 +134,13 @@ class VariableDeclarationGroup extends VariableDeclarationLine {
|
||||
count(VariableDeclarationLine l |
|
||||
l = this.getProximateNext*()
|
||||
|
|
||||
l.getAVDE().getVariable().getName()
|
||||
l.getAVde().getVariable().getName()
|
||||
)
|
||||
}
|
||||
|
||||
override string toString() {
|
||||
this.getCount() = 1 and
|
||||
result = "declaration of " + this.getAVDE().getVariable().getName()
|
||||
result = "declaration of " + this.getAVde().getVariable().getName()
|
||||
or
|
||||
this.getCount() > 1 and
|
||||
result = "group of " + this.getCount() + " fields here"
|
||||
|
||||
@@ -16,7 +16,7 @@ import cpp
|
||||
class JumpTarget extends Stmt {
|
||||
JumpTarget() { exists(GotoStmt g | g.getTarget() = this) }
|
||||
|
||||
FunctionDeclarationEntry getFDE() { result.getBlock() = this.getParentStmt+() }
|
||||
FunctionDeclarationEntry getFde() { result.getBlock() = this.getParentStmt+() }
|
||||
|
||||
predicate isForward() {
|
||||
exists(GotoStmt g | g.getTarget() = this |
|
||||
@@ -33,8 +33,8 @@ class JumpTarget extends Stmt {
|
||||
|
||||
from FunctionDeclarationEntry fde, int nforward, int nbackward
|
||||
where
|
||||
nforward = strictcount(JumpTarget t | t.getFDE() = fde and t.isForward()) and
|
||||
nbackward = strictcount(JumpTarget t | t.getFDE() = fde and t.isBackward()) and
|
||||
nforward = strictcount(JumpTarget t | t.getFde() = fde and t.isForward()) and
|
||||
nbackward = strictcount(JumpTarget t | t.getFde() = fde and t.isBackward()) and
|
||||
nforward != 1 and
|
||||
nbackward != 1
|
||||
select fde,
|
||||
|
||||
@@ -13,7 +13,7 @@ import SAL
|
||||
|
||||
from Parameter p, Call c, Expr arg
|
||||
where
|
||||
any(SALNotNull a).getDeclaration() = p and
|
||||
any(SalNotNull a).getDeclaration() = p and
|
||||
c.getTarget() = p.getFunction() and
|
||||
arg = c.getArgument(p.getIndex()) and
|
||||
nullValue(arg)
|
||||
|
||||
@@ -18,7 +18,7 @@ from Function f, FunctionCall call
|
||||
where
|
||||
call.getTarget() = f and
|
||||
call instanceof ExprInVoidContext and
|
||||
any(SALCheckReturn a).getDeclaration() = f and
|
||||
any(SalCheckReturn a).getDeclaration() = f and
|
||||
not getOptions().okToIgnoreReturnValue(call)
|
||||
select call, "Return value of $@ discarded although a SAL annotation " + "requires inspecting it.",
|
||||
f, f.getName()
|
||||
|
||||
@@ -11,7 +11,7 @@ import SAL
|
||||
|
||||
/** Holds if `e` has SAL annotation `name`. */
|
||||
predicate hasAnnotation(DeclarationEntry e, string name) {
|
||||
exists(SALAnnotation a |
|
||||
exists(SalAnnotation a |
|
||||
a.getMacro().getName() = name and
|
||||
a.getDeclarationEntry() = e
|
||||
)
|
||||
@@ -21,7 +21,7 @@ predicate hasAnnotation(DeclarationEntry e, string name) {
|
||||
predicate inheritsDeclAnnotations(DeclarationEntry e) {
|
||||
// Is directly annotated
|
||||
e.isDefinition() and
|
||||
exists(SALAnnotation a | a.getMacro().getName() = "_Use_decl_annotations_" |
|
||||
exists(SalAnnotation a | a.getMacro().getName() = "_Use_decl_annotations_" |
|
||||
a.getDeclarationEntry() = e
|
||||
)
|
||||
or
|
||||
|
||||
@@ -8,8 +8,8 @@ import cpp
|
||||
/**
|
||||
* A SAL macro defined in `sal.h` or a similar header file.
|
||||
*/
|
||||
class SALMacro extends Macro {
|
||||
SALMacro() {
|
||||
class SalMacro extends Macro {
|
||||
SalMacro() {
|
||||
this.getFile().getBaseName() =
|
||||
["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]
|
||||
private predicate isTopLevelMacroAccess(MacroAccess ma) { not exists(ma.getParentInvocation()) }
|
||||
|
||||
/**
|
||||
* An invocation of a SAL macro (excluding invocations inside other macros).
|
||||
*/
|
||||
class SALAnnotation extends MacroInvocation {
|
||||
SALAnnotation() {
|
||||
this.getMacro() instanceof SALMacro and
|
||||
class SalAnnotation extends MacroInvocation {
|
||||
SalAnnotation() {
|
||||
this.getMacro() instanceof SalMacro and
|
||||
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
|
||||
* checked.
|
||||
*/
|
||||
class SALCheckReturn extends SALAnnotation {
|
||||
SALCheckReturn() {
|
||||
this.getMacro().(SALMacro).getName() = ["_Check_return_", "_Must_inspect_result_"]
|
||||
class SalCheckReturn extends SalAnnotation {
|
||||
SalCheckReturn() {
|
||||
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
|
||||
* `NULL`.
|
||||
*/
|
||||
class SALNotNull extends SALAnnotation {
|
||||
SALNotNull() {
|
||||
exists(SALMacro m | m = this.getMacro() |
|
||||
class SalNotNull extends SalAnnotation {
|
||||
SalNotNull() {
|
||||
exists(SalMacro m | m = this.getMacro() |
|
||||
not m.getName().matches("%\\_opt\\_%") and
|
||||
(
|
||||
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`.
|
||||
*/
|
||||
class SALMaybeNull extends SALAnnotation {
|
||||
SALMaybeNull() {
|
||||
exists(SALMacro m | m = this.getMacro() |
|
||||
class SalMaybeNull extends SalAnnotation {
|
||||
SalMaybeNull() {
|
||||
exists(SalMacro m | m = this.getMacro() |
|
||||
m.getName().matches("%\\_opt\\_%") or
|
||||
m.getName().matches("\\_Ret_maybenull\\_%") or
|
||||
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.
|
||||
*/
|
||||
class SALParameter extends Parameter {
|
||||
class SalParameter extends Parameter {
|
||||
/** 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%") }
|
||||
|
||||
@@ -109,14 +124,17 @@ class SALParameter extends Parameter {
|
||||
predicate isInOut() { a.getMacroName().toLowerCase().matches("%\\_inout%") }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for SalParameter */
|
||||
deprecated class SALParameter = SalParameter;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Implementation details
|
||||
/**
|
||||
* Holds if `a` annotates the declaration entry `d` and
|
||||
* 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) {
|
||||
annotatesAtPosition(a.(SALElement).getStartPosition(), d, file, idx)
|
||||
private predicate annotatesAt(SalAnnotation a, DeclarationEntry d, File file, int 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,
|
||||
// but compute with positions instead. This performs better on databases
|
||||
// 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
|
||||
salAnnotationPos(pos) and
|
||||
(
|
||||
// Base case: `pos` right before `d`
|
||||
d.(SALElement).getStartPosition() = salRelevantPositionAt(file, idx + 1)
|
||||
d.(SalElement).getStartPosition() = salRelevantPositionAt(file, idx + 1)
|
||||
or
|
||||
// Recursive case: `pos` right before some annotation on `d`
|
||||
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
|
||||
* that may have SAL annotations.
|
||||
*/
|
||||
library class SALElement extends Element {
|
||||
SALElement() {
|
||||
containsSALAnnotation(this.(DeclarationEntry).getFile()) or
|
||||
this instanceof SALAnnotation
|
||||
library class SalElement extends Element {
|
||||
SalElement() {
|
||||
containsSalAnnotation(this.(DeclarationEntry).getFile()) or
|
||||
this instanceof SalAnnotation
|
||||
}
|
||||
|
||||
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 |
|
||||
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. */
|
||||
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
|
||||
* point in the file rather than a range.
|
||||
*/
|
||||
private newtype SALPosition =
|
||||
MkSALPosition(File file, int line, int col) {
|
||||
exists(SALElement e |
|
||||
private newtype SalPosition =
|
||||
MkSalPosition(File file, int line, int col) {
|
||||
exists(SalElement e |
|
||||
e.hasStartPosition(file, line, col)
|
||||
or
|
||||
e.hasEndPosition(file, line, col)
|
||||
@@ -200,18 +221,18 @@ private newtype SALPosition =
|
||||
|
||||
/** Holds if `pos` is the start position of a SAL annotation. */
|
||||
pragma[noinline]
|
||||
private predicate salAnnotationPos(SALPosition pos) {
|
||||
any(SALAnnotation a).(SALElement).getStartPosition() = pos
|
||||
private predicate salAnnotationPos(SalPosition pos) {
|
||||
any(SalAnnotation a).(SalElement).getStartPosition() = pos
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the `idx`th position in `file` that holds a SAL element,
|
||||
* 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 =
|
||||
rank[idx](SALPosition pos, int line, int col |
|
||||
pos = MkSALPosition(file, line, col)
|
||||
rank[idx](SalPosition pos, int line, int col |
|
||||
pos = MkSalPosition(file, line, col)
|
||||
|
|
||||
pos order by line, col
|
||||
)
|
||||
|
||||
@@ -24,7 +24,7 @@ where
|
||||
if e = DefinitionInSnapshot()
|
||||
then defined = ""
|
||||
else
|
||||
if e = SuggestiveSALAnnotation()
|
||||
if e = SuggestiveSalAnnotation()
|
||||
then defined = "externally defined (SAL) "
|
||||
else defined = "externally defined (CSV) "
|
||||
)
|
||||
|
||||
@@ -149,7 +149,7 @@ newtype Evidence =
|
||||
* The function is externally defined, but the parameter has an `_out` SAL annotation which
|
||||
* 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.
|
||||
*/
|
||||
@@ -198,8 +198,8 @@ class InitializationFunction extends Function {
|
||||
or
|
||||
// If we have no definition, we look at SAL annotations
|
||||
not this.hasDefinition() and
|
||||
this.getParameter(i).(SALParameter).isOut() and
|
||||
evidence = SuggestiveSALAnnotation()
|
||||
this.getParameter(i).(SalParameter).isOut() and
|
||||
evidence = SuggestiveSalAnnotation()
|
||||
or
|
||||
// We have some external information that this function conditionally initializes
|
||||
not this.hasDefinition() and
|
||||
|
||||
@@ -19,8 +19,8 @@ import DataFlow::PathGraph
|
||||
/**
|
||||
* A configuration for tracking XML objects and their states.
|
||||
*/
|
||||
class XXEConfiguration extends DataFlow::Configuration {
|
||||
XXEConfiguration() { this = "XXEConfiguration" }
|
||||
class XxeConfiguration extends DataFlow::Configuration {
|
||||
XxeConfiguration() { this = "XXEConfiguration" }
|
||||
|
||||
override predicate isSource(DataFlow::Node node, string 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)
|
||||
select sink, source, sink,
|
||||
"This $@ is not configured to prevent an XML external entity (XXE) attack.", source, "XML parser"
|
||||
|
||||
@@ -16,17 +16,17 @@ import cpp
|
||||
// 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
|
||||
// memory (such as WriteProcessMemory under Windows).
|
||||
predicate maybeSMCConversion(Type t1, Type t2) {
|
||||
predicate maybeSmcConversion(Type t1, Type t2) {
|
||||
t1 instanceof FunctionPointerType and
|
||||
t2 instanceof PointerType and
|
||||
not t2 instanceof FunctionPointerType and
|
||||
not t2 instanceof VoidPointerType
|
||||
or
|
||||
maybeSMCConversion(t2, t1)
|
||||
maybeSmcConversion(t2, t1)
|
||||
}
|
||||
|
||||
from Expr e
|
||||
where
|
||||
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."
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import cpp
|
||||
|
||||
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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import semmle.code.cpp.PODType03
|
||||
|
||||
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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Microsoft.SAL
|
||||
|
||||
from SALAnnotation a
|
||||
from SalAnnotation a
|
||||
select a, a.getDeclaration()
|
||||
|
||||
@@ -15,7 +15,7 @@ import experimental.code.csharp.Cryptography.NonCryptographicHashes
|
||||
|
||||
from Variable v, Literal l, LoopStmt loop, Expr additional_xor
|
||||
where
|
||||
maybeUsedInFNVFunction(v, _, _, loop) and
|
||||
maybeUsedInFnvFunction(v, _, _, loop) and
|
||||
(
|
||||
exists(BitwiseXorExpr xor2 | xor2.getAnOperand() = l and additional_xor = xor2 |
|
||||
loop.getAControlFlowExitNode().getASuccessor*() = xor2.getAControlFlowNode() and
|
||||
|
||||
@@ -13,7 +13,7 @@ private import semmle.code.csharp.dataflow.TaintTracking2
|
||||
predicate maybeANonCryptogrphicHash(Callable callable, Variable v, Expr xor, Expr mul, LoopStmt loop) {
|
||||
callable = loop.getEnclosingCallable() and
|
||||
(
|
||||
maybeUsedInFNVFunction(v, xor, mul, loop) or
|
||||
maybeUsedInFnvFunction(v, xor, mul, loop) or
|
||||
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
|
||||
* 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 |
|
||||
e1.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()
|
||||
}
|
||||
|
||||
/** 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
|
||||
* where there is a loop statement `loop` where the variable `v` is used in an xor `xor` expression
|
||||
|
||||
@@ -6,7 +6,7 @@ import csharp
|
||||
private import Email::Email
|
||||
private import ExternalLocationSink
|
||||
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
|
||||
|
||||
/** A data flow sink of remote user output. */
|
||||
|
||||
@@ -24,7 +24,7 @@ predicate incorrectUseOfRC2(Assignment e, string msg) {
|
||||
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()
|
||||
.getDeclaringType()
|
||||
.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."
|
||||
}
|
||||
|
||||
predicate incorrectUseOfRSA(ObjectCreation e, string msg) {
|
||||
predicate incorrectUseOfRsa(ObjectCreation e, string msg) {
|
||||
e.getTarget()
|
||||
.getDeclaringType()
|
||||
.hasQualifiedName("System.Security.Cryptography", "RSACryptoServiceProvider") and
|
||||
@@ -43,6 +43,6 @@ predicate incorrectUseOfRSA(ObjectCreation e, string msg) {
|
||||
from Expr e, string msg
|
||||
where
|
||||
incorrectUseOfRC2(e, msg) or
|
||||
incorrectUseOfDSA(e, msg) or
|
||||
incorrectUseOfRSA(e, msg)
|
||||
incorrectUseOfDsa(e, msg) or
|
||||
incorrectUseOfRsa(e, msg)
|
||||
select e, msg
|
||||
|
||||
@@ -65,7 +65,7 @@ newtype TInstructionTag =
|
||||
PointerAddTag(int index) { index in [0 .. 255] } or
|
||||
ElementsAddressTag(int index) { index in [0 .. 255] } or
|
||||
ConvertTag() or
|
||||
GeneratedNEQTag() or
|
||||
GeneratedNeqTag() or
|
||||
GeneratedConstantTag() or
|
||||
GeneratedBranchTag()
|
||||
|
||||
@@ -181,7 +181,7 @@ string getInstructionTagId(TInstructionTag tag) {
|
||||
or
|
||||
tag = ConvertTag() and result = "Convert"
|
||||
or
|
||||
tag = GeneratedNEQTag() and result = "GeneratedNEQTag"
|
||||
tag = GeneratedNeqTag() and result = "GeneratedNEQTag"
|
||||
or
|
||||
tag = GeneratedConstantTag() and result = "GeneratedConstantTag"
|
||||
or
|
||||
|
||||
@@ -1710,7 +1710,7 @@ class TranslatedIsExpr extends TranslatedNonConstantExpr {
|
||||
result = this.getParent().getChildSuccessor(this)
|
||||
or
|
||||
(
|
||||
tag = GeneratedNEQTag() and
|
||||
tag = GeneratedNeqTag() and
|
||||
kind instanceof GotoEdge and
|
||||
if this.hasVar()
|
||||
then result = this.getInstruction(GeneratedBranchTag())
|
||||
@@ -1733,7 +1733,7 @@ class TranslatedIsExpr extends TranslatedNonConstantExpr {
|
||||
kind instanceof GotoEdge and
|
||||
if this.hasVar()
|
||||
then result = this.getPatternVarDecl().getFirstInstruction()
|
||||
else result = this.getInstruction(GeneratedNEQTag())
|
||||
else result = this.getInstruction(GeneratedNeqTag())
|
||||
}
|
||||
|
||||
override Instruction getChildSuccessor(TranslatedElement child) {
|
||||
@@ -1742,7 +1742,7 @@ class TranslatedIsExpr extends TranslatedNonConstantExpr {
|
||||
or
|
||||
this.hasVar() and
|
||||
child = this.getPatternVarDecl() and
|
||||
result = this.getInstruction(GeneratedNEQTag())
|
||||
result = this.getInstruction(GeneratedNeqTag())
|
||||
}
|
||||
|
||||
override predicate hasInstruction(Opcode opcode, InstructionTag tag, CSharpType resultType) {
|
||||
@@ -1755,7 +1755,7 @@ class TranslatedIsExpr extends TranslatedNonConstantExpr {
|
||||
opcode instanceof Opcode::CheckedConvertOrNull and
|
||||
resultType = getTypeForPRValue(expr.getPattern().getType())
|
||||
or
|
||||
tag = GeneratedNEQTag() and
|
||||
tag = GeneratedNeqTag() and
|
||||
opcode instanceof Opcode::CompareNE and
|
||||
resultType = getTypeForPRValue(expr.getType())
|
||||
or
|
||||
@@ -1775,7 +1775,7 @@ class TranslatedIsExpr extends TranslatedNonConstantExpr {
|
||||
result = "0"
|
||||
}
|
||||
|
||||
override Instruction getResult() { result = this.getInstruction(GeneratedNEQTag()) }
|
||||
override Instruction getResult() { result = this.getInstruction(GeneratedNeqTag()) }
|
||||
|
||||
override Instruction getInstructionOperand(InstructionTag tag, OperandTag operandTag) {
|
||||
tag = ConvertTag() and
|
||||
@@ -1792,7 +1792,7 @@ class TranslatedIsExpr extends TranslatedNonConstantExpr {
|
||||
result = this.getPatternVarDecl().getTargetAddress()
|
||||
)
|
||||
or
|
||||
tag = GeneratedNEQTag() and
|
||||
tag = GeneratedNeqTag() and
|
||||
(
|
||||
operandTag instanceof LeftOperandTag and
|
||||
result = this.getInstruction(ConvertTag())
|
||||
@@ -1804,7 +1804,7 @@ class TranslatedIsExpr extends TranslatedNonConstantExpr {
|
||||
this.hasVar() and
|
||||
tag = GeneratedBranchTag() and
|
||||
operandTag instanceof ConditionOperandTag and
|
||||
result = this.getInstruction(GeneratedNEQTag())
|
||||
result = this.getInstruction(GeneratedNeqTag())
|
||||
}
|
||||
|
||||
private TranslatedExpr getIsExpr() { result = getTranslatedExpr(expr.getExpr()) }
|
||||
|
||||
@@ -12,7 +12,10 @@ class Boolean extends boolean {
|
||||
/**
|
||||
* 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>>
|
||||
result = "(?:com|org|edu|gov|uk|net|io)(?![a-z0-9])"
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for commonTld */
|
||||
deprecated string commonTLD() { result = commonTld() }
|
||||
|
||||
@@ -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
|
||||
* side-effect.
|
||||
*/
|
||||
private predicate sideEffectCFG(ControlFlow::Node src, ControlFlow::Node dst) {
|
||||
private predicate sideEffectCfg(ControlFlow::Node src, ControlFlow::Node dst) {
|
||||
src.getASuccessor() = dst
|
||||
or
|
||||
// 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.
|
||||
*/
|
||||
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
|
||||
@@ -190,7 +190,7 @@ private ControlFlow::Node mostRecentSideEffect(ControlFlow::Node node) {
|
||||
|
||||
/** Used to represent the "global value number" of an expression. */
|
||||
cached
|
||||
private newtype GVNBase =
|
||||
private newtype GvnBase =
|
||||
MkNumericConst(string val) { mkNumericConst(_, val) } or
|
||||
MkStringConst(string val) { mkStringConst(_, 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
|
||||
MkMethodAccess(GVN base, Function m) { mkMethodAccess(_, base, m) } 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
|
||||
// Dereference a pointer. The value might have changed since the last
|
||||
// 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.
|
||||
MkUnanalyzable(DataFlow::Node e) { not analyzableExpr(e) }
|
||||
|
||||
private newtype GVNList =
|
||||
private newtype GvnList =
|
||||
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
|
||||
start = ce.getNumArgument() and
|
||||
result = MkNil()
|
||||
or
|
||||
exists(GVN head, GVNList tail |
|
||||
exists(GVN head, GvnList tail |
|
||||
globalValueNumbers(ce, start, head, tail) and
|
||||
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
|
||||
head = globalValueNumber(ce.getArgument(start)) and
|
||||
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`
|
||||
* methods.
|
||||
*/
|
||||
class GVN extends GVNBase {
|
||||
GVN() { this instanceof GVNBase }
|
||||
class GVN extends GvnBase {
|
||||
GVN() { this instanceof GvnBase }
|
||||
|
||||
/** Gets a data-flow node that has this GVN. */
|
||||
DataFlow::Node getANode() { this = globalValueNumber(result) }
|
||||
@@ -386,7 +386,7 @@ private predicate analyzableCall(DataFlow::CallNode ce, Function f) {
|
||||
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
|
||||
callee = globalValueNumber(ce.getCalleeNode()) and
|
||||
args = globalValueNumbers(ce, 0)
|
||||
@@ -523,7 +523,7 @@ GVN globalValueNumber(DataFlow::Node nd) {
|
||||
result = MkFieldRead(qualifier, target, dominator)
|
||||
)
|
||||
or
|
||||
exists(Function f, GVN callee, GVNList args |
|
||||
exists(Function f, GVN callee, GvnList args |
|
||||
mkPureCall(nd, f, callee, args) and
|
||||
result = MkPureCall(f, callee, args)
|
||||
)
|
||||
|
||||
@@ -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`. */
|
||||
GVN conditionGVN(IfStmt is, int i, Expr e) {
|
||||
GVN conditionGvn(IfStmt is, int i, Expr e) {
|
||||
e = getCondition(is, i) and result = e.getGlobalValueNumber()
|
||||
}
|
||||
|
||||
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"
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
import go
|
||||
|
||||
/** 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()
|
||||
}
|
||||
|
||||
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"
|
||||
|
||||
@@ -28,7 +28,7 @@ predicate isIncompleteHostNameRegexpPattern(string pattern, string hostPart) {
|
||||
"(?<!\\\\)[.]" +
|
||||
// immediately followed by a sequence of subdomains, perhaps with some regex characters mixed in,
|
||||
// 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`) */
|
||||
|
||||
@@ -52,7 +52,7 @@ predicate isInterestingSemiAnchoredRegexpString(string re, string msg) {
|
||||
bindingset[re]
|
||||
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
|
||||
re.regexpMatch("(?i)[():|?a-z0-9-\\\\./]+[.]" + commonTLD() + "([/#?():]\\S*)?") and
|
||||
re.regexpMatch("(?i)[():|?a-z0-9-\\\\./]+[.]" + commonTld() + "([/#?():]\\S*)?") and
|
||||
// without any anchors
|
||||
not re.regexpMatch(".*(\\$|\\^|\\\\A|\\\\z).*") and
|
||||
msg =
|
||||
|
||||
@@ -27,7 +27,7 @@ class MXBean extends ManagedBean {
|
||||
class RegisteredManagedBeanImpl extends Class {
|
||||
RegisteredManagedBeanImpl() {
|
||||
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.
|
||||
*/
|
||||
class JMXRegistrationCall extends MethodAccess {
|
||||
JMXRegistrationCall() { this.getCallee() instanceof JMXRegistrationMethod }
|
||||
class JmxRegistrationCall extends MethodAccess {
|
||||
JmxRegistrationCall() { this.getCallee() instanceof JmxRegistrationMethod }
|
||||
|
||||
/**
|
||||
* Gets the argument that represents the object in the registration call.
|
||||
*/
|
||||
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`.
|
||||
*
|
||||
* This is either the `registerMBean` method on `MBeanServer`, or it is a wrapper around that
|
||||
* registration method.
|
||||
*/
|
||||
class JMXRegistrationMethod extends Method {
|
||||
JMXRegistrationMethod() {
|
||||
class JmxRegistrationMethod extends Method {
|
||||
JmxRegistrationMethod() {
|
||||
// A direct registration with the `MBeanServer`.
|
||||
this.getDeclaringType().hasQualifiedName("javax.management", "MBeanServer") and
|
||||
this.getName() = "registerMBean"
|
||||
or
|
||||
// The `MBeanServer` is often wrapped by an application specific management class, so identify
|
||||
// methods that wrap a call to another `JMXRegistrationMethod`.
|
||||
exists(JMXRegistrationCall c |
|
||||
// methods that wrap a call to another `JmxRegistrationMethod`.
|
||||
exists(JmxRegistrationCall c |
|
||||
// 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.
|
||||
c.getObjectArgument().(VarAccess).getVariable() = this.getAParameter()
|
||||
@@ -81,25 +84,37 @@ class JMXRegistrationMethod extends Method {
|
||||
result = 0
|
||||
or
|
||||
// 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)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for JmxRegistrationMethod */
|
||||
deprecated class JMXRegistrationMethod = JmxRegistrationMethod;
|
||||
|
||||
/** The class `javax.management.remote.JMXConnectorFactory`. */
|
||||
class TypeJMXConnectorFactory extends Class {
|
||||
TypeJMXConnectorFactory() {
|
||||
class TypeJmxConnectorFactory extends Class {
|
||||
TypeJmxConnectorFactory() {
|
||||
this.hasQualifiedName("javax.management.remote", "JMXConnectorFactory")
|
||||
}
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for TypeJmxConnectorFactory */
|
||||
deprecated class TypeJMXConnectorFactory = TypeJmxConnectorFactory;
|
||||
|
||||
/** The class `javax.management.remote.JMXServiceURL`. */
|
||||
class TypeJMXServiceURL extends Class {
|
||||
TypeJMXServiceURL() { this.hasQualifiedName("javax.management.remote", "JMXServiceURL") }
|
||||
class TypeJmxServiceUrl extends Class {
|
||||
TypeJmxServiceUrl() { this.hasQualifiedName("javax.management.remote", "JMXServiceURL") }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for TypeJmxServiceUrl */
|
||||
deprecated class TypeJMXServiceURL = TypeJmxServiceUrl;
|
||||
|
||||
/** The class `javax.management.remote.rmi.RMIConnector`. */
|
||||
class TypeRMIConnector extends Class {
|
||||
TypeRMIConnector() { this.hasQualifiedName("javax.management.remote.rmi", "RMIConnector") }
|
||||
class TypeRmiConnector extends Class {
|
||||
TypeRmiConnector() { this.hasQualifiedName("javax.management.remote.rmi", "RMIConnector") }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for TypeRmiConnector */
|
||||
deprecated class TypeRMIConnector = TypeRmiConnector;
|
||||
|
||||
@@ -15,7 +15,7 @@ private class SpecialMethodAccess extends MethodAccess {
|
||||
this.getQualifier().getType().(RefType).hasQualifiedName("java.lang", klass)
|
||||
}
|
||||
|
||||
predicate throwsNFE() {
|
||||
predicate throwsNfe() {
|
||||
this.isParseMethod("Byte", "parseByte") or
|
||||
this.isParseMethod("Short", "parseShort") or
|
||||
this.isParseMethod("Integer", "parseInt") or
|
||||
@@ -33,6 +33,9 @@ private class SpecialMethodAccess extends MethodAccess {
|
||||
this.isValueOfMethod("Float") or
|
||||
this.isValueOfMethod("Double")
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for throwsNfe */
|
||||
deprecated predicate throwsNFE() { this.throwsNfe() }
|
||||
}
|
||||
|
||||
/** A `ClassInstanceExpr` that constructs a number from its string representation. */
|
||||
@@ -43,7 +46,7 @@ private class SpecialClassInstanceExpr extends ClassInstanceExpr {
|
||||
this.getNumArgument() = 1
|
||||
}
|
||||
|
||||
predicate throwsNFE() {
|
||||
predicate throwsNfe() {
|
||||
this.isStringConstructor("Byte") or
|
||||
this.isStringConstructor("Short") or
|
||||
this.isStringConstructor("Integer") or
|
||||
@@ -51,6 +54,9 @@ private class SpecialClassInstanceExpr extends ClassInstanceExpr {
|
||||
this.isStringConstructor("Float") or
|
||||
this.isStringConstructor("Double")
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for throwsNfe */
|
||||
deprecated predicate throwsNFE() { this.throwsNfe() }
|
||||
}
|
||||
|
||||
/** The class `java.lang.NumberFormatException`. */
|
||||
@@ -59,7 +65,7 @@ class NumberFormatException extends RefType {
|
||||
}
|
||||
|
||||
/** Holds if `java.lang.NumberFormatException` is caught. */
|
||||
predicate catchesNFE(TryStmt t) {
|
||||
predicate catchesNfe(TryStmt t) {
|
||||
exists(CatchClause cc, LocalVariableDeclExpr v |
|
||||
t.getACatchClause() = cc 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. */
|
||||
predicate throwsNFE(Expr e) {
|
||||
e.(SpecialClassInstanceExpr).throwsNFE() or e.(SpecialMethodAccess).throwsNFE()
|
||||
predicate throwsNfe(Expr e) {
|
||||
e.(SpecialClassInstanceExpr).throwsNfe() or e.(SpecialMethodAccess).throwsNfe()
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for throwsNfe */
|
||||
deprecated predicate throwsNFE = throwsNfe/1;
|
||||
|
||||
@@ -88,7 +88,7 @@ private class ReverseDnsSource extends RemoteFlowSource {
|
||||
ReverseDnsSource() {
|
||||
// Try not to trigger on `localhost`.
|
||||
exists(MethodAccess m | m = this.asExpr() |
|
||||
m.getMethod() instanceof ReverseDNSMethod and
|
||||
m.getMethod() instanceof ReverseDnsMethod and
|
||||
not exists(MethodAccess l |
|
||||
(variableStep(l, m.getQualifier()) or l = m.getQualifier()) and
|
||||
l.getMethod().getName() = "getLocalHost"
|
||||
@@ -221,8 +221,8 @@ class TypeInetAddr extends RefType {
|
||||
}
|
||||
|
||||
/** A reverse DNS method. */
|
||||
class ReverseDNSMethod extends Method {
|
||||
ReverseDNSMethod() {
|
||||
class ReverseDnsMethod extends Method {
|
||||
ReverseDnsMethod() {
|
||||
this.getDeclaringType() instanceof TypeInetAddr and
|
||||
(
|
||||
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. */
|
||||
class AndroidIntentInput extends DataFlow::Node {
|
||||
Type receiverType;
|
||||
|
||||
@@ -162,7 +162,7 @@ class LiveClass extends SourceClassOrInterface {
|
||||
exists(LiveField f | f.getDeclaringType() = this |
|
||||
// A `serialVersionUID` field is considered to be a live field, but is
|
||||
// not be enough to be make this class live.
|
||||
not f instanceof SerialVersionUIDField
|
||||
not f instanceof SerialVersionUidField
|
||||
)
|
||||
or
|
||||
// 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
|
||||
// methods that are theoretically dead, but uninteresting. We therefore ignore them, so long as
|
||||
// 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.(SetterMethod).getField() = readField
|
||||
)
|
||||
|
||||
@@ -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 version number for the serialization framework.
|
||||
*/
|
||||
class SerialVersionUIDField extends ReflectivelyReadField {
|
||||
SerialVersionUIDField() {
|
||||
class SerialVersionUidField extends ReflectivelyReadField {
|
||||
SerialVersionUidField() {
|
||||
this.hasName("serialVersionUID") and
|
||||
this.isStatic() 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
|
||||
* 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.
|
||||
*/
|
||||
class JPAReadField extends ReflectivelyReadField {
|
||||
JPAReadField() {
|
||||
class JpaReadField extends ReflectivelyReadField {
|
||||
JpaReadField() {
|
||||
exists(PersistentEntity entity |
|
||||
this = entity.getAField() and
|
||||
(
|
||||
@@ -169,3 +172,6 @@ class JPAReadField extends ReflectivelyReadField {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for JpaReadField */
|
||||
deprecated class JPAReadField = JpaReadField;
|
||||
|
||||
@@ -128,8 +128,8 @@ class JacksonMixinCallableEntryPoint extends EntryPoint {
|
||||
override Callable getALiveCallable() { result = this }
|
||||
}
|
||||
|
||||
class JAXAnnotationReflectivelyConstructedClass extends ReflectivelyConstructedClass {
|
||||
JAXAnnotationReflectivelyConstructedClass() {
|
||||
class JaxAnnotationReflectivelyConstructedClass extends ReflectivelyConstructedClass {
|
||||
JaxAnnotationReflectivelyConstructedClass() {
|
||||
this instanceof JaxWsEndpoint or
|
||||
this instanceof JaxbXmlRegistry 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 {
|
||||
DeserializedClass() {
|
||||
exists(CastingExpr cast, ReadObjectMethod readObject |
|
||||
@@ -342,8 +346,8 @@ class GsonDeserializationEntryPoint extends ReflectivelyConstructedClass {
|
||||
}
|
||||
}
|
||||
|
||||
class JAXBDeserializationEntryPoint extends ReflectivelyConstructedClass {
|
||||
JAXBDeserializationEntryPoint() {
|
||||
class JaxbDeserializationEntryPoint extends ReflectivelyConstructedClass {
|
||||
JaxbDeserializationEntryPoint() {
|
||||
// A class can be deserialized by JAXB if it's an `XmlRootElement`...
|
||||
this.getAnAnnotation().getType().hasQualifiedName("javax.xml.bind.annotation", "XmlRootElement")
|
||||
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.
|
||||
*
|
||||
|
||||
@@ -104,8 +104,8 @@ class SpringAspect extends CallableEntryPoint {
|
||||
/**
|
||||
* Spring Shell provides annotations for identifying methods that contribute CLI commands.
|
||||
*/
|
||||
class SpringCLI extends CallableEntryPoint {
|
||||
SpringCLI() {
|
||||
class SpringCli extends CallableEntryPoint {
|
||||
SpringCli() {
|
||||
(
|
||||
hasAnnotation("org.springframework.shell.core.annotation", "CliCommand") or
|
||||
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.
|
||||
*/
|
||||
|
||||
@@ -58,15 +58,18 @@ class ServletFilterClass extends ReflectivelyConstructedClass {
|
||||
/**
|
||||
* An entry point into a GWT application.
|
||||
*/
|
||||
class GWTEntryPointConstructedClass extends ReflectivelyConstructedClass {
|
||||
GWTEntryPointConstructedClass() { this.(GwtEntryPointClass).isLive() }
|
||||
class GwtEntryPointConstructedClass extends ReflectivelyConstructedClass {
|
||||
GwtEntryPointConstructedClass() { this.(GwtEntryPointClass).isLive() }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for GwtEntryPointConstructedClass */
|
||||
deprecated class GWTEntryPointConstructedClass = GwtEntryPointConstructedClass;
|
||||
|
||||
/**
|
||||
* Servlets referred to from a GWT module config file.
|
||||
*/
|
||||
class GWTServletClass extends ReflectivelyConstructedClass {
|
||||
GWTServletClass() {
|
||||
class GwtServletClass extends ReflectivelyConstructedClass {
|
||||
GwtServletClass() {
|
||||
this instanceof ServletClass and
|
||||
// There must be evidence that GWT is being used, otherwise missing `*.gwt.xml` files could cause
|
||||
// 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.
|
||||
*/
|
||||
|
||||
@@ -13,7 +13,7 @@ import semmle.code.java.frameworks.camel.CamelJavaAnnotations
|
||||
class CamelToUri extends string {
|
||||
CamelToUri() {
|
||||
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()
|
||||
)
|
||||
or
|
||||
exists(CamelJavaDSLMethodDecl methodDecl | this = methodDecl.getABean())
|
||||
exists(CamelJavaDslMethodDecl methodDecl | this = methodDecl.getABean())
|
||||
or
|
||||
// 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.
|
||||
exists(CamelJavaDSLBeanDecl beanDecl | this = beanDecl.getABeanClass())
|
||||
exists(CamelJavaDslBeanDecl beanDecl | this = beanDecl.getABeanClass())
|
||||
or
|
||||
exists(CamelJavaDSLBeanRefDecl beanRefDecl | this = beanRefDecl.getABeanClass())
|
||||
exists(CamelJavaDslBeanRefDecl beanRefDecl | this = beanRefDecl.getABeanClass())
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,20 +2,26 @@
|
||||
|
||||
import semmle.code.java.Type
|
||||
|
||||
library class JAXBElement extends Class {
|
||||
JAXBElement() {
|
||||
library class JaxbElement extends Class {
|
||||
JaxbElement() {
|
||||
this.getAnAncestor().getQualifiedName() = "javax.xml.bind.JAXBElement" or
|
||||
this.getAnAnnotation().getType().getName() = "XmlRootElement"
|
||||
}
|
||||
}
|
||||
|
||||
library class JAXBMarshalMethod extends Method {
|
||||
JAXBMarshalMethod() {
|
||||
/** DEPRECATED: Alias for JaxbElement */
|
||||
deprecated class JAXBElement = JaxbElement;
|
||||
|
||||
library class JaxbMarshalMethod extends Method {
|
||||
JaxbMarshalMethod() {
|
||||
this.getDeclaringType().getQualifiedName() = "javax.xml.bind.Marshaller" and
|
||||
this.getName() = "marshal"
|
||||
}
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for JaxbMarshalMethod */
|
||||
deprecated class JAXBMarshalMethod = JaxbMarshalMethod;
|
||||
|
||||
class JaxbAnnotationType extends AnnotationType {
|
||||
JaxbAnnotationType() { this.getPackage().getName() = "javax.xml.bind.annotation" }
|
||||
}
|
||||
|
||||
@@ -58,13 +58,16 @@ class MethodUnboundIdFilterCreate extends Method {
|
||||
}
|
||||
|
||||
/** A method with the name `createANDFilter` declared in `com.unboundid.ldap.sdk.Filter`. */
|
||||
class MethodUnboundIdFilterCreateANDFilter extends Method {
|
||||
MethodUnboundIdFilterCreateANDFilter() {
|
||||
class MethodUnboundIdFilterCreateAndFilter extends Method {
|
||||
MethodUnboundIdFilterCreateAndFilter() {
|
||||
this.getDeclaringType() instanceof TypeUnboundIdLdapFilter and
|
||||
this.hasName("createANDFilter")
|
||||
}
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for MethodUnboundIdFilterCreateAndFilter */
|
||||
deprecated class MethodUnboundIdFilterCreateANDFilter = MethodUnboundIdFilterCreateAndFilter;
|
||||
|
||||
/** A method with the name `createORFilter` declared in `com.unboundid.ldap.sdk.Filter`. */
|
||||
class MethodUnboundIdFilterCreateORFilter extends Method {
|
||||
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`. */
|
||||
class MethodUnboundIdFilterCreateNOTFilter extends Method {
|
||||
MethodUnboundIdFilterCreateNOTFilter() {
|
||||
class MethodUnboundIdFilterCreateNotFilter extends Method {
|
||||
MethodUnboundIdFilterCreateNotFilter() {
|
||||
this.getDeclaringType() instanceof TypeUnboundIdLdapFilter and
|
||||
this.hasName("createNOTFilter")
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
class CamelJavaDSLToDecl extends ProcessorDefinitionElement {
|
||||
CamelJavaDSLToDecl() { getMethod().hasName("to") }
|
||||
class CamelJavaDslToDecl extends ProcessorDefinitionElement {
|
||||
CamelJavaDslToDecl() { getMethod().hasName("to") }
|
||||
|
||||
/**
|
||||
* Gets the URI specified by this `to` declaration.
|
||||
@@ -47,14 +47,17 @@ class CamelJavaDSLToDecl extends ProcessorDefinitionElement {
|
||||
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.
|
||||
*
|
||||
* This declares a bean to call for this route. The bean is defined either by a Class<?> reference,
|
||||
* or the bean object itself.
|
||||
*/
|
||||
class CamelJavaDSLBeanDecl extends ProcessorDefinitionElement {
|
||||
CamelJavaDSLBeanDecl() { getMethod().hasName("bean") }
|
||||
class CamelJavaDslBeanDecl extends ProcessorDefinitionElement {
|
||||
CamelJavaDslBeanDecl() { getMethod().hasName("bean") }
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
@@ -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
|
||||
* assumption that it either represetns a qualified name, or a Srping bean identifier.
|
||||
*/
|
||||
class CamelJavaDSLBeanRefDecl extends ProcessorDefinitionElement {
|
||||
CamelJavaDSLBeanRefDecl() { getMethod().hasName("beanRef") }
|
||||
class CamelJavaDslBeanRefDecl extends ProcessorDefinitionElement {
|
||||
CamelJavaDslBeanRefDecl() { getMethod().hasName("beanRef") }
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* An expression that represents a call to a bean, or particular method on a bean.
|
||||
*/
|
||||
class CamelJavaDSLMethodDecl extends MethodAccess {
|
||||
CamelJavaDSLMethodDecl() {
|
||||
class CamelJavaDslMethodDecl extends MethodAccess {
|
||||
CamelJavaDslMethodDecl() {
|
||||
getMethod()
|
||||
.getDeclaringType()
|
||||
.getSourceDeclaration()
|
||||
@@ -129,3 +138,6 @@ class CamelJavaDSLMethodDecl extends MethodAccess {
|
||||
else result = getArgument(0).getType()
|
||||
}
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for CamelJavaDslMethodDecl */
|
||||
deprecated class CamelJavaDSLMethodDecl = CamelJavaDslMethodDecl;
|
||||
|
||||
@@ -49,7 +49,7 @@ private class Serializable extends ClassStore {
|
||||
|
||||
/** The instantiation of a marshallable class, which can be stored to disk as XML. */
|
||||
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)`. */
|
||||
override Expr getAStore() {
|
||||
@@ -69,7 +69,7 @@ private Expr getInstanceInput(DataFlow::Node instance, RefType t) {
|
||||
fa.getField().getDeclaringType() = t
|
||||
|
|
||||
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) {
|
||||
exists(MethodAccess m |
|
||||
store = m and
|
||||
m.getMethod() instanceof JAXBMarshalMethod and
|
||||
m.getMethod() instanceof JaxbMarshalMethod and
|
||||
instance.asExpr() = m.getArgument(0)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ private predicate nameAddStep(DataFlow::ExprNode n1, DataFlow::ExprNode n2) {
|
||||
* by calling `new JMXServiceURL(tainted)`.
|
||||
*/
|
||||
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
|
||||
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) {
|
||||
exists(MethodAccess ma, Method m | n1.asExpr() = ma.getArgument(0) and n2.asExpr() = ma |
|
||||
ma.getMethod() = m and
|
||||
m.getDeclaringType() instanceof TypeJMXConnectorFactory and
|
||||
m.getDeclaringType() instanceof TypeJmxConnectorFactory and
|
||||
m.hasName("newJMXConnector")
|
||||
)
|
||||
}
|
||||
@@ -199,7 +199,7 @@ private predicate jmxConnectorStep(DataFlow::ExprNode n1, DataFlow::ExprNode n2)
|
||||
* `RMIConnector` by calling `new RMIConnector(tainted)`.
|
||||
*/
|
||||
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
|
||||
n2.asExpr() = cc
|
||||
)
|
||||
|
||||
@@ -140,8 +140,8 @@ private predicate filterStep(DataFlow::ExprNode n1, DataFlow::ExprNode n2) {
|
||||
ma.getMethod() = m
|
||||
|
|
||||
m instanceof MethodUnboundIdFilterCreate or
|
||||
m instanceof MethodUnboundIdFilterCreateANDFilter or
|
||||
m instanceof MethodUnboundIdFilterCreateNOTFilter or
|
||||
m instanceof MethodUnboundIdFilterCreateAndFilter or
|
||||
m instanceof MethodUnboundIdFilterCreateNotFilter or
|
||||
m instanceof MethodUnboundIdFilterCreateORFilter or
|
||||
m instanceof MethodUnboundIdFilterSimplifyFilter
|
||||
)
|
||||
|
||||
@@ -15,10 +15,10 @@ import semmle.code.java.NumberFormatException
|
||||
|
||||
from Expr e
|
||||
where
|
||||
throwsNFE(e) and
|
||||
throwsNfe(e) and
|
||||
not exists(TryStmt t |
|
||||
t.getBlock() = e.getEnclosingStmt().getEnclosingStmt*() and
|
||||
catchesNFE(t)
|
||||
catchesNfe(t)
|
||||
) and
|
||||
not exists(Callable c |
|
||||
e.getEnclosingCallable() = c and
|
||||
|
||||
@@ -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. */
|
||||
predicate hasShortDSAKeyPair(MethodAccess ma, string msg) {
|
||||
predicate hasShortDsaKeyPair(MethodAccess ma, string msg) {
|
||||
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. */
|
||||
predicate hasShortRSAKeyPair(MethodAccess ma, string msg) {
|
||||
predicate hasShortRsaKeyPair(MethodAccess ma, string msg) {
|
||||
hasShortAsymmetricKeyPair(ma, msg, "RSA")
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ predicate hasShortECKeyPair(MethodAccess ma, string msg) {
|
||||
from Expr e, string msg
|
||||
where
|
||||
hasShortAESKey(e, msg) or
|
||||
hasShortDSAKeyPair(e, msg) or
|
||||
hasShortRSAKeyPair(e, msg) or
|
||||
hasShortDsaKeyPair(e, msg) or
|
||||
hasShortRsaKeyPair(e, msg) or
|
||||
hasShortECKeyPair(e, msg)
|
||||
select e, msg
|
||||
|
||||
@@ -21,8 +21,8 @@ import DataFlow::PathGraph
|
||||
/**
|
||||
* Taint configuration tracking flow from untrusted inputs to number conversion calls in exported Android compononents.
|
||||
*/
|
||||
class NFELocalDoSConfiguration extends TaintTracking::Configuration {
|
||||
NFELocalDoSConfiguration() { this = "NFELocalDoSConfiguration" }
|
||||
class NfeLocalDoSConfiguration extends TaintTracking::Configuration {
|
||||
NfeLocalDoSConfiguration() { this = "NFELocalDoSConfiguration" }
|
||||
|
||||
/** Holds if source is a remote flow source */
|
||||
override predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
|
||||
@@ -31,17 +31,17 @@ class NFELocalDoSConfiguration extends TaintTracking::Configuration {
|
||||
override predicate isSink(DataFlow::Node sink) {
|
||||
exists(Expr e |
|
||||
e.getEnclosingCallable().getDeclaringType().(ExportableAndroidComponent).isExported() and
|
||||
throwsNFE(e) and
|
||||
throwsNfe(e) and
|
||||
not exists(TryStmt t |
|
||||
t.getBlock() = e.getAnEnclosingStmt() and
|
||||
catchesNFE(t)
|
||||
catchesNfe(t)
|
||||
) and
|
||||
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)
|
||||
select sink.getNode(), source, sink,
|
||||
"Uncaught NumberFormatException in an exported Android component due to $@.", source.getNode(),
|
||||
|
||||
@@ -15,16 +15,16 @@ import extraction.ExtractEndpointData
|
||||
|
||||
string getAReasonSinkExcluded(DataFlow::Node sinkCandidate, Query query) {
|
||||
query instanceof NosqlInjectionQuery and
|
||||
result = NosqlInjectionATM::SinkEndpointFilter::getAReasonSinkExcluded(sinkCandidate)
|
||||
result = NosqlInjectionAtm::SinkEndpointFilter::getAReasonSinkExcluded(sinkCandidate)
|
||||
or
|
||||
query instanceof SqlInjectionQuery and
|
||||
result = SqlInjectionATM::SinkEndpointFilter::getAReasonSinkExcluded(sinkCandidate)
|
||||
result = SqlInjectionAtm::SinkEndpointFilter::getAReasonSinkExcluded(sinkCandidate)
|
||||
or
|
||||
query instanceof TaintedPathQuery and
|
||||
result = TaintedPathATM::SinkEndpointFilter::getAReasonSinkExcluded(sinkCandidate)
|
||||
result = TaintedPathAtm::SinkEndpointFilter::getAReasonSinkExcluded(sinkCandidate)
|
||||
or
|
||||
query instanceof XssQuery and
|
||||
result = XssATM::SinkEndpointFilter::getAReasonSinkExcluded(sinkCandidate)
|
||||
result = XssAtm::SinkEndpointFilter::getAReasonSinkExcluded(sinkCandidate)
|
||||
}
|
||||
|
||||
pragma[inline]
|
||||
|
||||
@@ -14,10 +14,26 @@ import experimental.adaptivethreatmodeling.EndpointFeatures as EndpointFeatures
|
||||
import experimental.adaptivethreatmodeling.EndpointScoring as EndpointScoring
|
||||
import experimental.adaptivethreatmodeling.EndpointTypes
|
||||
import experimental.adaptivethreatmodeling.FilteringReasons
|
||||
import experimental.adaptivethreatmodeling.NosqlInjectionATM as NosqlInjectionATM
|
||||
import experimental.adaptivethreatmodeling.SqlInjectionATM as SqlInjectionATM
|
||||
import experimental.adaptivethreatmodeling.TaintedPathATM as TaintedPathATM
|
||||
import experimental.adaptivethreatmodeling.XssATM as XssATM
|
||||
import experimental.adaptivethreatmodeling.NosqlInjectionATM as NosqlInjectionAtm
|
||||
|
||||
/** DEPRECATED: Alias for NosqlInjectionAtm */
|
||||
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 NoFeaturizationRestrictionsConfig
|
||||
import Queries
|
||||
@@ -25,13 +41,13 @@ import Queries
|
||||
/** Gets the ATM configuration object for the specified query. */
|
||||
AtmConfig getAtmCfg(Query query) {
|
||||
query instanceof NosqlInjectionQuery and
|
||||
result instanceof NosqlInjectionATM::NosqlInjectionAtmConfig
|
||||
result instanceof NosqlInjectionAtm::NosqlInjectionAtmConfig
|
||||
or
|
||||
query instanceof SqlInjectionQuery and result instanceof SqlInjectionATM::SqlInjectionAtmConfig
|
||||
query instanceof SqlInjectionQuery and result instanceof SqlInjectionAtm::SqlInjectionAtmConfig
|
||||
or
|
||||
query instanceof TaintedPathQuery and result instanceof TaintedPathATM::TaintedPathAtmConfig
|
||||
query instanceof TaintedPathQuery and result instanceof TaintedPathAtm::TaintedPathAtmConfig
|
||||
or
|
||||
query instanceof XssQuery and result instanceof XssATM::DomBasedXssAtmConfig
|
||||
query instanceof XssQuery and result instanceof XssAtm::DomBasedXssAtmConfig
|
||||
}
|
||||
|
||||
/** 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. */
|
||||
DataFlow::Configuration getDataFlowCfg(Query query) {
|
||||
query instanceof NosqlInjectionQuery and result instanceof NosqlInjectionATM::Configuration
|
||||
query instanceof NosqlInjectionQuery and result instanceof NosqlInjectionAtm::Configuration
|
||||
or
|
||||
query instanceof SqlInjectionQuery and result instanceof SqlInjectionATM::Configuration
|
||||
query instanceof SqlInjectionQuery and result instanceof SqlInjectionAtm::Configuration
|
||||
or
|
||||
query instanceof TaintedPathQuery and result instanceof TaintedPathATM::Configuration
|
||||
query instanceof TaintedPathQuery and result instanceof TaintedPathAtm::Configuration
|
||||
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. */
|
||||
|
||||
@@ -4,25 +4,25 @@
|
||||
* 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.NosqlInjectionATM as NosqlInjectionATM
|
||||
import experimental.adaptivethreatmodeling.TaintedPathATM as TaintedPathATM
|
||||
import experimental.adaptivethreatmodeling.XssATM as XssATM
|
||||
import experimental.adaptivethreatmodeling.SqlInjectionATM as SqlInjectionAtm
|
||||
import experimental.adaptivethreatmodeling.NosqlInjectionATM as NosqlInjectionAtm
|
||||
import experimental.adaptivethreatmodeling.TaintedPathATM as TaintedPathAtm
|
||||
import experimental.adaptivethreatmodeling.XssATM as XssAtm
|
||||
import experimental.adaptivethreatmodeling.AdaptiveThreatModeling
|
||||
|
||||
from string queryName, AtmConfig c, EndpointType e
|
||||
where
|
||||
(
|
||||
queryName = "SqlInjection" and
|
||||
c instanceof SqlInjectionATM::SqlInjectionAtmConfig
|
||||
c instanceof SqlInjectionAtm::SqlInjectionAtmConfig
|
||||
or
|
||||
queryName = "NosqlInjection" and
|
||||
c instanceof NosqlInjectionATM::NosqlInjectionAtmConfig
|
||||
c instanceof NosqlInjectionAtm::NosqlInjectionAtmConfig
|
||||
or
|
||||
queryName = "TaintedPath" and
|
||||
c instanceof TaintedPathATM::TaintedPathAtmConfig
|
||||
c instanceof TaintedPathAtm::TaintedPathAtmConfig
|
||||
or
|
||||
queryName = "Xss" and c instanceof XssATM::DomBasedXssAtmConfig
|
||||
queryName = "Xss" and c instanceof XssAtm::DomBasedXssAtmConfig
|
||||
) and
|
||||
e = c.getASinkEndpointType()
|
||||
select queryName, e.getEncoding() as label
|
||||
|
||||
@@ -7,20 +7,20 @@
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import experimental.adaptivethreatmodeling.NosqlInjectionATM as NosqlInjectionATM
|
||||
import experimental.adaptivethreatmodeling.SqlInjectionATM as SqlInjectionATM
|
||||
import experimental.adaptivethreatmodeling.TaintedPathATM as TaintedPathATM
|
||||
import experimental.adaptivethreatmodeling.XssATM as XssATM
|
||||
import experimental.adaptivethreatmodeling.NosqlInjectionATM as NosqlInjectionAtm
|
||||
import experimental.adaptivethreatmodeling.SqlInjectionATM as SqlInjectionAtm
|
||||
import experimental.adaptivethreatmodeling.TaintedPathATM as TaintedPathAtm
|
||||
import experimental.adaptivethreatmodeling.XssATM as XssAtm
|
||||
import experimental.adaptivethreatmodeling.EndpointFeatures as EndpointFeatures
|
||||
import experimental.adaptivethreatmodeling.StandardEndpointFilters as StandardEndpointFilters
|
||||
import extraction.NoFeaturizationRestrictionsConfig
|
||||
|
||||
query predicate tokenFeatures(DataFlow::Node endpoint, string featureName, string featureValue) {
|
||||
(
|
||||
not exists(NosqlInjectionATM::SinkEndpointFilter::getAReasonSinkExcluded(endpoint)) or
|
||||
not exists(SqlInjectionATM::SinkEndpointFilter::getAReasonSinkExcluded(endpoint)) or
|
||||
not exists(TaintedPathATM::SinkEndpointFilter::getAReasonSinkExcluded(endpoint)) or
|
||||
not exists(XssATM::SinkEndpointFilter::getAReasonSinkExcluded(endpoint)) or
|
||||
not exists(NosqlInjectionAtm::SinkEndpointFilter::getAReasonSinkExcluded(endpoint)) or
|
||||
not exists(SqlInjectionAtm::SinkEndpointFilter::getAReasonSinkExcluded(endpoint)) or
|
||||
not exists(TaintedPathAtm::SinkEndpointFilter::getAReasonSinkExcluded(endpoint)) or
|
||||
not exists(XssAtm::SinkEndpointFilter::getAReasonSinkExcluded(endpoint)) or
|
||||
StandardEndpointFilters::isArgumentToModeledFunction(endpoint)
|
||||
) and
|
||||
EndpointFeatures::tokenFeatures(endpoint, featureName, featureValue)
|
||||
|
||||
@@ -17,31 +17,31 @@ import semmle.javascript.security.dataflow.SqlInjectionCustomizations
|
||||
import semmle.javascript.security.dataflow.TaintedPathCustomizations
|
||||
import semmle.javascript.security.dataflow.DomBasedXssCustomizations
|
||||
import experimental.adaptivethreatmodeling.StandardEndpointFilters as StandardEndpointFilters
|
||||
import experimental.adaptivethreatmodeling.NosqlInjectionATM as NosqlInjectionATM
|
||||
import experimental.adaptivethreatmodeling.SqlInjectionATM as SqlInjectionATM
|
||||
import experimental.adaptivethreatmodeling.TaintedPathATM as TaintedPathATM
|
||||
import experimental.adaptivethreatmodeling.XssATM as XssATM
|
||||
import experimental.adaptivethreatmodeling.NosqlInjectionATM as NosqlInjectionAtm
|
||||
import experimental.adaptivethreatmodeling.SqlInjectionATM as SqlInjectionAtm
|
||||
import experimental.adaptivethreatmodeling.TaintedPathATM as TaintedPathAtm
|
||||
import experimental.adaptivethreatmodeling.XssATM as XssAtm
|
||||
|
||||
query predicate nosqlFilteredTruePositives(DataFlow::Node endpoint, string reason) {
|
||||
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"]
|
||||
}
|
||||
|
||||
query predicate sqlFilteredTruePositives(DataFlow::Node endpoint, string reason) {
|
||||
endpoint instanceof SqlInjection::Sink and
|
||||
reason = SqlInjectionATM::SinkEndpointFilter::getAReasonSinkExcluded(endpoint) and
|
||||
reason = SqlInjectionAtm::SinkEndpointFilter::getAReasonSinkExcluded(endpoint) and
|
||||
reason != "argument to modeled function"
|
||||
}
|
||||
|
||||
query predicate taintedPathFilteredTruePositives(DataFlow::Node endpoint, string reason) {
|
||||
endpoint instanceof TaintedPath::Sink and
|
||||
reason = TaintedPathATM::SinkEndpointFilter::getAReasonSinkExcluded(endpoint) and
|
||||
reason = TaintedPathAtm::SinkEndpointFilter::getAReasonSinkExcluded(endpoint) and
|
||||
reason != "argument to modeled function"
|
||||
}
|
||||
|
||||
query predicate xssFilteredTruePositives(DataFlow::Node endpoint, string reason) {
|
||||
endpoint instanceof DomBasedXss::Sink and
|
||||
reason = XssATM::SinkEndpointFilter::getAReasonSinkExcluded(endpoint) and
|
||||
reason = XssAtm::SinkEndpointFilter::getAReasonSinkExcluded(endpoint) and
|
||||
reason != "argument to modeled function"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import javascript
|
||||
import experimental.adaptivethreatmodeling.NosqlInjectionATM as NosqlInjectionATM
|
||||
import experimental.adaptivethreatmodeling.NosqlInjectionATM as NosqlInjectionAtm
|
||||
|
||||
query predicate effectiveSinks(DataFlow::Node node) {
|
||||
not exists(NosqlInjectionATM::SinkEndpointFilter::getAReasonSinkExcluded(node))
|
||||
not exists(NosqlInjectionAtm::SinkEndpointFilter::getAReasonSinkExcluded(node))
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import javascript
|
||||
*/
|
||||
module Actions {
|
||||
/** A YAML node in a GitHub Actions workflow file. */
|
||||
private class Node extends YAMLNode {
|
||||
private class Node extends YamlNode {
|
||||
Node() {
|
||||
this.getLocation()
|
||||
.getFile()
|
||||
@@ -24,12 +24,12 @@ module Actions {
|
||||
* 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.
|
||||
*/
|
||||
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. */
|
||||
YAMLMapping getJobs() { result = this.lookup("jobs") }
|
||||
YamlMapping getJobs() { result = this.lookup("jobs") }
|
||||
|
||||
/** 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. */
|
||||
string getFileName() { result = this.getFile().getBaseName() }
|
||||
@@ -45,7 +45,7 @@ module Actions {
|
||||
* An Actions On trigger within a workflow.
|
||||
* 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;
|
||||
|
||||
On() { workflow.lookup("on") = this }
|
||||
@@ -58,7 +58,7 @@ module Actions {
|
||||
* An Actions job within a workflow.
|
||||
* 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;
|
||||
Workflow workflow;
|
||||
|
||||
@@ -74,19 +74,19 @@ module Actions {
|
||||
* Gets the ID of this job, as a YAML scalar node.
|
||||
* 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. */
|
||||
string getName() { result = this.getNameNode().getValue() }
|
||||
|
||||
/** 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. */
|
||||
Step getStep(int index) { result.getJob() = this and result.getIndex() = index }
|
||||
|
||||
/** 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. */
|
||||
Workflow getWorkflow() { result = workflow }
|
||||
@@ -99,7 +99,7 @@ module Actions {
|
||||
* An `if` within a job.
|
||||
* 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;
|
||||
|
||||
JobIf() { job.lookup("if") = this }
|
||||
@@ -112,7 +112,7 @@ module Actions {
|
||||
* A step within an Actions job.
|
||||
* 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;
|
||||
Job job;
|
||||
|
||||
@@ -134,14 +134,14 @@ module Actions {
|
||||
StepIf getIf() { result.getStep() = this }
|
||||
|
||||
/** 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.
|
||||
* 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;
|
||||
|
||||
StepIf() { step.lookup("if") = this }
|
||||
@@ -170,7 +170,7 @@ module Actions {
|
||||
*
|
||||
* Does not handle local repository references, e.g. `.github/actions/action-name`.
|
||||
*/
|
||||
class Uses extends YAMLNode, YAMLScalar {
|
||||
class Uses extends YamlNode, YamlScalar {
|
||||
Step step;
|
||||
|
||||
Uses() { step.lookup("uses") = this }
|
||||
@@ -200,7 +200,7 @@ module Actions {
|
||||
* arg2: abc
|
||||
* ```
|
||||
*/
|
||||
class With extends YAMLNode, YAMLMapping {
|
||||
class With extends YamlNode, YamlMapping {
|
||||
Step step;
|
||||
|
||||
With() { step.lookup("with") = this }
|
||||
@@ -219,7 +219,7 @@ module Actions {
|
||||
* ref: ${{ github.event.pull_request.head.sha }}
|
||||
* ```
|
||||
*/
|
||||
class Ref extends YAMLNode, YAMLString {
|
||||
class Ref extends YamlNode, YamlString {
|
||||
With with;
|
||||
|
||||
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.
|
||||
* 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;
|
||||
|
||||
Run() { step.lookup("run") = this }
|
||||
|
||||
@@ -178,7 +178,7 @@ predicate isGeneratedFileName(File f) {
|
||||
predicate isGenerated(TopLevel tl) {
|
||||
tl.isMinified() or
|
||||
isBundle(tl) or
|
||||
tl instanceof GWTGeneratedTopLevel or
|
||||
tl instanceof GwtGeneratedTopLevel or
|
||||
tl instanceof DartGeneratedTopLevel or
|
||||
exists(GeneratedCodeMarkerComment gcmc | tl = gcmc.getTopLevel()) or
|
||||
hasManyInvocations(tl) or
|
||||
|
||||
@@ -43,7 +43,7 @@ class JsonStringifyCall extends DataFlow::CallNode {
|
||||
/**
|
||||
* 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) {
|
||||
exists(API::CallNode 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.
|
||||
* This is not quite a `JSON.stringify` call, as it e.g. does not wrap keys in double quotes.
|
||||
|
||||
@@ -168,18 +168,24 @@ class PackageJson extends JsonObject {
|
||||
JsonArray getCPUs() { result = this.getPropValue("cpu") }
|
||||
|
||||
/** Gets a platform supported by this package. */
|
||||
string getWhitelistedCPU() {
|
||||
string getWhitelistedCpu() {
|
||||
result = this.getCPUs().getElementStringValue(_) and
|
||||
not result.matches("!%")
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for getWhitelistedCpu */
|
||||
deprecated string getWhitelistedCPU() { result = this.getWhitelistedCpu() }
|
||||
|
||||
/** Gets a platform not supported by this package. */
|
||||
string getBlacklistedCPU() {
|
||||
string getBlacklistedCpu() {
|
||||
exists(string str | str = this.getCPUs().getElementStringValue(_) |
|
||||
result = str.regexpCapture("!(.*)", 1)
|
||||
)
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for getBlacklistedCpu */
|
||||
deprecated string getBlacklistedCPU() { result = this.getBlacklistedCpu() }
|
||||
|
||||
/** Holds if this package prefers to be installed globally. */
|
||||
predicate isPreferGlobal() { this.getPropValue("preferGlobal").(JsonBoolean).getValue() = "true" }
|
||||
|
||||
|
||||
@@ -64,8 +64,8 @@ private newtype TPrintAstNode =
|
||||
// JSON
|
||||
TJsonNode(JsonValue value) { shouldPrint(value, _) and not isNotNeeded(value) } or
|
||||
// YAML
|
||||
TYamlNode(YAMLNode n) { shouldPrint(n, _) and not isNotNeeded(n) } or
|
||||
TYamlMappingNode(YAMLMapping mapping, int i) {
|
||||
TYamlNode(YamlNode n) { shouldPrint(n, _) and not isNotNeeded(n) } or
|
||||
TYamlMappingNode(YamlMapping mapping, int i) {
|
||||
shouldPrint(mapping, _) and not isNotNeeded(mapping) and exists(mapping.getKeyNode(i))
|
||||
} or
|
||||
// HTML
|
||||
@@ -628,7 +628,7 @@ module PrintYaml {
|
||||
* A print node representing a YAML value in a .yml file.
|
||||
*/
|
||||
class YamlNodeNode extends PrintAstNode, TYamlNode {
|
||||
YAMLNode node;
|
||||
YamlNode node;
|
||||
|
||||
YamlNodeNode() { this = TYamlNode(node) }
|
||||
|
||||
@@ -639,10 +639,10 @@ module PrintYaml {
|
||||
/**
|
||||
* Gets the `YAMLNode` represented by this node.
|
||||
*/
|
||||
final YAMLNode getValue() { result = node }
|
||||
final YamlNode getValue() { result = node }
|
||||
|
||||
override PrintAstNode getChild(int childIndex) {
|
||||
exists(YAMLNode child | result.(YamlNodeNode).getValue() = child |
|
||||
exists(YamlNode child | result.(YamlNodeNode).getValue() = child |
|
||||
child = node.getChildNode(childIndex)
|
||||
)
|
||||
}
|
||||
@@ -657,7 +657,7 @@ module PrintYaml {
|
||||
* Each child of this node aggregates the key and value of a mapping.
|
||||
*/
|
||||
class YamlMappingNode extends YamlNodeNode {
|
||||
override YAMLMapping node;
|
||||
override YamlMapping node;
|
||||
|
||||
override PrintAstNode getChild(int 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`.
|
||||
*/
|
||||
class YamlMappingMapNode extends PrintAstNode, TYamlMappingNode {
|
||||
YAMLMapping mapping;
|
||||
YamlMapping mapping;
|
||||
int i;
|
||||
|
||||
YamlMappingMapNode() { this = TYamlMappingNode(mapping, i) }
|
||||
|
||||
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
|
||||
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`.
|
||||
*/
|
||||
predicate maps(YAMLMapping m, int index) {
|
||||
predicate maps(YamlMapping m, int index) {
|
||||
m = mapping and
|
||||
index = i
|
||||
}
|
||||
|
||||
@@ -1005,7 +1005,10 @@ module RegExpPatterns {
|
||||
* Gets a pattern that matches common top-level domain names in lower case.
|
||||
* DEPRECATED: use `getACommonTld` instead
|
||||
*/
|
||||
deprecated predicate commonTLD = getACommonTld/0;
|
||||
deprecated predicate commonTld = getACommonTld/0;
|
||||
|
||||
/** DEPRECATED: Alias for commonTld */
|
||||
deprecated predicate commonTLD = commonTld/0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -291,10 +291,13 @@ class StrictModeDecl extends KnownDirective {
|
||||
* "use asm";
|
||||
* ```
|
||||
*/
|
||||
class ASMJSDirective extends KnownDirective {
|
||||
ASMJSDirective() { this.getDirectiveText() = "use asm" }
|
||||
class AsmJSDirective extends KnownDirective {
|
||||
AsmJSDirective() { this.getDirectiveText() = "use asm" }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for AsmJSDirective */
|
||||
deprecated class ASMJSDirective = AsmJSDirective;
|
||||
|
||||
/**
|
||||
* A Babel directive.
|
||||
*
|
||||
|
||||
@@ -20,13 +20,13 @@ import javascript
|
||||
* << : *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) }
|
||||
|
||||
/**
|
||||
* 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.
|
||||
@@ -34,12 +34,12 @@ class YAMLNode extends @yaml_node, Locatable {
|
||||
* _Note_: The index of a child node relative to its parent is considered
|
||||
* 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.
|
||||
*/
|
||||
YAMLNode getAChildNode() { result = this.getChildNode(_) }
|
||||
YamlNode getAChildNode() { result = this.getChildNode(_) }
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
YAMLValue getAChild() { result = this.getChild(_) }
|
||||
YamlValue getAChild() { result = this.getChild(_) }
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
YAMLDocument getDocument() { result = this.getParentNode*() }
|
||||
YamlDocument getDocument() { result = this.getParentNode*() }
|
||||
|
||||
/**
|
||||
* 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" }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for YamlNode */
|
||||
deprecated class YAMLNode = YamlNode;
|
||||
|
||||
/**
|
||||
* A YAML value; that is, either a scalar or a collection.
|
||||
*
|
||||
@@ -102,7 +105,10 @@ class YAMLNode extends @yaml_node, Locatable {
|
||||
* - sequence
|
||||
* ```
|
||||
*/
|
||||
abstract class YAMLValue extends YAMLNode { }
|
||||
abstract class YamlValue extends YamlNode { }
|
||||
|
||||
/** DEPRECATED: Alias for YamlValue */
|
||||
deprecated class YAMLValue = YamlValue;
|
||||
|
||||
/**
|
||||
* A YAML scalar.
|
||||
@@ -118,7 +124,7 @@ abstract class YAMLValue extends YAMLNode { }
|
||||
* "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:
|
||||
*
|
||||
@@ -150,6 +156,9 @@ class YAMLScalar extends YAMLValue, @yaml_scalar_node {
|
||||
override string getAPrimaryQlClass() { result = "YAMLScalar" }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for YamlScalar */
|
||||
deprecated class YAMLScalar = YamlScalar;
|
||||
|
||||
/**
|
||||
* A YAML scalar representing an integer value.
|
||||
*
|
||||
@@ -160,8 +169,8 @@ class YAMLScalar extends YAMLValue, @yaml_scalar_node {
|
||||
* 0xffff
|
||||
* ```
|
||||
*/
|
||||
class YAMLInteger extends YAMLScalar {
|
||||
YAMLInteger() { this.hasStandardTypeTag("int") }
|
||||
class YamlInteger extends YamlScalar {
|
||||
YamlInteger() { this.hasStandardTypeTag("int") }
|
||||
|
||||
/**
|
||||
* Gets the value of this scalar, as an integer.
|
||||
@@ -169,6 +178,9 @@ class YAMLInteger extends YAMLScalar {
|
||||
int getIntValue() { result = this.getValue().toInt() }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for YamlInteger */
|
||||
deprecated class YAMLInteger = YamlInteger;
|
||||
|
||||
/**
|
||||
* A YAML scalar representing a floating point value.
|
||||
*
|
||||
@@ -179,8 +191,8 @@ class YAMLInteger extends YAMLScalar {
|
||||
* 6.626e-34
|
||||
* ```
|
||||
*/
|
||||
class YAMLFloat extends YAMLScalar {
|
||||
YAMLFloat() { this.hasStandardTypeTag("float") }
|
||||
class YamlFloat extends YamlScalar {
|
||||
YamlFloat() { this.hasStandardTypeTag("float") }
|
||||
|
||||
/**
|
||||
* 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() }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for YamlFloat */
|
||||
deprecated class YAMLFloat = YamlFloat;
|
||||
|
||||
/**
|
||||
* A YAML scalar representing a time stamp.
|
||||
*
|
||||
@@ -197,8 +212,8 @@ class YAMLFloat extends YAMLScalar {
|
||||
* 2001-12-15T02:59:43.1Z
|
||||
* ```
|
||||
*/
|
||||
class YAMLTimestamp extends YAMLScalar {
|
||||
YAMLTimestamp() { this.hasStandardTypeTag("timestamp") }
|
||||
class YamlTimestamp extends YamlScalar {
|
||||
YamlTimestamp() { this.hasStandardTypeTag("timestamp") }
|
||||
|
||||
/**
|
||||
* Gets the value of this scalar, as a date.
|
||||
@@ -206,6 +221,9 @@ class YAMLTimestamp extends YAMLScalar {
|
||||
date getDateValue() { result = this.getValue().toDate() }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for YamlTimestamp */
|
||||
deprecated class YAMLTimestamp = YamlTimestamp;
|
||||
|
||||
/**
|
||||
* A YAML scalar representing a Boolean value.
|
||||
*
|
||||
@@ -215,8 +233,8 @@ class YAMLTimestamp extends YAMLScalar {
|
||||
* true
|
||||
* ```
|
||||
*/
|
||||
class YAMLBool extends YAMLScalar {
|
||||
YAMLBool() { this.hasStandardTypeTag("bool") }
|
||||
class YamlBool extends YamlScalar {
|
||||
YamlBool() { this.hasStandardTypeTag("bool") }
|
||||
|
||||
/**
|
||||
* 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 }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for YamlBool */
|
||||
deprecated class YAMLBool = YamlBool;
|
||||
|
||||
/**
|
||||
* A YAML scalar representing the null value.
|
||||
*
|
||||
@@ -233,10 +254,13 @@ class YAMLBool extends YAMLScalar {
|
||||
* null
|
||||
* ```
|
||||
*/
|
||||
class YAMLNull extends YAMLScalar {
|
||||
YAMLNull() { this.hasStandardTypeTag("null") }
|
||||
class YamlNull extends YamlScalar {
|
||||
YamlNull() { this.hasStandardTypeTag("null") }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for YamlNull */
|
||||
deprecated class YAMLNull = YamlNull;
|
||||
|
||||
/**
|
||||
* A YAML scalar representing a string value.
|
||||
*
|
||||
@@ -246,10 +270,13 @@ class YAMLNull extends YAMLScalar {
|
||||
* "hello"
|
||||
* ```
|
||||
*/
|
||||
class YAMLString extends YAMLScalar {
|
||||
YAMLString() { this.hasStandardTypeTag("str") }
|
||||
class YamlString extends YamlScalar {
|
||||
YamlString() { this.hasStandardTypeTag("str") }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for YamlString */
|
||||
deprecated class YAMLString = YamlString;
|
||||
|
||||
/**
|
||||
* A YAML scalar representing a merge key.
|
||||
*
|
||||
@@ -260,10 +287,13 @@ class YAMLString extends YAMLScalar {
|
||||
* << : *DEFAULTS # merge key
|
||||
* ```
|
||||
*/
|
||||
class YAMLMergeKey extends YAMLScalar {
|
||||
YAMLMergeKey() { this.hasStandardTypeTag("merge") }
|
||||
class YamlMergeKey extends YamlScalar {
|
||||
YamlMergeKey() { this.hasStandardTypeTag("merge") }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for YamlMergeKey */
|
||||
deprecated class YAMLMergeKey = YamlMergeKey;
|
||||
|
||||
/**
|
||||
* A YAML scalar representing an `!include` directive.
|
||||
*
|
||||
@@ -271,11 +301,11 @@ class YAMLMergeKey extends YAMLScalar {
|
||||
* !include common.yaml
|
||||
* ```
|
||||
*/
|
||||
class YAMLInclude extends YAMLScalar {
|
||||
YAMLInclude() { this.getTag() = "!include" }
|
||||
class YamlInclude extends YamlScalar {
|
||||
YamlInclude() { this.getTag() = "!include" }
|
||||
|
||||
override YAMLValue eval() {
|
||||
exists(YAMLDocument targetDoc |
|
||||
override YamlValue eval() {
|
||||
exists(YamlDocument targetDoc |
|
||||
targetDoc.getFile().getAbsolutePath() = this.getTargetPath() and
|
||||
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.
|
||||
*
|
||||
@@ -310,10 +343,13 @@ class YAMLInclude extends YAMLScalar {
|
||||
* - -blue
|
||||
* ```
|
||||
*/
|
||||
class YAMLCollection extends YAMLValue, @yaml_collection_node {
|
||||
class YamlCollection extends YamlValue, @yaml_collection_node {
|
||||
override string getAPrimaryQlClass() { result = "YAMLCollection" }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for YamlCollection */
|
||||
deprecated class YAMLCollection = YamlCollection;
|
||||
|
||||
/**
|
||||
* A YAML mapping.
|
||||
*
|
||||
@@ -324,11 +360,11 @@ class YAMLCollection extends YAMLValue, @yaml_collection_node {
|
||||
* y: 1
|
||||
* ```
|
||||
*/
|
||||
class YAMLMapping extends YAMLCollection, @yaml_mapping_node {
|
||||
class YamlMapping extends YamlCollection, @yaml_mapping_node {
|
||||
/**
|
||||
* Gets the `i`th key of this mapping.
|
||||
*/
|
||||
YAMLNode getKeyNode(int i) {
|
||||
YamlNode getKeyNode(int i) {
|
||||
i >= 0 and
|
||||
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.
|
||||
*/
|
||||
YAMLNode getValueNode(int i) {
|
||||
YamlNode getValueNode(int i) {
|
||||
i >= 0 and
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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`.
|
||||
*/
|
||||
predicate maps(YAMLValue key, YAMLValue value) {
|
||||
predicate maps(YamlValue key, YamlValue value) {
|
||||
exists(int i | key = this.getKey(i) and value = this.getValue(i))
|
||||
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.
|
||||
*/
|
||||
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" }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for YamlMapping */
|
||||
deprecated class YAMLMapping = YamlMapping;
|
||||
|
||||
/**
|
||||
* A YAML sequence.
|
||||
*
|
||||
@@ -379,20 +418,23 @@ class YAMLMapping extends YAMLCollection, @yaml_mapping_node {
|
||||
* - blue
|
||||
* ```
|
||||
*/
|
||||
class YAMLSequence extends YAMLCollection, @yaml_sequence_node {
|
||||
class YamlSequence extends YamlCollection, @yaml_sequence_node {
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
YAMLValue getElement(int i) { result = this.getElementNode(i).eval() }
|
||||
YamlValue getElement(int i) { result = this.getElementNode(i).eval() }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "YAMLSequence" }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for YamlSequence */
|
||||
deprecated class YAMLSequence = YamlSequence;
|
||||
|
||||
/**
|
||||
* A YAML alias node referring to a target anchor.
|
||||
*
|
||||
@@ -402,8 +444,8 @@ class YAMLSequence extends YAMLCollection, @yaml_sequence_node {
|
||||
* *DEFAULTS
|
||||
* ```
|
||||
*/
|
||||
class YAMLAliasNode extends YAMLNode, @yaml_alias_node {
|
||||
override YAMLValue eval() {
|
||||
class YamlAliasNode extends YamlNode, @yaml_alias_node {
|
||||
override YamlValue eval() {
|
||||
result.getAnchor() = this.getTarget() and
|
||||
result.getDocument() = this.getDocument()
|
||||
}
|
||||
@@ -416,6 +458,9 @@ class YAMLAliasNode extends YAMLNode, @yaml_alias_node {
|
||||
override string getAPrimaryQlClass() { result = "YAMLAliasNode" }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for YamlAliasNode */
|
||||
deprecated class YAMLAliasNode = YamlAliasNode;
|
||||
|
||||
/**
|
||||
* A YAML document.
|
||||
*
|
||||
@@ -427,14 +472,17 @@ class YAMLAliasNode extends YAMLNode, @yaml_alias_node {
|
||||
* y: 1
|
||||
* ```
|
||||
*/
|
||||
class YAMLDocument extends YAMLNode {
|
||||
YAMLDocument() { not exists(this.getParentNode()) }
|
||||
class YamlDocument extends YamlNode {
|
||||
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.
|
||||
*/
|
||||
class YAMLParseError extends @yaml_error, Error {
|
||||
class YamlParseError extends @yaml_error, Error {
|
||||
override Location getLocation() { yaml_locations(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() }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for YamlParseError */
|
||||
deprecated class YAMLParseError = YamlParseError;
|
||||
|
||||
/**
|
||||
* A YAML node that may contain sub-nodes that can be identified by a name.
|
||||
* I.e. a mapping, sequence, or scalar.
|
||||
@@ -464,30 +515,30 @@ class YAMLParseError extends @yaml_error, Error {
|
||||
*
|
||||
* are equivalent.
|
||||
*/
|
||||
class YAMLMappingLikeNode extends YAMLNode {
|
||||
YAMLMappingLikeNode() {
|
||||
this instanceof YAMLMapping
|
||||
class YamlMappingLikeNode extends YamlNode {
|
||||
YamlMappingLikeNode() {
|
||||
this instanceof YamlMapping
|
||||
or
|
||||
this instanceof YAMLSequence
|
||||
this instanceof YamlSequence
|
||||
or
|
||||
this instanceof YAMLScalar
|
||||
this instanceof YamlScalar
|
||||
}
|
||||
|
||||
/** Gets sub-name identified by `name`. */
|
||||
YAMLNode getNode(string name) {
|
||||
exists(YAMLMapping mapping |
|
||||
YamlNode getNode(string name) {
|
||||
exists(YamlMapping mapping |
|
||||
mapping = this and
|
||||
result = mapping.lookup(name)
|
||||
)
|
||||
or
|
||||
exists(YAMLSequence sequence, YAMLNode node |
|
||||
exists(YamlSequence sequence, YamlNode node |
|
||||
sequence = this and
|
||||
sequence.getAChildNode() = node and
|
||||
node.eval().toString() = name and
|
||||
result = node
|
||||
)
|
||||
or
|
||||
exists(YAMLScalar scalar |
|
||||
exists(YamlScalar scalar |
|
||||
scalar = this and
|
||||
scalar.getValue() = name and
|
||||
result = scalar
|
||||
@@ -496,19 +547,22 @@ class YAMLMappingLikeNode extends YAMLNode {
|
||||
|
||||
/** Gets the number of elements in this mapping or sequence. */
|
||||
int getElementCount() {
|
||||
exists(YAMLMapping mapping |
|
||||
exists(YamlMapping mapping |
|
||||
mapping = this and
|
||||
result = mapping.getNumChild() / 2
|
||||
)
|
||||
or
|
||||
exists(YAMLSequence sequence |
|
||||
exists(YamlSequence sequence |
|
||||
sequence = this and
|
||||
result = sequence.getNumChild()
|
||||
)
|
||||
or
|
||||
exists(YAMLScalar scalar |
|
||||
exists(YamlScalar scalar |
|
||||
scalar = this and
|
||||
result = 1
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for YamlMappingLikeNode */
|
||||
deprecated class YAMLMappingLikeNode = YamlMappingLikeNode;
|
||||
|
||||
@@ -171,10 +171,10 @@ abstract class CallWithNonLocalAnalyzedReturnFlow extends DataFlow::AnalyzedValu
|
||||
/**
|
||||
* Flow analysis for the return value of IIFEs.
|
||||
*/
|
||||
private class IIFEWithAnalyzedReturnFlow extends CallWithAnalyzedReturnFlow {
|
||||
private class IifeWithAnalyzedReturnFlow extends CallWithAnalyzedReturnFlow {
|
||||
ImmediatelyInvokedFunctionExpr iife;
|
||||
|
||||
IIFEWithAnalyzedReturnFlow() { astNode = iife.getInvocation() }
|
||||
IifeWithAnalyzedReturnFlow() { astNode = iife.getInvocation() }
|
||||
|
||||
override AnalyzedFunction getACallee() { result = iife.analyze() }
|
||||
}
|
||||
|
||||
@@ -692,10 +692,10 @@ abstract private class CallWithAnalyzedParameters extends FunctionWithAnalyzedPa
|
||||
/**
|
||||
* Flow analysis for simple parameters of IIFEs.
|
||||
*/
|
||||
private class IIFEWithAnalyzedParameters extends CallWithAnalyzedParameters {
|
||||
private class IifeWithAnalyzedParameters extends CallWithAnalyzedParameters {
|
||||
ImmediatelyInvokedFunctionExpr iife;
|
||||
|
||||
IIFEWithAnalyzedParameters() {
|
||||
IifeWithAnalyzedParameters() {
|
||||
this = iife and
|
||||
iife.getInvocationKind() = "direct"
|
||||
}
|
||||
|
||||
@@ -276,15 +276,15 @@ class ExternalScriptDependency extends ScriptDependency, @xmlattribute {
|
||||
/**
|
||||
* A dependency on GWT indicated by a GWT header script.
|
||||
*/
|
||||
private class GWTDependency extends ScriptDependency {
|
||||
GWTDependency() { this instanceof GWTHeader }
|
||||
private class GwtDependency extends ScriptDependency {
|
||||
GwtDependency() { this instanceof GwtHeader }
|
||||
|
||||
override predicate info(string id, string v) {
|
||||
id = "gwt" and
|
||||
exists(GWTHeader h | h = this |
|
||||
v = h.getGWTVersion()
|
||||
exists(GwtHeader h | h = this |
|
||||
v = h.getGwtVersion()
|
||||
or
|
||||
not exists(h.getGWTVersion()) and v = "unknown"
|
||||
not exists(h.getGwtVersion()) and v = "unknown"
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -904,8 +904,8 @@ private class SinonJS extends FrameworkLibraryWithGenericUrl, FrameworkLibraryWi
|
||||
/**
|
||||
* The TinyMCE framework.
|
||||
*/
|
||||
private class TinyMCE extends FrameworkLibraryWithGenericUrl {
|
||||
TinyMCE() { this = "tinymce" }
|
||||
private class TinyMce extends FrameworkLibraryWithGenericUrl {
|
||||
TinyMce() { this = "tinymce" }
|
||||
|
||||
override string getAnAlias() { result = "jquery.tinymce" or result = "tinymce.jquery" }
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ module Electron {
|
||||
*/
|
||||
class ProcessSender extends Process {
|
||||
ProcessSender() {
|
||||
exists(IPCSendRegistration reg | reg.getEmitter() instanceof MainProcess |
|
||||
exists(IpcSendRegistration reg | reg.getEmitter() instanceof MainProcess |
|
||||
this = reg.getABoundCallbackParameter(1, 0).getAPropertyRead("sender")
|
||||
)
|
||||
}
|
||||
@@ -123,28 +123,31 @@ module Electron {
|
||||
* Does mostly the same as an EventEmitter event handler,
|
||||
* except that values can be returned through the `event.returnValue` property.
|
||||
*/
|
||||
class IPCSendRegistration extends EventRegistration::DefaultEventRegistration,
|
||||
class IpcSendRegistration extends EventRegistration::DefaultEventRegistration,
|
||||
DataFlow::MethodCallNode {
|
||||
override Process emitter;
|
||||
|
||||
IPCSendRegistration() { this = emitter.ref().getAMethodCall(EventEmitter::on()) }
|
||||
IpcSendRegistration() { this = emitter.ref().getAMethodCall(EventEmitter::on()) }
|
||||
|
||||
override DataFlow::Node getAReturnedValue() {
|
||||
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.
|
||||
* 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).
|
||||
*/
|
||||
class IPCDispatch extends EventDispatch::DefaultEventDispatch, DataFlow::InvokeNode {
|
||||
class IpcDispatch extends EventDispatch::DefaultEventDispatch, DataFlow::InvokeNode {
|
||||
override Process emitter;
|
||||
|
||||
IPCDispatch() {
|
||||
IpcDispatch() {
|
||||
exists(string methodName | methodName = "sendSync" or methodName = "send" |
|
||||
this = emitter.ref().getAMemberCall(methodName)
|
||||
)
|
||||
@@ -163,7 +166,7 @@ module Electron {
|
||||
/**
|
||||
* Gets a registration that this dispatch can send an event to.
|
||||
*/
|
||||
override IPCSendRegistration getAReceiver() {
|
||||
override IpcSendRegistration getAReceiver() {
|
||||
this.getEmitter() instanceof RendererProcess and
|
||||
result.getEmitter() instanceof MainProcess
|
||||
or
|
||||
@@ -171,6 +174,9 @@ module Electron {
|
||||
result.getEmitter() instanceof RendererProcess
|
||||
}
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for IpcDispatch */
|
||||
deprecated class IPCDispatch = IpcDispatch;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,10 +13,13 @@ abstract class EmscriptenMarkerComment extends GeneratedCodeMarkerComment { }
|
||||
/**
|
||||
* An `EMSCRIPTEN_START_ASM` marker comment.
|
||||
*/
|
||||
class EmscriptenStartASMComment extends EmscriptenMarkerComment {
|
||||
EmscriptenStartASMComment() { getText().trim() = "EMSCRIPTEN_START_ASM" }
|
||||
class EmscriptenStartAsmComment extends EmscriptenMarkerComment {
|
||||
EmscriptenStartAsmComment() { getText().trim() = "EMSCRIPTEN_START_ASM" }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for EmscriptenStartAsmComment */
|
||||
deprecated class EmscriptenStartASMComment = EmscriptenStartAsmComment;
|
||||
|
||||
/**
|
||||
* An `EMSCRIPTEN_START_FUNCS` marker comment.
|
||||
*/
|
||||
@@ -27,10 +30,13 @@ class EmscriptenStartFuncsComment extends EmscriptenMarkerComment {
|
||||
/**
|
||||
* An `EMSCRIPTEN_END_ASM` marker comment.
|
||||
*/
|
||||
class EmscriptenEndASMComment extends EmscriptenMarkerComment {
|
||||
EmscriptenEndASMComment() { getText().trim() = "EMSCRIPTEN_END_ASM" }
|
||||
class EmscriptenEndAsmComment extends EmscriptenMarkerComment {
|
||||
EmscriptenEndAsmComment() { getText().trim() = "EMSCRIPTEN_END_ASM" }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for EmscriptenEndAsmComment */
|
||||
deprecated class EmscriptenEndASMComment = EmscriptenEndAsmComment;
|
||||
|
||||
/**
|
||||
* An `EMSCRIPTEN_END_FUNCS` marker comment.
|
||||
*/
|
||||
|
||||
@@ -7,32 +7,44 @@ import javascript
|
||||
/**
|
||||
* A `$gwt_version` variable.
|
||||
*/
|
||||
class GWTVersionVariable extends GlobalVariable {
|
||||
GWTVersionVariable() { getName() = "$gwt_version" }
|
||||
class GwtVersionVariable extends GlobalVariable {
|
||||
GwtVersionVariable() { getName() = "$gwt_version" }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for GwtVersionVariable */
|
||||
deprecated class GWTVersionVariable = GwtVersionVariable;
|
||||
|
||||
/**
|
||||
* A GWT header script that defines the `$gwt_version` variable.
|
||||
*/
|
||||
class GWTHeader extends InlineScript {
|
||||
GWTHeader() {
|
||||
exists(GWTVersionVariable gwtVersion | gwtVersion.getADeclaration().getTopLevel() = this)
|
||||
class GwtHeader extends InlineScript {
|
||||
GwtHeader() {
|
||||
exists(GwtVersionVariable gwtVersion | gwtVersion.getADeclaration().getTopLevel() = this)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the GWT version this script was generated with, if it can be determined.
|
||||
*/
|
||||
string getGWTVersion() {
|
||||
string getGwtVersion() {
|
||||
exists(Expr e | e.getTopLevel() = this |
|
||||
e = any(GWTVersionVariable v).getAnAssignedExpr() and
|
||||
e = any(GwtVersionVariable v).getAnAssignedExpr() and
|
||||
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.
|
||||
*/
|
||||
class GWTGeneratedTopLevel extends TopLevel {
|
||||
GWTGeneratedTopLevel() { exists(GWTHeader h | getFile() = h.getFile()) }
|
||||
class GwtGeneratedTopLevel extends TopLevel {
|
||||
GwtGeneratedTopLevel() { exists(GwtHeader h | getFile() = h.getFile()) }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for GwtGeneratedTopLevel */
|
||||
deprecated class GWTGeneratedTopLevel = GwtGeneratedTopLevel;
|
||||
|
||||
@@ -15,21 +15,21 @@ private module ServerLess {
|
||||
* `codeURI` defaults to the empty string if no explicit value is set in the configuration.
|
||||
*/
|
||||
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"
|
||||
resource.lookup("Type").(YAMLScalar).getValue().regexpMatch(".*::Serverless::Function") and
|
||||
exists(YAMLMapping properties | properties = resource.lookup("Properties") |
|
||||
handler = properties.lookup("Handler").(YAMLScalar).getValue() and
|
||||
resource.lookup("Type").(YamlScalar).getValue().regexpMatch(".*::Serverless::Function") and
|
||||
exists(YamlMapping properties | properties = resource.lookup("Properties") |
|
||||
handler = properties.lookup("Handler").(YamlScalar).getValue() and
|
||||
if exists(properties.lookup("CodeUri"))
|
||||
then codeUri = properties.lookup("CodeUri").(YAMLScalar).getValue()
|
||||
then codeUri = properties.lookup("CodeUri").(YamlScalar).getValue()
|
||||
else codeUri = ""
|
||||
)
|
||||
or
|
||||
// The `serverless` library, which specifies a top-level `functions` property
|
||||
exists(YAMLMapping functions |
|
||||
exists(YamlMapping functions |
|
||||
functions = resource.lookup("functions") 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 = ""
|
||||
)
|
||||
)
|
||||
|
||||
@@ -27,8 +27,8 @@ class QUnitTest extends Test, @call_expr {
|
||||
* that is, an invocation of a function named `it` where the first argument
|
||||
* is a string and the second argument is a function.
|
||||
*/
|
||||
class BDDTest extends Test, @call_expr {
|
||||
BDDTest() {
|
||||
class BddTest extends Test, @call_expr {
|
||||
BddTest() {
|
||||
exists(CallExpr call | call = this |
|
||||
call.getCallee().(VarAccess).getName() = "it" 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".
|
||||
* That is, a file named `<base>.<stemExt>.<ext>` in the
|
||||
|
||||
@@ -281,7 +281,7 @@ private module JQueryClientRequest {
|
||||
.getParameter(0)
|
||||
or
|
||||
result =
|
||||
getAResponseNodeFromAnXHRObject(this.getOptionArgument([0 .. 1],
|
||||
getAResponseNodeFromAnXhrObject(this.getOptionArgument([0 .. 1],
|
||||
any(string method | method = "error" or method = "complete"))
|
||||
.getALocalSource()
|
||||
.(DataFlow::FunctionNode)
|
||||
@@ -303,15 +303,15 @@ private module JQueryClientRequest {
|
||||
.getParameter(0)
|
||||
or
|
||||
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.
|
||||
*/
|
||||
private DataFlow::SourceNode getAResponseNodeFromAnXHRObject(DataFlow::SourceNode jqXHR) {
|
||||
private DataFlow::SourceNode getAResponseNodeFromAnXhrObject(DataFlow::SourceNode jqXhr) {
|
||||
result =
|
||||
jqXHR
|
||||
jqXhr
|
||||
.getAPropertyRead(any(string s |
|
||||
s = "responseText" or
|
||||
s = "responseXML"
|
||||
|
||||
@@ -60,7 +60,7 @@ module ESLint {
|
||||
}
|
||||
|
||||
/** An `.eslintrc.yaml` file. */
|
||||
private class EslintrcYaml extends Configuration, YAMLDocument, YAMLMapping {
|
||||
private class EslintrcYaml extends Configuration, YamlDocument, YamlMapping {
|
||||
EslintrcYaml() {
|
||||
exists(string n | n = getFile().getBaseName() |
|
||||
n = ".eslintrc.yaml" or n = ".eslintrc.yml" or n = ".eslintrc"
|
||||
@@ -71,11 +71,11 @@ module ESLint {
|
||||
}
|
||||
|
||||
/** 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 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
|
||||
or
|
||||
v = "false" and result = false
|
||||
|
||||
@@ -21,11 +21,11 @@ predicate config(string key, string val, Locatable valElement) {
|
||||
val = valElement.(JsonString).getValue()
|
||||
)
|
||||
or
|
||||
exists(YAMLMapping m, YAMLString keyElement |
|
||||
exists(YamlMapping m, YamlString keyElement |
|
||||
m.maps(keyElement, valElement) and
|
||||
key = keyElement.getValue() and
|
||||
(
|
||||
val = valElement.(YAMLString).getValue()
|
||||
val = valElement.(YamlString).getValue()
|
||||
or
|
||||
valElement.toString() = "" and
|
||||
val = ""
|
||||
|
||||
@@ -67,10 +67,10 @@ module XssThroughDom {
|
||||
/**
|
||||
* 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;
|
||||
|
||||
JQueryDOMPropertySource() {
|
||||
JQueryDomPropertySource() {
|
||||
exists(string methodName |
|
||||
this.getMethodName() = methodName and
|
||||
this.getNumArgument() = 1 and
|
||||
@@ -87,6 +87,9 @@ module XssThroughDom {
|
||||
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.
|
||||
*/
|
||||
|
||||
@@ -61,8 +61,8 @@ module StaticCreation {
|
||||
}
|
||||
|
||||
/** A script element that refers to untrusted content. */
|
||||
class CDNScriptElementWithUntrustedContent extends AddsUntrustedUrl, HTML::ScriptElement {
|
||||
CDNScriptElementWithUntrustedContent() {
|
||||
class CdnScriptElementWithUntrustedContent extends AddsUntrustedUrl, HTML::ScriptElement {
|
||||
CdnScriptElementWithUntrustedContent() {
|
||||
not exists(string digest | not digest = "" | this.getIntegrityDigest() = digest) and
|
||||
isCdnUrlWithCheckingRequired(this.getSourcePath())
|
||||
}
|
||||
|
||||
@@ -78,9 +78,9 @@ class ProbableJob extends Actions::Job {
|
||||
/**
|
||||
* 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() {
|
||||
exists(YAMLNode prtNode |
|
||||
exists(YamlNode prtNode |
|
||||
// The `on:` is triggered on `pull_request_target`
|
||||
this.getNode("pull_request_target") = prtNode and
|
||||
(
|
||||
@@ -88,7 +88,7 @@ class ProbablePullRequestTarget extends Actions::On, YAMLMappingLikeNode {
|
||||
not exists(prtNode.getAChild())
|
||||
or
|
||||
// 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
|
||||
prtNode = prt and
|
||||
(
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
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
|
||||
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()
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import semmle.javascript.frameworks.GWT
|
||||
|
||||
from GWTGeneratedTopLevel g
|
||||
from GwtGeneratedTopLevel g
|
||||
select g
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import semmle.javascript.frameworks.GWT
|
||||
|
||||
from GWTHeader h
|
||||
from GwtHeader h
|
||||
select h
|
||||
|
||||
@@ -3,7 +3,7 @@ import javascript
|
||||
import HTTP
|
||||
|
||||
/** A RAML specification. */
|
||||
class RamlSpec extends YAMLDocument, YAMLMapping {
|
||||
class RamlSpec extends YamlDocument, YamlMapping {
|
||||
RamlSpec() { getLocation().getFile().getExtension() = "raml" }
|
||||
}
|
||||
|
||||
@@ -11,10 +11,10 @@ class RamlSpec extends YAMLDocument, YAMLMapping {
|
||||
deprecated class RAMLSpec = RamlSpec;
|
||||
|
||||
/** A RAML resource specification. */
|
||||
class RamlResource extends YAMLMapping {
|
||||
class RamlResource extends YamlMapping {
|
||||
RamlResource() {
|
||||
getDocument() instanceof RamlSpec and
|
||||
exists(YAMLMapping m, string name |
|
||||
exists(YamlMapping m, string name |
|
||||
this = m.lookup(name) and
|
||||
name.matches("/%")
|
||||
)
|
||||
@@ -41,16 +41,16 @@ class RamlResource extends YAMLMapping {
|
||||
deprecated class RAMLResource = RamlResource;
|
||||
|
||||
/** A RAML method specification. */
|
||||
class RamlMethod extends YAMLValue {
|
||||
class RamlMethod extends YamlValue {
|
||||
RamlMethod() {
|
||||
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. */
|
||||
YAMLValue getResponse(int code) {
|
||||
exists(YAMLMapping obj, string s |
|
||||
obj = this.(YAMLMapping).lookup("responses") and
|
||||
YamlValue getResponse(int code) {
|
||||
exists(YamlMapping obj, string s |
|
||||
obj = this.(YamlMapping).lookup("responses") and
|
||||
result = obj.lookup(s) and
|
||||
code = s.toInt()
|
||||
)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import javascript
|
||||
|
||||
/** A RAML specification. */
|
||||
class RamlSpec extends YAMLDocument, YAMLMapping {
|
||||
class RamlSpec extends YamlDocument, YamlMapping {
|
||||
RamlSpec() { getLocation().getFile().getExtension() = "raml" }
|
||||
}
|
||||
|
||||
|
||||
@@ -3,15 +3,15 @@ import javascript
|
||||
string httpVerb() { result = ["get", "put", "post", "delete"] }
|
||||
|
||||
/** A RAML specification. */
|
||||
class RamlSpec extends YAMLDocument, YAMLMapping {
|
||||
class RamlSpec extends YamlDocument, YamlMapping {
|
||||
RamlSpec() { getLocation().getFile().getExtension() = "raml" }
|
||||
}
|
||||
|
||||
/** A RAML resource specification. */
|
||||
class RamlResource extends YAMLMapping {
|
||||
class RamlResource extends YamlMapping {
|
||||
RamlResource() {
|
||||
getDocument() instanceof RamlSpec and
|
||||
exists(YAMLMapping m, string name |
|
||||
exists(YamlMapping m, string name |
|
||||
this = m.lookup(name) and
|
||||
name.matches("/%")
|
||||
)
|
||||
@@ -35,16 +35,16 @@ class RamlResource extends YAMLMapping {
|
||||
}
|
||||
|
||||
/** A RAML method specification. */
|
||||
class RamlMethod extends YAMLValue {
|
||||
class RamlMethod extends YamlValue {
|
||||
RamlMethod() {
|
||||
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. */
|
||||
YAMLValue getResponse(int code) {
|
||||
exists(YAMLMapping obj, string s |
|
||||
obj = this.(YAMLMapping).lookup("responses") and
|
||||
YamlValue getResponse(int code) {
|
||||
exists(YamlMapping obj, string s |
|
||||
obj = this.(YamlMapping).lookup("responses") and
|
||||
result = obj.lookup(s) and
|
||||
code = s.toInt()
|
||||
)
|
||||
|
||||
@@ -3,15 +3,15 @@ import javascript
|
||||
string httpVerb() { result = ["get", "put", "post", "delete"] }
|
||||
|
||||
/** A RAML specification. */
|
||||
class RamlSpec extends YAMLDocument, YAMLMapping {
|
||||
class RamlSpec extends YamlDocument, YamlMapping {
|
||||
RamlSpec() { getLocation().getFile().getExtension() = "raml" }
|
||||
}
|
||||
|
||||
/** A RAML resource specification. */
|
||||
class RamlResource extends YAMLMapping {
|
||||
class RamlResource extends YamlMapping {
|
||||
RamlResource() {
|
||||
getDocument() instanceof RamlSpec and
|
||||
exists(YAMLMapping m, string name |
|
||||
exists(YamlMapping m, string name |
|
||||
this = m.lookup(name) and
|
||||
name.matches("/%")
|
||||
)
|
||||
@@ -34,10 +34,10 @@ class RamlResource extends YAMLMapping {
|
||||
}
|
||||
}
|
||||
|
||||
class RamlMethod extends YAMLValue {
|
||||
class RamlMethod extends YamlValue {
|
||||
RamlMethod() {
|
||||
getDocument() instanceof RamlSpec and
|
||||
exists(YAMLMapping obj | this = obj.lookup(httpVerb()))
|
||||
exists(YamlMapping obj | this = obj.lookup(httpVerb()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,15 +3,15 @@ import javascript
|
||||
string httpVerb() { result = ["get", "put", "post", "delete"] }
|
||||
|
||||
/** A RAML specification. */
|
||||
class RamlSpec extends YAMLDocument, YAMLMapping {
|
||||
class RamlSpec extends YamlDocument, YamlMapping {
|
||||
RamlSpec() { getLocation().getFile().getExtension() = "raml" }
|
||||
}
|
||||
|
||||
/** A RAML resource specification. */
|
||||
class RamlResource extends YAMLMapping {
|
||||
class RamlResource extends YamlMapping {
|
||||
RamlResource() {
|
||||
getDocument() instanceof RamlSpec and
|
||||
exists(YAMLMapping m, string name |
|
||||
exists(YamlMapping m, string name |
|
||||
this = m.lookup(name) and
|
||||
name.matches("/%")
|
||||
)
|
||||
@@ -35,16 +35,16 @@ class RamlResource extends YAMLMapping {
|
||||
}
|
||||
|
||||
/** A RAML method specification. */
|
||||
class RamlMethod extends YAMLValue {
|
||||
class RamlMethod extends YamlValue {
|
||||
RamlMethod() {
|
||||
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. */
|
||||
YAMLValue getResponse(int code) {
|
||||
exists(YAMLMapping obj, string s |
|
||||
obj = this.(YAMLMapping).lookup("responses") and
|
||||
YamlValue getResponse(int code) {
|
||||
exists(YamlMapping obj, string s |
|
||||
obj = this.(YamlMapping).lookup("responses") and
|
||||
result = obj.lookup(s) and
|
||||
code = s.toInt()
|
||||
)
|
||||
|
||||
@@ -2098,8 +2098,8 @@ private module StdlibPrivate {
|
||||
*
|
||||
* See https://docs.python.org/3.10/library/wsgiref.html#wsgiref.simple_server.WSGIRequestHandler.get_environ
|
||||
*/
|
||||
class WSGIEnvirontParameter extends RemoteFlowSource::Range, DataFlow::ParameterNode {
|
||||
WSGIEnvirontParameter() {
|
||||
class WsgiEnvirontParameter extends RemoteFlowSource::Range, DataFlow::ParameterNode {
|
||||
WsgiEnvirontParameter() {
|
||||
exists(WsgirefSimpleServerApplication func |
|
||||
if func.isMethod()
|
||||
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
|
||||
* takes the `start_response` function.
|
||||
|
||||
@@ -22,11 +22,14 @@ private module ExperimentalPrivateDjango {
|
||||
|
||||
module Request {
|
||||
module HttpRequest {
|
||||
class DjangoGETParameter extends DataFlow::Node, RemoteFlowSource::Range {
|
||||
DjangoGETParameter() { this = request().getMember("GET").getMember("get").getACall() }
|
||||
class DjangoGetParameter extends DataFlow::Node, RemoteFlowSource::Range {
|
||||
DjangoGetParameter() { this = request().getMember("GET").getMember("get").getACall() }
|
||||
|
||||
override string getSourceType() { result = "django.http.request.GET.get" }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for DjangoGetParameter */
|
||||
deprecated class DjangoGETParameter = DjangoGetParameter;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -126,9 +126,9 @@ private module Ldap {
|
||||
(
|
||||
// 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
|
||||
exists(DataFlow::MethodCallNode startTLS |
|
||||
startTLS.getObject().getALocalSource() = initialize and
|
||||
startTLS.getMethodName() = "start_tls_s"
|
||||
exists(DataFlow::MethodCallNode startTls |
|
||||
startTls.getObject().getALocalSource() = initialize and
|
||||
startTls.getMethodName() = "start_tls_s"
|
||||
)
|
||||
or
|
||||
// ldap_connection.set_option(ldap.OPT_X_TLS_%s, True)
|
||||
@@ -234,9 +234,9 @@ private module Ldap {
|
||||
or
|
||||
// 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
|
||||
exists(DataFlow::MethodCallNode startTLS |
|
||||
startTLS.getMethodName() = "start_tls_s" and
|
||||
startTLS.getObject().getALocalSource() = this
|
||||
exists(DataFlow::MethodCallNode startTls |
|
||||
startTls.getMethodName() = "start_tls_s" and
|
||||
startTls.getObject().getALocalSource() = this
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ module SmtpLib {
|
||||
* argument. Used because of the impossibility to get local source nodes from `_subparts`'
|
||||
* `(List|Tuple)` elements.
|
||||
*/
|
||||
private class SMTPMessageConfig extends TaintTracking2::Configuration {
|
||||
SMTPMessageConfig() { this = "SMTPMessageConfig" }
|
||||
private class SmtpMessageConfig extends TaintTracking2::Configuration {
|
||||
SmtpMessageConfig() { this = "SMTPMessageConfig" }
|
||||
|
||||
override predicate isSource(DataFlow::Node source) { source = mimeText(_) }
|
||||
|
||||
@@ -87,7 +87,7 @@ module SmtpLib {
|
||||
sink =
|
||||
[sendCall.getArg(2), sendCall.getArg(2).(DataFlow::MethodCallNode).getObject()]
|
||||
.getALocalSource() and
|
||||
any(SMTPMessageConfig a)
|
||||
any(SmtpMessageConfig a)
|
||||
.hasFlow(source, sink.(DataFlow::CallCfgNode).getArgByName("_subparts"))
|
||||
or
|
||||
// via .attach()
|
||||
@@ -117,7 +117,7 @@ module SmtpLib {
|
||||
* * `sub` would be `message["Subject"]` (`Subscript`)
|
||||
* * `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 |
|
||||
sub = def.getNode() and
|
||||
DataFlow::exprNode(sub.getObject()).getALocalSource() =
|
||||
@@ -163,15 +163,15 @@ module SmtpLib {
|
||||
override DataFlow::Node getHtmlBody() { result = getSmtpMessage(this, "html") }
|
||||
|
||||
override DataFlow::Node getTo() {
|
||||
result in [this.getArg(1), getSMTPSubscriptByIndex(this, "To")]
|
||||
result in [this.getArg(1), getSmtpSubscriptByIndex(this, "To")]
|
||||
}
|
||||
|
||||
override DataFlow::Node getFrom() {
|
||||
result in [this.getArg(0), getSMTPSubscriptByIndex(this, "From")]
|
||||
result in [this.getArg(0), getSmtpSubscriptByIndex(this, "From")]
|
||||
}
|
||||
|
||||
override DataFlow::Node getSubject() {
|
||||
result in [this.getArg(2), getSMTPSubscriptByIndex(this, "Subject")]
|
||||
result in [this.getArg(2), getSmtpSubscriptByIndex(this, "Subject")]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
exists(DataFlow::Node sink |
|
||||
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;
|
||||
|
||||
@@ -2477,15 +2477,18 @@ class BindingSet extends Annotation {
|
||||
*/
|
||||
module YAML {
|
||||
/** 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) */
|
||||
predicate isRoot() { not exists(this.getParent()) }
|
||||
|
||||
override AstNode getParent() { toGenerateYaml(result) = toGenerateYaml(this).getParent() }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for YamlNode */
|
||||
deprecated class YAMLNode = YamlNode;
|
||||
|
||||
/** A YAML comment. */
|
||||
class YamlComment extends TYamlCommemt, YAMLNode {
|
||||
class YamlComment extends TYamlCommemt, YamlNode {
|
||||
Yaml::Comment yamlcomment;
|
||||
|
||||
YamlComment() { this = TYamlCommemt(yamlcomment) }
|
||||
@@ -2497,7 +2500,7 @@ module YAML {
|
||||
deprecated class YAMLComment = YamlComment;
|
||||
|
||||
/** A YAML entry. */
|
||||
class YamlEntry extends TYamlEntry, YAMLNode {
|
||||
class YamlEntry extends TYamlEntry, YamlNode {
|
||||
Yaml::Entry yamle;
|
||||
|
||||
YamlEntry() { this = TYamlEntry(yamle) }
|
||||
@@ -2527,7 +2530,7 @@ module YAML {
|
||||
deprecated class YAMLEntry = YamlEntry;
|
||||
|
||||
/** A YAML key. */
|
||||
class YamlKey extends TYamlKey, YAMLNode {
|
||||
class YamlKey extends TYamlKey, YamlNode {
|
||||
Yaml::Key yamlkey;
|
||||
|
||||
YamlKey() { this = TYamlKey(yamlkey) }
|
||||
@@ -2566,7 +2569,7 @@ module YAML {
|
||||
deprecated class YAMLKey = YamlKey;
|
||||
|
||||
/** A YAML list item. */
|
||||
class YamlListItem extends TYamlListitem, YAMLNode {
|
||||
class YamlListItem extends TYamlListitem, YamlNode {
|
||||
Yaml::Listitem yamllistitem;
|
||||
|
||||
YamlListItem() { this = TYamlListitem(yamllistitem) }
|
||||
@@ -2583,7 +2586,7 @@ module YAML {
|
||||
deprecated class YAMLListItem = YamlListItem;
|
||||
|
||||
/** A YAML value. */
|
||||
class YamlValue extends TYamlValue, YAMLNode {
|
||||
class YamlValue extends TYamlValue, YamlNode {
|
||||
Yaml::Value yamlvalue;
|
||||
|
||||
YamlValue() { this = TYamlValue(yamlvalue) }
|
||||
@@ -2691,7 +2694,7 @@ module YAML {
|
||||
Location getLocation() {
|
||||
// hacky, just pick the first node in the file.
|
||||
result =
|
||||
min(YAMLNode entry, Location l, File f |
|
||||
min(YamlNode entry, Location l, File f |
|
||||
entry.getLocation().getFile() = file and
|
||||
f = file and
|
||||
l = entry.getLocation()
|
||||
|
||||
@@ -97,13 +97,13 @@ class Feature extends TFeature {
|
||||
abstract string getConstantName();
|
||||
}
|
||||
|
||||
private class FeatureNOENT extends Feature, TNOENT {
|
||||
private class FeatureNoent extends Feature, TNOENT {
|
||||
override int getValue() { result = 2 }
|
||||
|
||||
override string getConstantName() { result = "NOENT" }
|
||||
}
|
||||
|
||||
private class FeatureNONET extends Feature, TNONET {
|
||||
private class FeatureNonet extends Feature, TNONET {
|
||||
override int getValue() { result = 2048 }
|
||||
|
||||
override string getConstantName() { result = "NONET" }
|
||||
|
||||
Reference in New Issue
Block a user