Skip to content

Commit 5728e3e

Browse files
committed
Merge branch 'main' into equiv
2 parents 57f429e + b77923f commit 5728e3e

File tree

112 files changed

+6080
-133
lines changed

Some content is hidden

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

112 files changed

+6080
-133
lines changed

.github/workflows/close-stale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- uses: actions/stale@v6
15+
- uses: actions/stale@v7
1616
with:
1717
repo-token: ${{ secrets.GITHUB_TOKEN }}
1818
stale-issue-message: 'This issue is stale because it has been open 14 days with no activity. Comment or remove the `Stale` label in order to avoid having this issue closed in 7 days.'

cpp/ql/src/AlertSuppression.ql

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,18 @@
55
* @id cpp/alert-suppression
66
*/
77

8-
private import codeql.suppression.AlertSuppression as AS
8+
private import codeql.util.suppression.AlertSuppression as AS
99
private import semmle.code.cpp.Element
1010

11-
class SingleLineComment extends Comment {
11+
class AstNode extends Locatable {
12+
predicate hasLocationInfo(
13+
string filepath, int startline, int startcolumn, int endline, int endcolumn
14+
) {
15+
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
16+
}
17+
}
18+
19+
class SingleLineComment extends Comment, AstNode {
1220
private string text;
1321

1422
SingleLineComment() {
@@ -26,14 +34,8 @@ class SingleLineComment extends Comment {
2634
not text.matches("%\n%")
2735
}
2836

29-
predicate hasLocationInfo(
30-
string filepath, int startline, int startcolumn, int endline, int endcolumn
31-
) {
32-
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
33-
}
34-
3537
/** Gets the text in this comment, excluding the leading //. */
3638
string getText() { result = text }
3739
}
3840

39-
import AS::Make<SingleLineComment>
41+
import AS::Make<AstNode, SingleLineComment>
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 `AlertSuppression.ql` query has been updated to support the new `// codeql[query-id]` supression comments. These comments can be used to suppress an alert and must be placed on a blank line before the alert. In addition the legacy `// lgtm` and `// lgtm[query-id]` comments can now also be place on the line before an alert.

cpp/ql/test/query-tests/AlertSuppression/AlertSuppression.expected

Lines changed: 64 additions & 0 deletions
Large diffs are not rendered by default.

cpp/ql/test/query-tests/AlertSuppression/tst.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,11 @@ int x = 0; // lgtm
3434
3535
*/
3636
/* lgtm[@tag:nullness,js/invocation-of-non-function] */
37-
/* lgtm[@tag:nullness] */
37+
/* lgtm[@tag:nullness] */
38+
// codeql[js/debugger-statement]
39+
// CODEQL[js/debugger-statement]
40+
// codeql[js/debugger-statement] -- because I know better than codeql
41+
/* codeql[js/debugger-statement] */
42+
/* codeql[js/debugger-statement]
43+
*/
44+
int y; // codeql[js/debugger-statement]

cpp/ql/test/query-tests/AlertSuppression/tstWindows.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,11 @@ int x = 0; // lgtm
3434
3535
*/
3636
/* lgtm[@tag:nullness,js/invocation-of-non-function] */
37-
/* lgtm[@tag:nullness] */
37+
/* lgtm[@tag:nullness] */
38+
// codeql[js/debugger-statement]
39+
// CODEQL[js/debugger-statement]
40+
// codeql[js/debugger-statement] -- because I know better than codeql
41+
/* codeql[js/debugger-statement] */
42+
/* codeql[js/debugger-statement]
43+
*/
44+
int y; // codeql[js/debugger-statement]

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,12 @@ module Public {
260260
* Holds if the neutral is auto generated.
261261
*/
262262
predicate isAutoGenerated() { neutralElement(this, true) }
263+
264+
/**
265+
* Holds if the neutral has the given provenance where `true` is
266+
* `generated` and `false` is `manual`.
267+
*/
268+
predicate hasProvenance(boolean generated) { neutralElement(this, generated) }
263269
}
264270
}
265271

csharp/ql/src/AlertSuppression.ql

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,17 @@
55
* @id cs/alert-suppression
66
*/
77

8-
private import codeql.suppression.AlertSuppression as AS
8+
private import codeql.util.suppression.AlertSuppression as AS
99
private import semmle.code.csharp.Comments
1010

11+
class AstNode extends Element {
12+
predicate hasLocationInfo(
13+
string filepath, int startline, int startcolumn, int endline, int endcolumn
14+
) {
15+
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
16+
}
17+
}
18+
1119
class SingleLineComment extends CommentLine {
1220
SingleLineComment() {
1321
// Must be either `// ...` or `/* ... */` on a single line.
@@ -21,4 +29,4 @@ class SingleLineComment extends CommentLine {
2129
}
2230
}
2331

24-
import AS::Make<SingleLineComment>
32+
import AS::Make<AstNode, SingleLineComment>
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 `AlertSuppression.ql` query has been updated to support the new `// codeql[query-id]` supression comments. These comments can be used to suppress an alert and must be placed on a blank line before the alert. In addition the legacy `// lgtm` and `// lgtm[query-id]` comments can now also be place on the line before an alert.

csharp/ql/test/query-tests/AlertSuppression/AlertSuppression.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,11 @@ class Dead { } // lgtm
2626
// LGTM[cs/unused-reftype]
2727
// lgtm[cs/unused-reftype] and lgtm[cs/unused-field]
2828
// lgtm[cs/unused-reftype]; lgtm
29+
// codeql[js/debugger-statement]
30+
// CODEQL[js/debugger-statement]
31+
// codeql[js/debugger-statement] -- because I know better than codeql
32+
/* codeql[js/debugger-statement] */
33+
/* codeql[js/debugger-statement]
34+
*/
35+
class End { } // codeql[js/debugger-statement]
36+

0 commit comments

Comments
 (0)