Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0addae8

Browse files
committed
Merge remote-tracking branch 'upstream/main' into mathiasvp/replace-ast-with-ir-use-usedataflow
2 parents 949b61c + 149cae9 commit 0addae8

317 files changed

Lines changed: 23015 additions & 7522 deletions

File tree

Some content is hidden

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

.github/workflows/atm-check-query-suite.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313

1414
jobs:
1515
atm-check-query-suite:
16-
runs-on: ubuntu-latest
16+
runs-on: ubuntu-latest-xl
1717

1818
steps:
1919
- uses: actions/checkout@v3
@@ -23,6 +23,12 @@ jobs:
2323
with:
2424
channel: release
2525

26+
- name: Cache compilation cache
27+
id: query-cache
28+
uses: ./.github/actions/cache-query-compilation
29+
with:
30+
key: atm-suite
31+
2632
- name: Install ATM model
2733
run: |
2834
set -exu
@@ -50,10 +56,13 @@ jobs:
5056
echo "SARIF_PATH=${SARIF_PATH}" >> "${GITHUB_ENV}"
5157
5258
codeql database analyze \
59+
--threads=0 \
60+
--ram 50000 \
5361
--format sarif-latest \
5462
--output "${SARIF_PATH}" \
5563
--sarif-group-rules-by-pack \
5664
-vv \
65+
--compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" \
5766
-- \
5867
"${DB_PATH}" \
5968
"${QUERY_PACK}/${QUERY_SUITE}"

config/identical-files.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -531,11 +531,6 @@
531531
"ruby/ql/lib/codeql/ruby/internal/ConceptsShared.qll",
532532
"javascript/ql/lib/semmle/javascript/internal/ConceptsShared.qll"
533533
],
534-
"Hostname Regexp queries": [
535-
"javascript/ql/src/Security/CWE-020/HostnameRegexpShared.qll",
536-
"python/ql/src/Security/CWE-020/HostnameRegexpShared.qll",
537-
"ruby/ql/src/queries/security/cwe-020/HostnameRegexpShared.qll"
538-
],
539534
"ApiGraphModels": [
540535
"javascript/ql/lib/semmle/javascript/frameworks/data/internal/ApiGraphModels.qll",
541536
"ruby/ql/lib/codeql/ruby/frameworks/data/internal/ApiGraphModels.qll",

cpp/ql/lib/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.4.6
2+
3+
No user-facing changes.
4+
15
## 0.4.5
26

37
No user-facing changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* The `ArgvSource` flow source now uses the second parameter of `main` as its source instead of the uses of this parameter.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.4.6
2+
3+
No user-facing changes.

cpp/ql/lib/codeql-pack.release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
lastReleaseVersion: 0.4.5
2+
lastReleaseVersion: 0.4.6

cpp/ql/lib/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/cpp-all
2-
version: 0.4.6-dev
2+
version: 0.5.0-dev
33
groups: cpp
44
dbscheme: semmlecode.cpp.dbscheme
55
extractor: cpp

cpp/ql/lib/semmle/code/cpp/security/FlowSources.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private class ArgvSource extends LocalFlowSource {
5353
exists(Function main, Parameter argv |
5454
main.hasGlobalName("main") and
5555
main.getParameter(1) = argv and
56-
argv.getAnAccess() in [this.asExpr(), this.asIndirectExpr()]
56+
this.asParameter(_) = argv
5757
)
5858
}
5959

cpp/ql/src/AlertSuppression.ql

Lines changed: 23 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -5,78 +5,35 @@
55
* @id cpp/alert-suppression
66
*/
77

8-
import cpp
9-
10-
/**
11-
* An alert suppression comment.
12-
*/
13-
class SuppressionComment extends Comment {
14-
string annotation;
15-
string text;
16-
17-
SuppressionComment() {
18-
(
19-
this instanceof CppStyleComment and
20-
// strip the beginning slashes
21-
text = this.getContents().suffix(2)
22-
or
23-
this instanceof CStyleComment and
24-
// strip both the beginning /* and the end */ the comment
25-
exists(string text0 |
26-
text0 = this.getContents().suffix(2) and
27-
text = text0.prefix(text0.length() - 2)
28-
) and
29-
// The /* */ comment must be a single-line comment
30-
not text.matches("%\n%")
8+
private import codeql.suppression.AlertSuppression as AS
9+
private import semmle.code.cpp.Element
10+
11+
class SingleLineComment extends Comment {
12+
private string text;
13+
14+
SingleLineComment() {
15+
this instanceof CppStyleComment and
16+
// strip the beginning slashes
17+
text = this.getContents().suffix(2)
18+
or
19+
this instanceof CStyleComment and
20+
// strip both the beginning /* and the end */ the comment
21+
exists(string text0 |
22+
text0 = this.getContents().suffix(2) and
23+
text = text0.prefix(text0.length() - 2)
3124
) and
32-
(
33-
// match `lgtm[...]` anywhere in the comment
34-
annotation = text.regexpFind("(?i)\\blgtm\\s*\\[[^\\]]*\\]", _, _)
35-
or
36-
// match `lgtm` at the start of the comment and after semicolon
37-
annotation = text.regexpFind("(?i)(?<=^|;)\\s*lgtm(?!\\B|\\s*\\[)", _, _).trim()
38-
)
25+
// The /* */ comment must be a single-line comment
26+
not text.matches("%\n%")
3927
}
4028

41-
/** Gets the text in this comment, excluding the leading //. */
42-
string getText() { result = text }
43-
44-
/** Gets the suppression annotation in this comment. */
45-
string getAnnotation() { result = annotation }
46-
47-
/**
48-
* Holds if this comment applies to the range from column `startcolumn` of line `startline`
49-
* to column `endcolumn` of line `endline` in file `filepath`.
50-
*/
51-
predicate covers(string filepath, int startline, int startcolumn, int endline, int endcolumn) {
52-
this.getLocation().hasLocationInfo(filepath, startline, _, endline, endcolumn) and
53-
startcolumn = 1
54-
}
55-
56-
/** Gets the scope of this suppression. */
57-
SuppressionScope getScope() { result = this }
58-
}
59-
60-
/**
61-
* The scope of an alert suppression comment.
62-
*/
63-
class SuppressionScope extends ElementBase instanceof SuppressionComment {
64-
/**
65-
* Holds if this element is at the specified location.
66-
* The location spans column `startcolumn` of line `startline` to
67-
* column `endcolumn` of line `endline` in file `filepath`.
68-
* For more information, see
69-
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
70-
*/
7129
predicate hasLocationInfo(
7230
string filepath, int startline, int startcolumn, int endline, int endcolumn
7331
) {
74-
super.covers(filepath, startline, startcolumn, endline, endcolumn)
32+
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
7533
}
34+
35+
/** Gets the text in this comment, excluding the leading //. */
36+
string getText() { result = text }
7637
}
7738

78-
from SuppressionComment c
79-
select c, // suppression comment
80-
c.getText(), // text of suppression comment (excluding delimiters)
81-
c.getAnnotation(), // text of suppression annotation
82-
c.getScope() // scope of suppression
39+
import AS::Make<SingleLineComment>

cpp/ql/src/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.4.6
2+
3+
No user-facing changes.
4+
15
## 0.4.5
26

37
No user-facing changes.

0 commit comments

Comments
 (0)