Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
34816b1
SuppressionScope non-extending subtype of SuppressionComment
ginsbach Oct 13, 2021
cee233e
SuppressionScope non-extending subtype of SuppressionComment
ginsbach Oct 13, 2021
8c1e459
SuppressionScope non-extending subtype of SuppressionAnnotation
ginsbach Oct 13, 2021
2ed7a84
GeneratedTopLevel non-extending subtype of GeneratedType
ginsbach Oct 13, 2021
f71cc18
HtmlElementDefinition non-extending subtype of HTML::Element
ginsbach Oct 13, 2021
c16eecd
JsxElementDefinition non-extending subtype of JSXElement
ginsbach Oct 13, 2021
adcb39f
HtmlAttributeDefinition non-extending subtype of HTML::Attribute
ginsbach Oct 13, 2021
0c16dfe
InvokeNode non-extending subtype of DataFlow::Impl::InvokeNodeDef
ginsbach Oct 13, 2021
9517822
MethodCallNode non-extending subtype of DataFlow::Impl::MethodCallNod…
ginsbach Oct 13, 2021
067698d
Refinement non-extending subtype of RefinementCandidate
ginsbach Oct 13, 2021
5d04148
AnalyzedExplicitPropertyWrite non-extending subtype of DataFlow::Prop…
ginsbach Oct 13, 2021
f2c2bce
LinkFunctionWithScopeInjection non-extending subtype of LinkFunction
ginsbach Oct 13, 2021
710193e
ProviderRecipeServiceInjection non-extending subtype of ProviderRecip…
ginsbach Oct 13, 2021
0cead18
RequestInputAccessAsSource non-extending subtype of HTTP::RequestInpu…
ginsbach Oct 13, 2021
2a75e5b
SuppressionScope non-extending subtype of SuppressionComment
ginsbach Oct 13, 2021
c7d39aa
LdapjsSearchFilterAsSink non-extending subtype of LdapjsSearchFilter
ginsbach Oct 13, 2021
df33677
LdapjsDNArgumentAsSink non-extending subtype of LdapjsDNArgument
ginsbach Oct 13, 2021
46aac27
UnpackingAssignmentSequenceTarget non-extending subtype of SequenceNode
ginsbach Oct 13, 2021
1df38c8
TaintTrackingImplementation non-extending subtype of TaintTracking::C…
ginsbach Oct 13, 2021
291b3a3
EssaTaintTracking non-extending subtype of TaintTracking::Configuration
ginsbach Oct 13, 2021
fd9227e
ConfigurationAdapter non-extending subtype of Configuration
ginsbach Oct 13, 2021
30b59f5
ExternalPackage non-extending subtype of ModuleObject
ginsbach Oct 13, 2021
aa193bb
ModuleVariable non-extending subtype of GlobalVariable
ginsbach Oct 13, 2021
c732852
ModuleValue non-extending subtype of ModuleObjectInternal
ginsbach Oct 13, 2021
c2f4ea4
CallableValue non-extending subtype of CallableObjectInternal
ginsbach Oct 13, 2021
54c5fac
BoundMethodValue non-extending subtype of BoundMethodObjectInternal
ginsbach Oct 13, 2021
10f015a
PythonFunctionValue non-extending subtype of PythonFunctionObjectInte…
ginsbach Oct 13, 2021
e23c2fc
BuiltinFunctionValue non-extending subtype of BuiltinFunctionObjectIn…
ginsbach Oct 13, 2021
158dfc1
BuiltinMethodValue non-extending subtype of BuiltinMethodObjectInternal
ginsbach Oct 13, 2021
084e69a
SequenceValue non-extending subtype of SequenceObjectInternal
ginsbach Oct 13, 2021
ca1ddbb
PropertyValue non-extending subtype of PropertyInternal
ginsbach Oct 13, 2021
1efa5d5
BackwardCompatiblePointToExtension non-extending subtype of CustomPoi…
ginsbach Oct 13, 2021
bae1e36
SuppressionScope non-extending subtype of SuppressionComment
ginsbach Oct 13, 2021
cc26718
revert non-extending subtype relationships that introduced method amb…
ginsbach Oct 14, 2021
7e8e6e8
remove disjunction case that is ruled impossible by type information
ginsbach Oct 14, 2021
70b679f
leave python as it is
ginsbach Oct 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions csharp/ql/src/AlertSuppression.ql
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ class SuppressionComment extends CommentLine {
/**
* The scope of an alert suppression comment.
*/
class SuppressionScope extends @commentline {
SuppressionScope() { this instanceof SuppressionComment }

class SuppressionScope extends @commentline instanceof SuppressionComment {
/** Gets a suppression comment with this scope. */
SuppressionComment getSuppressionComment() { result = this }

Expand All @@ -60,7 +58,7 @@ class SuppressionScope extends @commentline {
predicate hasLocationInfo(
string filepath, int startline, int startcolumn, int endline, int endcolumn
) {
this.(SuppressionComment).covers(filepath, startline, startcolumn, endline, endcolumn)
super.covers(filepath, startline, startcolumn, endline, endcolumn)
}

/** Gets a textual representation of this element. */
Expand Down
6 changes: 2 additions & 4 deletions java/ql/src/AlertSuppression.ql
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ class SuppressionComment extends Javadoc {
/**
* The scope of an alert suppression comment.
*/
class SuppressionScope extends @javadoc {
SuppressionScope() { this instanceof SuppressionComment }

class SuppressionScope extends @javadoc instanceof SuppressionComment {
/** Gets a suppression comment with this scope. */
SuppressionComment getSuppressionComment() { result = this }

Expand All @@ -69,7 +67,7 @@ class SuppressionScope extends @javadoc {
predicate hasLocationInfo(
string filepath, int startline, int startcolumn, int endline, int endcolumn
) {
this.(SuppressionComment).covers(filepath, startline, startcolumn, endline, endcolumn)
super.covers(filepath, startline, startcolumn, endline, endcolumn)
}

/** Gets a textual representation of this element. */
Expand Down
6 changes: 2 additions & 4 deletions java/ql/src/AlertSuppressionAnnotations.ql
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ class SuppressionAnnotation extends SuppressWarningsAnnotation {
/**
* The scope of an alert suppression annotation.
*/
class SuppressionScope extends @annotation {
SuppressionScope() { this instanceof SuppressionAnnotation }

class SuppressionScope extends @annotation instanceof SuppressionAnnotation {
/** Gets a suppression annotation with this scope. */
SuppressionAnnotation getSuppressionAnnotation() { result = this }

Expand All @@ -80,7 +78,7 @@ class SuppressionScope extends @annotation {
predicate hasLocationInfo(
string filepath, int startline, int startcolumn, int endline, int endcolumn
) {
this.(SuppressionAnnotation).covers(filepath, startline, startcolumn, endline, endcolumn)
super.covers(filepath, startline, startcolumn, endline, endcolumn)
}

/** Gets a textual representation of this element. */
Expand Down
9 changes: 3 additions & 6 deletions java/ql/src/utils/stub-generator/Stubs.qll
Original file line number Diff line number Diff line change
Expand Up @@ -437,11 +437,8 @@ private RefType getAReferencedType(RefType t) {
}

/** A top level type whose file should be stubbed */
class GeneratedTopLevel extends TopLevelType {
GeneratedTopLevel() {
this = this.getSourceDeclaration() and
this instanceof GeneratedType
}
class GeneratedTopLevel extends TopLevelType instanceof GeneratedType {
GeneratedTopLevel() { this = this.getSourceDeclaration() }

private TopLevelType getAnImportedType() {
result = getAReferencedType(this).getSourceDeclaration()
Expand Down Expand Up @@ -474,6 +471,6 @@ class GeneratedTopLevel extends TopLevelType {

/** Creates a full stub for the file containing this type. */
string stubFile() {
result = stubComment() + stubPackage() + stubImports() + this.(GeneratedType).getStub() + "\n"
result = stubComment() + stubPackage() + stubImports() + super.getStub() + "\n"
}
}
26 changes: 10 additions & 16 deletions javascript/ql/lib/semmle/javascript/dataflow/Nodes.qll
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,15 @@ class ParameterNode extends DataFlow::SourceNode {
* new Array(16)
* ```
*/
class InvokeNode extends DataFlow::SourceNode {
InvokeNode() { this instanceof DataFlow::Impl::InvokeNodeDef }

class InvokeNode extends DataFlow::SourceNode instanceof DataFlow::Impl::InvokeNodeDef {
/** Gets the syntactic invoke expression underlying this function invocation. */
InvokeExpr getInvokeExpr() { result = this.(DataFlow::Impl::InvokeNodeDef).getInvokeExpr() }
InvokeExpr getInvokeExpr() { result = super.getInvokeExpr() }

/** Gets the name of the function or method being invoked, if it can be determined. */
string getCalleeName() { result = this.(DataFlow::Impl::InvokeNodeDef).getCalleeName() }
string getCalleeName() { result = super.getCalleeName() }

/** Gets the data flow node specifying the function to be called. */
DataFlow::Node getCalleeNode() { result = this.(DataFlow::Impl::InvokeNodeDef).getCalleeNode() }
DataFlow::Node getCalleeNode() { result = super.getCalleeNode() }

/**
* Gets the data flow node corresponding to the `i`th argument of this invocation.
Expand All @@ -92,10 +90,10 @@ class InvokeNode extends DataFlow::SourceNode {
* but the position of `z` cannot be determined, hence there are no first and second
* argument nodes.
*/
DataFlow::Node getArgument(int i) { result = this.(DataFlow::Impl::InvokeNodeDef).getArgument(i) }
DataFlow::Node getArgument(int i) { result = super.getArgument(i) }

/** Gets the data flow node corresponding to an argument of this invocation. */
DataFlow::Node getAnArgument() { result = this.(DataFlow::Impl::InvokeNodeDef).getAnArgument() }
DataFlow::Node getAnArgument() { result = super.getAnArgument() }

/** Gets the data flow node corresponding to the last argument of this invocation. */
DataFlow::Node getLastArgument() { result = getArgument(getNumArgument() - 1) }
Expand All @@ -112,12 +110,10 @@ class InvokeNode extends DataFlow::SourceNode {
* ```
* .
*/
DataFlow::Node getASpreadArgument() {
result = this.(DataFlow::Impl::InvokeNodeDef).getASpreadArgument()
}
DataFlow::Node getASpreadArgument() { result = super.getASpreadArgument() }

/** Gets the number of arguments of this invocation, if it can be determined. */
int getNumArgument() { result = this.(DataFlow::Impl::InvokeNodeDef).getNumArgument() }
int getNumArgument() { result = super.getNumArgument() }

Function getEnclosingFunction() { result = getBasicBlock().getContainer() }

Expand Down Expand Up @@ -279,11 +275,9 @@ class CallNode extends InvokeNode {
* Math.abs(x)
* ```
*/
class MethodCallNode extends CallNode {
MethodCallNode() { this instanceof DataFlow::Impl::MethodCallNodeDef }

class MethodCallNode extends CallNode instanceof DataFlow::Impl::MethodCallNodeDef {
/** Gets the name of the invoked method, if it can be determined. */
string getMethodName() { result = this.(DataFlow::Impl::MethodCallNodeDef).getMethodName() }
string getMethodName() { result = super.getMethodName() }

/**
* Holds if this data flow node calls method `methodName` on receiver node `receiver`.
Expand Down
11 changes: 4 additions & 7 deletions javascript/ql/lib/semmle/javascript/dataflow/Refinements.qll
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,18 @@ abstract class RefinementCandidate extends Expr {
* A refinement candidate that references at most one variable, and hence
* can be used to refine the abstract values inferred for that variable.
*/
class Refinement extends Expr {
Refinement() {
this instanceof RefinementCandidate and
count(this.(RefinementCandidate).getARefinedVar()) <= 1
}
class Refinement extends Expr instanceof RefinementCandidate {
Refinement() { count(super.getARefinedVar()) <= 1 }

/**
* Gets the variable refined by this expression, if any.
*/
SsaSourceVariable getRefinedVar() { result = this.(RefinementCandidate).getARefinedVar() }
SsaSourceVariable getRefinedVar() { result = super.getARefinedVar() }

/**
* Gets a refinement value inferred for this expression in context `ctxt`.
*/
RefinementValue eval(RefinementContext ctxt) { result = this.(RefinementCandidate).eval(ctxt) }
RefinementValue eval(RefinementContext ctxt) { result = super.eval(ctxt) }
}

/** A literal, viewed as a refinement expression. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,13 @@ abstract class AnalyzedPropertyWrite extends DataFlow::Node {
/**
* Flow analysis for property writes.
*/
private class AnalyzedExplicitPropertyWrite extends AnalyzedPropertyWrite {
AnalyzedExplicitPropertyWrite() { this instanceof DataFlow::PropWrite }

private class AnalyzedExplicitPropertyWrite extends AnalyzedPropertyWrite instanceof DataFlow::PropWrite {
override predicate writes(AbstractValue base, string prop, DataFlow::AnalyzedNode source) {
explicitPropertyWrite(this, base, prop, source)
}

override predicate baseIsIncomplete(DataFlow::Incompleteness reason) {
this.(DataFlow::PropWrite).getBase().isIncomplete(reason)
super.getBase().isIncomplete(reason)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,12 +480,10 @@ abstract class ServiceRequest extends Expr {
/**
* The request for a scope service in the form of the link-function of a directive.
*/
private class LinkFunctionWithScopeInjection extends ServiceRequest {
LinkFunctionWithScopeInjection() { this instanceof LinkFunction }

private class LinkFunctionWithScopeInjection extends ServiceRequest instanceof LinkFunction {
override Parameter getDependencyParameter(ServiceReference service) {
service instanceof ScopeServiceReference and
result = this.(LinkFunction).getScopeParameter()
result = super.getScopeParameter()
}
}

Expand Down Expand Up @@ -636,12 +634,8 @@ class ProviderRecipeDefinition extends RecipeDefinition {
}
}

private class ProviderRecipeServiceInjection extends DependencyInjection {
ProviderRecipeServiceInjection() { this instanceof ProviderRecipeDefinition }

override DataFlow::Node getAnInjectableFunction() {
result = this.(ProviderRecipeDefinition).getAService()
}
private class ProviderRecipeServiceInjection extends DependencyInjection instanceof ProviderRecipeDefinition {
override DataFlow::Node getAnInjectableFunction() { result = super.getAService() }
}

/**
Expand Down
6 changes: 2 additions & 4 deletions javascript/ql/src/AlertSuppression.ql
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ class SuppressionComment extends Locatable {
/**
* The scope of an alert suppression comment.
*/
class SuppressionScope extends @locatable {
SuppressionScope() { this instanceof SuppressionComment }

class SuppressionScope extends @locatable instanceof SuppressionComment {
/** Gets a suppression comment with this scope. */
SuppressionComment getSuppressionComment() { result = this }

Expand All @@ -68,7 +66,7 @@ class SuppressionScope extends @locatable {
predicate hasLocationInfo(
string filepath, int startline, int startcolumn, int endline, int endcolumn
) {
this.(SuppressionComment).covers(filepath, startline, startcolumn, endline, endcolumn)
super.covers(filepath, startline, startcolumn, endline, endcolumn)
}

/** Gets a textual representation of this element. */
Expand Down