Skip to content

Commit a444bbc

Browse files
author
Paolo Tranquilli
committed
Merge branch 'main' into redsun82/rust-turn-off-ra-resolution
2 parents 9b6f0da + 3487226 commit a444bbc

File tree

362 files changed

+15800
-6120
lines changed

Some content is hidden

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

362 files changed

+15800
-6120
lines changed

.bazelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ common --override_module=semmle_code=%workspace%/misc/bazel/semmle_code_stub
1212

1313
build --repo_env=CC=clang --repo_env=CXX=clang++
1414

15+
# print test output, like sembuild does.
16+
# Set to `errors` if this is too verbose.
17+
test --test_output all
1518
# we use transitions that break builds of `...`, so for `test` to work with that we need the following
1619
test --build_tests_only
1720

.github/workflows/go-tests-other-os.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
pull_request:
44
paths:
55
- "go/**"
6+
- "!go/documentation/**"
67
- "!go/ql/**" # don't run other-os if only ql/ files changed
78
- .github/workflows/go-tests-other-os.yml
89
- .github/actions/**

.github/workflows/go-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
push:
44
paths:
55
- "go/**"
6+
- "!go/documentation/**"
67
- "shared/**"
78
- .github/workflows/go-tests.yml
89
- .github/actions/**
@@ -13,6 +14,7 @@ on:
1314
pull_request:
1415
paths:
1516
- "go/**"
17+
- "!go/documentation/**"
1618
- "shared/**"
1719
- .github/workflows/go-tests.yml
1820
- .github/actions/**

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2006-2020 GitHub, Inc.
3+
Copyright (c) 2006-2025 GitHub, Inc.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

MODULE.bazel

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,12 @@ register_toolchains("@rust_toolchains//:all")
5858
py_deps = use_extension("//misc/bazel/3rdparty:py_deps_extension.bzl", "p")
5959
use_repo(
6060
py_deps,
61-
"vendor__anyhow-1.0.44",
62-
"vendor__cc-1.0.70",
63-
"vendor__clap-2.33.3",
64-
"vendor__regex-1.5.5",
65-
"vendor__smallvec-1.6.1",
66-
"vendor__string-interner-0.12.2",
67-
"vendor__thiserror-1.0.29",
68-
"vendor__tree-sitter-0.20.4",
69-
"vendor__tree-sitter-graph-0.7.0",
61+
"vendor_py__anyhow-1.0.95",
62+
"vendor_py__cc-1.2.14",
63+
"vendor_py__clap-4.5.30",
64+
"vendor_py__regex-1.11.1",
65+
"vendor_py__tree-sitter-0.20.4",
66+
"vendor_py__tree-sitter-graph-0.7.0",
7067
)
7168

7269
# deps for ruby+rust

actions/extractor/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ codeql_pkg_files(
44
name = "extractor",
55
srcs = [
66
"codeql-extractor.yml",
7+
"//:LICENSE",
78
] + glob(["tools/**"]),
89
strip_prefix = strip_prefix.from_pkg(),
910
visibility = ["//actions:__pkg__"],

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ class Location extends @location {
7575

7676
/** Holds if `this` comes on a line strictly before `l`. */
7777
pragma[inline]
78-
predicate isBefore(Location l) { this.isBefore(l, false) }
78+
predicate isBefore(Location l) {
79+
this.getFile() = l.getFile() and
80+
this.getEndLine() < l.getStartLine()
81+
}
7982

8083
/**
8184
* Holds if `this` comes strictly before `l`. The boolean `sameLine` is

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -869,12 +869,11 @@ private predicate elementSpecMatchesSignature(
869869
bindingset[nameWithoutArgs]
870870
pragma[inline_late]
871871
private Class getClassAndNameImpl(Function method, string nameWithoutArgs) {
872-
exists(string memberName | result = method.getClassAndName(memberName) |
873-
nameWithoutArgs = "operator " + method.(ConversionOperator).getDestType()
874-
or
875-
not method instanceof ConversionOperator and
876-
memberName = nameWithoutArgs
877-
)
872+
result = method.getDeclaringType() and
873+
nameWithoutArgs = "operator " + method.(ConversionOperator).getDestType()
874+
or
875+
result = method.getClassAndName(nameWithoutArgs) and
876+
not method instanceof ConversionOperator
878877
}
879878

880879
/**

cpp/ql/src/Security/CWE/CWE-078/ExecTainted.ql

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,17 @@ predicate interestingConcatenation(DataFlow::Node incoming, DataFlow::Node outgo
4949
call.getTarget() = op and
5050
op.hasQualifiedName("std", "operator+") and
5151
op.getType().(UserType).hasQualifiedName("std", "basic_string") and
52-
incoming.asIndirectArgument() = call.getArgument(1) and // left operand
52+
incoming.asIndirectArgument() = call.getArgument(1) and // right operand
5353
call = outgoing.asInstruction().getUnconvertedResultExpression()
5454
)
5555
}
5656

57+
/**
58+
* A state will represent the most recent concatenation that occurred in the data flow.
59+
* - `TConcatState` if the concetenation has not yet occurred.
60+
* - `TExecState(incoming, outgoing)`, representing the concatenation of data from `incoming`
61+
* into result `outgoing`.
62+
*/
5763
newtype TState =
5864
TConcatState() or
5965
TExecState(DataFlow::Node incoming, DataFlow::Node outgoing) {
@@ -74,7 +80,9 @@ class ExecState extends TExecState {
7480

7581
DataFlow::Node getOutgoingNode() { result = outgoing }
7682

77-
/** Holds if this is a possible `ExecState` for `sink`. */
83+
/**
84+
* Holds if this is a possible `ExecState` at `sink`, that is, if `outgoing` flows to `sink`.
85+
*/
7886
predicate isFeasibleForSink(DataFlow::Node sink) { ExecState::flow(outgoing, sink) }
7987

8088
string toString() { result = "ExecState" }
@@ -110,6 +118,12 @@ module ExecStateConfig implements DataFlow::ConfigSig {
110118

111119
module ExecState = TaintTracking::Global<ExecStateConfig>;
112120

121+
/**
122+
* A full `TaintTracking` configuration from source to concatenation to sink, using a flow
123+
* state to remember the concatenation. It's important that we track flow to the sink even though
124+
* as soon as we reach the concatenation we know it will get there (due to the check of
125+
* `isFeasibleForSink`), because this way we get a complete flow path.
126+
*/
113127
module ExecTaintConfig implements DataFlow::StateConfigSig {
114128
class FlowState = TState;
115129

0 commit comments

Comments
 (0)