Skip to content

Commit 5792f7b

Browse files
authored
Merge branch 'main' into jcogs33/unsafe-url-forward-promotion-resource-and-file-methods
2 parents e90f55a + f08e8b1 commit 5792f7b

File tree

1,363 files changed

+101411
-47878
lines changed

Some content is hidden

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

1,363 files changed

+101411
-47878
lines changed

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.0.2
1+
7.1.0
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: "Code scanning - C++"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'rc/*'
8+
pull_request:
9+
branches:
10+
- main
11+
- 'rc/*'
12+
paths:
13+
- 'swift/**'
14+
- '.github/codeql/**'
15+
- '.github/workflows/cpp-swift-analysis.yml'
16+
schedule:
17+
- cron: '0 9 * * 1'
18+
19+
jobs:
20+
CodeQL-Build:
21+
22+
runs-on: ubuntu-latest
23+
24+
permissions:
25+
contents: read
26+
security-events: write
27+
pull-requests: read
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v4
32+
33+
# Initializes the CodeQL tools for scanning.
34+
- name: Initialize CodeQL
35+
uses: github/codeql-action/init@main
36+
# Override language selection by uncommenting this and choosing your languages
37+
with:
38+
languages: cpp
39+
config-file: ./.github/codeql/codeql-config.yml
40+
41+
- name: "[Ubuntu] Remove GCC 13 from runner image"
42+
shell: bash
43+
run: |
44+
sudo rm -f /etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-jammy.list
45+
sudo apt-get update
46+
sudo apt-get install -y --allow-downgrades libc6=2.35-* libc6-dev=2.35-* libstdc++6=12.3.0-* libgcc-s1=12.3.0-*
47+
48+
- name: "Build Swift extractor using Bazel"
49+
run: |
50+
bazel clean --expunge
51+
bazel run //swift:create-extractor-pack --nouse_action_cache --noremote_accept_cached --noremote_upload_local_results --spawn_strategy=local --features=-layering_check
52+
bazel shutdown
53+
54+
- name: Perform CodeQL Analysis
55+
uses: github/codeql-action/analyze@main

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/cpp/ @github/codeql-c-analysis
2+
/cpp/autobuilder/ @github/codeql-c-extractor
23
/csharp/ @github/codeql-csharp
34
/go/ @github/codeql-go
45
/java/ @github/codeql-java

codeql-workspace.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ provide:
66
- "*/ql/consistency-queries/qlpack.yml"
77
- "*/ql/automodel/src/qlpack.yml"
88
- "*/ql/automodel/test/qlpack.yml"
9+
- "python/extractor/qlpack.yml"
910
- "shared/**/qlpack.yml"
1011
- "cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/tainted/qlpack.yml"
1112
- "go/ql/config/legacy-support/qlpack.yml"
@@ -27,7 +28,6 @@ provide:
2728
- "misc/suite-helpers/qlpack.yml"
2829
- "ruby/extractor-pack/codeql-extractor.yml"
2930
- "swift/extractor-pack/codeql-extractor.yml"
30-
- "swift/integration-tests/qlpack.yml"
3131
- "ql/extractor-pack/codeql-extractor.yml"
3232
- ".github/codeql/extensions/**/codeql-pack.yml"
3333

config/identical-files.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,6 @@
251251
"cpp/ql/src/Security/CWE/CWE-020/SafeExternalAPIFunction.qll",
252252
"cpp/ql/src/Security/CWE/CWE-020/ir/SafeExternalAPIFunction.qll"
253253
],
254-
"XML": [
255-
"cpp/ql/lib/semmle/code/cpp/XML.qll",
256-
"csharp/ql/lib/semmle/code/csharp/XML.qll",
257-
"java/ql/lib/semmle/code/xml/XML.qll",
258-
"javascript/ql/lib/semmle/javascript/XML.qll",
259-
"python/ql/lib/semmle/python/xml/XML.qll"
260-
],
261254
"DuplicationProblems.inc.qhelp": [
262255
"cpp/ql/src/Metrics/Files/DuplicationProblems.inc.qhelp",
263256
"javascript/ql/src/Metrics/DuplicationProblems.inc.qhelp",
@@ -372,4 +365,4 @@
372365
"python/ql/test/experimental/dataflow/model-summaries/InlineTaintTest.ext.yml",
373366
"python/ql/test/experimental/dataflow/model-summaries/NormalDataflowTest.ext.yml"
374367
]
375-
}
368+
}

cpp/autobuilder/Semmle.Autobuild.Cpp.Tests/BuildScripts.cs

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ internal class TestDiagnosticWriter : IDiagnosticsWriter
203203
public IList<DiagnosticMessage> Diagnostics { get; } = new List<DiagnosticMessage>();
204204

205205
public void AddEntry(DiagnosticMessage message) => this.Diagnostics.Add(message);
206+
207+
public void Dispose() { }
206208
}
207209

208210
/// <summary>
@@ -250,12 +252,7 @@ void EndCallback(int ret, string s, bool silent)
250252
EndCallbackIn.Add(s);
251253
}
252254

253-
CppAutobuilder CreateAutoBuilder(bool isWindows,
254-
string? buildless = null, string? solution = null, string? buildCommand = null, string? ignoreErrors = null,
255-
string? msBuildArguments = null, string? msBuildPlatform = null, string? msBuildConfiguration = null, string? msBuildTarget = null,
256-
string? dotnetArguments = null, string? dotnetVersion = null, string? vsToolsVersion = null,
257-
string? nugetRestore = null, string? allSolutions = null,
258-
string cwd = @"C:\Project")
255+
CppAutobuilder CreateAutoBuilder(bool isWindows, string? dotnetVersion = null, string cwd = @"C:\Project")
259256
{
260257
string codeqlUpperLanguage = Language.Cpp.UpperCaseName;
261258
Actions.GetEnvironmentVariable[$"CODEQL_AUTOBUILDER_{codeqlUpperLanguage}_NO_INDEXING"] = "false";
@@ -265,22 +262,7 @@ CppAutobuilder CreateAutoBuilder(bool isWindows,
265262
Actions.GetEnvironmentVariable[$"CODEQL_EXTRACTOR_{codeqlUpperLanguage}_DIAGNOSTIC_DIR"] = "";
266263
Actions.GetEnvironmentVariable["CODEQL_JAVA_HOME"] = @"C:\codeql\tools\java";
267264
Actions.GetEnvironmentVariable["CODEQL_PLATFORM"] = "win64";
268-
Actions.GetEnvironmentVariable["SEMMLE_DIST"] = @"C:\odasa";
269-
Actions.GetEnvironmentVariable["SEMMLE_JAVA_HOME"] = @"C:\odasa\tools\java";
270-
Actions.GetEnvironmentVariable["SEMMLE_PLATFORM_TOOLS"] = @"C:\odasa\tools";
271-
Actions.GetEnvironmentVariable["LGTM_INDEX_VSTOOLS_VERSION"] = vsToolsVersion;
272-
Actions.GetEnvironmentVariable["LGTM_INDEX_MSBUILD_ARGUMENTS"] = msBuildArguments;
273-
Actions.GetEnvironmentVariable["LGTM_INDEX_MSBUILD_PLATFORM"] = msBuildPlatform;
274-
Actions.GetEnvironmentVariable["LGTM_INDEX_MSBUILD_CONFIGURATION"] = msBuildConfiguration;
275-
Actions.GetEnvironmentVariable["LGTM_INDEX_MSBUILD_TARGET"] = msBuildTarget;
276-
Actions.GetEnvironmentVariable["LGTM_INDEX_DOTNET_ARGUMENTS"] = dotnetArguments;
277-
Actions.GetEnvironmentVariable["LGTM_INDEX_DOTNET_VERSION"] = dotnetVersion;
278-
Actions.GetEnvironmentVariable["LGTM_INDEX_BUILD_COMMAND"] = buildCommand;
279-
Actions.GetEnvironmentVariable["LGTM_INDEX_SOLUTION"] = solution;
280-
Actions.GetEnvironmentVariable["LGTM_INDEX_IGNORE_ERRORS"] = ignoreErrors;
281-
Actions.GetEnvironmentVariable["LGTM_INDEX_BUILDLESS"] = buildless;
282-
Actions.GetEnvironmentVariable["LGTM_INDEX_ALL_SOLUTIONS"] = allSolutions;
283-
Actions.GetEnvironmentVariable["LGTM_INDEX_NUGET_RESTORE"] = nugetRestore;
265+
Actions.GetEnvironmentVariable["CODEQL_EXTRACTOR_CSHARP_OPTION_DOTNET_VERSION"] = dotnetVersion;
284266
Actions.GetEnvironmentVariable["ProgramFiles(x86)"] = isWindows ? @"C:\Program Files (x86)" : null;
285267
Actions.GetCurrentDirectory = cwd;
286268
Actions.IsWindows = isWindows;

cpp/autobuilder/Semmle.Autobuild.Cpp/CppAutobuilder.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ public class CppAutobuilder : Autobuilder<CppAutobuildOptions>
2626

2727
public override BuildScript GetBuildScript()
2828
{
29-
if (Options.BuildCommand != null)
30-
return new BuildCommandRule((_, f) => f(null)).Analyse(this, false);
31-
3229
return
3330
// First try MSBuild
3431
new MsBuildRule().Analyse(this, true) |

cpp/autobuilder/Semmle.Autobuild.Cpp/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ static int Main()
1717
try
1818
{
1919
Console.WriteLine("CodeQL C++ autobuilder");
20-
var builder = new CppAutobuilder(actions, options);
20+
using var builder = new CppAutobuilder(actions, options);
2121
return builder.AttemptBuild();
2222
}
2323
catch (InvalidEnvironmentException ex)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Expr extends @expr {
2+
string toString() { none() }
3+
}
4+
5+
from Expr reuse, Expr original
6+
where expr_reuse(reuse, original, _)
7+
select reuse, original
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
class Expr extends @expr {
2+
string toString() { none() }
3+
}
4+
5+
class Type extends @type {
6+
string toString() { none() }
7+
}
8+
9+
predicate existingType(Expr expr, Type type, int value_category) {
10+
expr_types(expr, type, value_category)
11+
}
12+
13+
predicate reuseType(Expr reuse, Type type, int value_category) {
14+
exists(Expr original |
15+
expr_reuse(reuse, original, value_category) and
16+
expr_types(original, type, _)
17+
)
18+
}
19+
20+
from Expr expr, Type type, int value_category
21+
where existingType(expr, type, value_category) or reuseType(expr, type, value_category)
22+
select expr, type, value_category

0 commit comments

Comments
 (0)