Skip to content

Commit 9cb12cd

Browse files
committed
2 parents 2a2f6de + 77077da commit 9cb12cd

File tree

161 files changed

+1934
-3789
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+1934
-3789
lines changed

config/identical-files.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,10 @@
523523
"python/ql/lib/semmle/python/dataflow/new/internal/TypeTracker.qll",
524524
"ruby/ql/lib/codeql/ruby/typetracking/TypeTracker.qll"
525525
],
526+
"SummaryTypeTracker": [
527+
"python/ql/lib/semmle/python/dataflow/new/internal/SummaryTypeTracker.qll",
528+
"ruby/ql/lib/codeql/ruby/typetracking/internal/SummaryTypeTracker.qll"
529+
],
526530
"AccessPathSyntax": [
527531
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/AccessPathSyntax.qll",
528532
"go/ql/lib/semmle/go/dataflow/internal/AccessPathSyntax.qll",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* Deleted the deprecated `getURL` predicate from the `Container`, `Folder`, and `File` classes. Use the `getLocation` predicate instead.

cpp/ql/lib/semmle/code/cpp/File.qll

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,6 @@ class Container extends Locatable, @container {
3434
*/
3535
string getAbsolutePath() { none() } // overridden by subclasses
3636

37-
/**
38-
* DEPRECATED: Use `getLocation` instead.
39-
* Gets a URL representing the location of this container.
40-
*
41-
* For more information see [Providing URLs](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/#providing-urls).
42-
*/
43-
deprecated string getURL() { none() } // overridden by subclasses
44-
4537
/**
4638
* Gets the relative path of this file or folder from the root folder of the
4739
* analyzed source location. The relative path of the root folder itself is
@@ -183,12 +175,6 @@ class Folder extends Container, @folder {
183175
}
184176

185177
override string getAPrimaryQlClass() { result = "Folder" }
186-
187-
/**
188-
* DEPRECATED: Use `getLocation` instead.
189-
* Gets the URL of this folder.
190-
*/
191-
deprecated override string getURL() { result = "file://" + this.getAbsolutePath() + ":0:0:0:0" }
192178
}
193179

194180
/**
@@ -213,12 +199,6 @@ class File extends Container, @file {
213199
result.hasLocationInfo(_, 0, 0, 0, 0)
214200
}
215201

216-
/**
217-
* DEPRECATED: Use `getLocation` instead.
218-
* Gets the URL of this file.
219-
*/
220-
deprecated override string getURL() { result = "file://" + this.getAbsolutePath() + ":0:0:0:0" }
221-
222202
/** Holds if this file was compiled as C (at any point). */
223203
predicate compiledAsC() { fileannotations(underlyingElement(this), 1, "compiled as c", "1") }
224204

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2021,7 +2021,8 @@ module Impl<FullStateConfigSig Config> {
20212021
FlowCheckNode() {
20222022
castNode(this.asNode()) or
20232023
clearsContentCached(this.asNode(), _) or
2024-
expectsContentCached(this.asNode(), _)
2024+
expectsContentCached(this.asNode(), _) or
2025+
neverSkipInPathGraph(this.asNode())
20252026
}
20262027
}
20272028

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowPrivate.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,12 @@ class CastNode extends Node {
235235
CastNode() { none() } // stub implementation
236236
}
237237

238+
/**
239+
* Holds if `n` should never be skipped over in the `PathGraph` and in path
240+
* explanations.
241+
*/
242+
predicate neverSkipInPathGraph(Node n) { none() }
243+
238244
class DataFlowCallable = Function;
239245

240246
class DataFlowExpr = Expr;

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2021,7 +2021,8 @@ module Impl<FullStateConfigSig Config> {
20212021
FlowCheckNode() {
20222022
castNode(this.asNode()) or
20232023
clearsContentCached(this.asNode(), _) or
2024-
expectsContentCached(this.asNode(), _)
2024+
expectsContentCached(this.asNode(), _) or
2025+
neverSkipInPathGraph(this.asNode())
20252026
}
20262027
}
20272028

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,12 @@ class CastNode extends Node {
783783
CastNode() { none() } // stub implementation
784784
}
785785

786+
/**
787+
* Holds if `n` should never be skipped over in the `PathGraph` and in path
788+
* explanations.
789+
*/
790+
predicate neverSkipInPathGraph(Node n) { none() }
791+
786792
/**
787793
* A function that may contain code or a variable that may contain itself. When
788794
* flow crosses from one _enclosing callable_ to another, the interprocedural

csharp/ql/lib/qlpack.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ extractor: csharp
66
library: true
77
upgrades: upgrades
88
dependencies:
9+
codeql/mad: ${workspace}
910
codeql/ssa: ${workspace}
1011
codeql/tutorial: ${workspace}
1112
codeql/util: ${workspace}

csharp/ql/lib/semmle/code/csharp/dataflow/ExternalFlow.qll

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@
6262
* in the given range. The range is inclusive at both ends.
6363
* - "ReturnValue": Selects the return value of a call to the selected element.
6464
*
65-
* For summaries, `input` and `output` may be prefixed by one of the following,
66-
* separated by the "of" keyword:
65+
* For summaries, `input` and `output` may be suffixed by any number of the
66+
* following, separated by ".":
6767
* - "Element": Selects an element in a collection.
6868
* - "Field[f]": Selects the contents of field `f`.
6969
* - "Property[p]": Selects the contents of property `p`.
@@ -95,6 +95,7 @@ private import internal.DataFlowPublic
9595
private import internal.FlowSummaryImpl::Public
9696
private import internal.FlowSummaryImpl::Private::External
9797
private import internal.FlowSummaryImplSpecific
98+
private import codeql.mad.ModelValidation as SharedModelVal
9899

99100
/** Holds if a source model exists for the given parameters. */
100101
predicate sourceModel = Extensions::sourceModel/9;
@@ -204,30 +205,18 @@ module ModelValidation {
204205
)
205206
}
206207

207-
private string getInvalidModelKind() {
208-
exists(string kind | summaryModel(_, _, _, _, _, _, _, _, kind, _) |
209-
not kind = ["taint", "value"] and
210-
result = "Invalid kind \"" + kind + "\" in summary model."
211-
)
212-
or
213-
exists(string kind | sinkModel(_, _, _, _, _, _, _, kind, _) |
214-
not kind =
215-
["code-injection", "sql-injection", "js-injection", "html-injection", "file-content-store"] and
216-
not kind.matches("encryption-%") and
217-
result = "Invalid kind \"" + kind + "\" in sink model."
218-
)
219-
or
220-
exists(string kind | sourceModel(_, _, _, _, _, _, _, kind, _) |
221-
not kind = ["local", "remote", "file", "file-write"] and
222-
result = "Invalid kind \"" + kind + "\" in source model."
223-
)
224-
or
225-
exists(string kind | neutralModel(_, _, _, _, kind, _) |
226-
not kind = ["summary", "source", "sink"] and
227-
result = "Invalid kind \"" + kind + "\" in neutral model."
228-
)
208+
private module KindValConfig implements SharedModelVal::KindValidationConfigSig {
209+
predicate summaryKind(string kind) { summaryModel(_, _, _, _, _, _, _, _, kind, _) }
210+
211+
predicate sinkKind(string kind) { sinkModel(_, _, _, _, _, _, _, kind, _) }
212+
213+
predicate sourceKind(string kind) { sourceModel(_, _, _, _, _, _, _, kind, _) }
214+
215+
predicate neutralKind(string kind) { neutralModel(_, _, _, _, kind, _) }
229216
}
230217

218+
private module KindVal = SharedModelVal::KindValidation<KindValConfig>;
219+
231220
private string getInvalidModelSignature() {
232221
exists(
233222
string pred, string namespace, string type, string name, string signature, string ext,
@@ -269,7 +258,7 @@ module ModelValidation {
269258
msg =
270259
[
271260
getInvalidModelSignature(), getInvalidModelInput(), getInvalidModelOutput(),
272-
getInvalidModelKind()
261+
KindVal::getInvalidModelKind()
273262
]
274263
}
275264
}

csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2021,7 +2021,8 @@ module Impl<FullStateConfigSig Config> {
20212021
FlowCheckNode() {
20222022
castNode(this.asNode()) or
20232023
clearsContentCached(this.asNode(), _) or
2024-
expectsContentCached(this.asNode(), _)
2024+
expectsContentCached(this.asNode(), _) or
2025+
neverSkipInPathGraph(this.asNode())
20252026
}
20262027
}
20272028

0 commit comments

Comments
 (0)