8000 Merge branch 'main' into redsun82/cargo-upgrade-3 · github/codeql@823ac5c · GitHub
[go: up one dir, main page]

Skip to content {"props":{"docsUrl":"https://docs.github.com/get-started/accessibility/keyboard-shortcuts"}}

Commit 823ac5c

Browse files
committed
Merge branch 'main' into redsun82/cargo-upgrade-3
2 parents 5162d2c + 13bc0d2 commit 823ac5c

File tree

29 files changed

+297
-867
lines changed

29 files changed

+297
-867
lines changed

java/ql/integration-tests/java/query-suite/java-code-quality-extended.qls.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
ql/java/ql/src/Advisory/Declarations/MissingOverrideAnnotation.ql
2-
ql/java/ql/src/Advisory/Deprecated Code/AvoidDeprecatedCallableAccess.ql
32
ql/java/ql/src/Advisory/Documentation/ImpossibleJavadocThrows.ql
43
ql/java/ql/src/Advisory/Documentation/SpuriousJavadocParam.ql
54
ql/java/ql/src/Compatibility/JDK9/JdkInternalAccess.ql

java/ql/integration-tests/java/query-suite/java-code-quality.qls.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
ql/java/ql/src/Advisory/Declarations/MissingOverrideAnnotation.ql
2-
ql/java/ql/src/Advisory/Deprecated Code/AvoidDeprecatedCallableAccess.ql
32
ql/java/ql/src/Advisory/Documentation/ImpossibleJavadocThrows.ql
43
ql/java/ql/src/Advisory/Documentation/SpuriousJavadocParam.ql
54
ql/java/ql/src/Compatibility/JDK9/JdkInternalAccess.ql

java/ql/src/Advisory/Deprecated Code/AvoidDeprecatedCallableAccess.ql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
* @problem.severity recommendation
77
* @precision high
88
* @id java/deprecated-call
9-
* @tags quality
10-
* maintainability
9+
* @tags maintainability
1110
* readability
1211
* non-attributable
1312
* external/cwe/cwe-477

javascript/ql/lib/semmle/javascript/frameworks/Fastify.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
2-
* Provides classes for working with [Fastify](https://www.fastify.io/) applications.
2+
* Provides classes for working with [Fastify](https://www.fastify.dev/) applications.
33
*/
44

55
import javascript
66
import semmle.javascript.frameworks.HTTP
77

88
/**
9-
* Provides classes for working with [Fastify](https://www.fastify.io/) applications.
9+
* Provides classes for working with [Fastify](https://www.fastify.dev/) applications.
1010
*/
1111
module Fastify {
1212
/**

rust/ql/consistency-queries/PathResolutionConsistency.ql

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,17 @@ private import codeql.rust.internal.PathResolution
1010
private import codeql.rust.internal.PathResolutionConsistency as PathResolutionConsistency
1111
private import codeql.rust.elements.Locatable
1212
private import codeql.Locations
13-
import PathResolutionConsistency
1413

1514
class SourceLocatable extends Locatable {
16-
Location getLocation() {
17-
if super.getLocation().fromSource()
18-
then result = super.getLocation()
19-
else result instanceof EmptyLocation
20-
}
15+
SourceLocatable() { this.fromSource() }
2116
}
2217

23-
query predicate multipleMethodCallTargets(SourceLocatable a, SourceLocatable b) {
24-
PathResolutionConsistency::multipleMethodCallTargets(a, b)
18+
query predicate multipleCallTargets(SourceLocatable a) {
19+
PathResolutionConsistency::multipleCallTargets(a, _)
2520
}
2621

27-
query predicate multiplePathResolutions(SourceLocatable a, SourceLocatable b) {
28-
PathResolutionConsistency::multiplePathResolutions(a, b)
22+
query predicate multiplePathResolutions(SourceLocatable a) {
23+
PathResolutionConsistency::multiplePathResolutions(a, _)
2924
}
3025

3126
query predicate multipleCanonicalPaths(SourceLocatable i, SourceLocatable c, string path) {

rust/ql/lib/codeql/rust/elements/internal/TupleStructPatImpl.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ module Impl {
3434
exists(this.getField(pragma[only_bind_into](pos)))
3535
}
3636

37+
/**
38+
* Gets the struct matched by this pattern.
39+
*/
40+
Struct getStruct() { result = PathResolution::resolvePath(this.getPath()) }
41+
3742
/** Gets the tuple field that matches the `pos`th pattern of this pattern. */
3843
pragma[nomagic]
3944
TupleField getTupleField(int pos) {

rust/ql/lib/codeql/rust/frameworks/Poem.qll

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@
44

55
private import rust
66
private import codeql.rust.Concepts
7-
private import codeql.rust.dataflow.DataFlow
87

98
/**
109
* Parameters of a handler function
1110
*/
1211
private class PoemHandlerParam extends RemoteSource::Range {
1312
PoemHandlerParam() {
1413
exists(TupleStructPat param |
15-
param.getResolvedPath() = ["crate::web::query::Query", "crate::web::path::Path"]
16-
|
17-
this.asPat().getPat() = param.getAField()
14+
this.asPat().getPat() = param.getAField() and
15+
param.getStruct().getCanonicalPath() = ["poem::web::query::Query", "poem::web::path::Path"]
1816
)
1917
}
2018
}

rust/ql/lib/codeql/rust/internal/PathResolutionConsistency.qll

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ query predicate multiplePathResolutions(Path p, ItemNode i) {
1717
not use.isGlob() and
1818
not use.hasUseTreeList()
1919
).getPath() and
20+
// avoid overlap with `multipleCallTargets` below
21+
not p = any(CallExpr ce).getFunction().(PathExpr).getPath() and
2022
strictcount(resolvePath(p)) > 1
2123
}
2224

2325
/** Holds if `call` has multiple static call targets including `target`. */
24-
query predicate multipleMethodCallTargets(MethodCallExpr call, Callable target) {
26+
query predicate multipleCallTargets(CallExprBase call, Callable target) {
2527
target = call.getStaticTarget() and
2628
strictcount(call.getStaticTarget()) > 1
2729
}
@@ -51,8 +53,8 @@ int getPathResolutionInconsistencyCounts(string type) {
5153
type = "Multiple path resolutions" and
5254
result = count(Path p | multiplePathResolutions(p, _) | p)
5355
or
54-
type = "Multiple static method call targets" and
55-
result = count(CallExprBase call | multipleMethodCallTargets(call, _) | call)
56+
type = "Multiple static call targets" and
57+
result = count(CallExprBase call | multipleCallTargets(call, _) | call)
5658
or
5759
type = "Multiple record fields" and
5860
result = count(FieldExpr fe | multipleStructFields(fe, _) | fe)

rust/ql/test/extractor-tests/crate_graph/CONSISTENCY/PathResolutionConsistency.expected

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
multipleCallTargets
2+
| proc_macro.rs:16:12:16:16 | ...::to_tokens(...) |
3+
| proc_macro.rs:26:10:26:12 | ...::to_tokens(...) |
4+
| proc_macro.rs:27:10:27:16 | ...::to_tokens(...) |
5+
| proc_macro.rs:42:16:42:26 | ...::to_tokens(...) |
6+
| proc_macro.rs:44:27:44:30 | ...::to_tokens(...) |
7+
| proc_macro.rs:46:18:46:28 | ...::to_tokens(...) |
18
multiplePathResolutions
2-
| macro_expansion.rs:1:5:1:14 | proc_macro | file://:0:0:0:0 | Crate(proc_macro@0.0.0) |
3-
| macro_expansion.rs:1:5:1:14 | proc_macro | proc_macro.rs:0:0:0:0 | Crate(proc_macro@0.0.1) |
9+
| macro_expansion.rs:1:5:1:14 | proc_macro |

0 commit comments

Comments
 (0)
0