Skip to content

Commit edb273a

Browse files
committed
Merge remote-tracking branch 'origin/jorgectf/python/ldapimproperauth' into jorgectf/python/ldapinsecureauth
2 parents 957b3e1 + 2f9e645 commit edb273a

File tree

2,663 files changed

+93560
-33240
lines changed

Some content is hidden

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

2,663 files changed

+93560
-33240
lines changed

.codeqlmanifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{ "provide": [ "*/ql/src/qlpack.yml",
22
"*/ql/test/qlpack.yml",
3+
"cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/tainted/qlpack.yml",
34
"*/ql/examples/qlpack.yml",
45
"*/upgrades/qlpack.yml",
56
"misc/legacy-support/*/qlpack.yml",

.github/workflows/check-change-note.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: Check change note
2+
13
on:
24
pull_request_target:
35
types: [labeled, unlabeled, opened, synchronize, reopened, ready_for_review]
@@ -17,5 +19,5 @@ jobs:
1719
env:
1820
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1921
run: |
20-
gh api 'repos/${{github.repository}}/pulls/${{github.event.number}}/files' --paginate |
21-
jq 'any(.[].filename ; test("/change-notes/.*[.]md$"))' --exit-status
22+
gh api 'repos/${{github.repository}}/pulls/${{github.event.number}}/files' --paginate --jq 'any(.[].filename ; test("/change-notes/.*[.]md$"))' |
23+
grep true -c

.github/workflows/close-stale.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Mark stale issues
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "30 1 * * *"
7+
8+
jobs:
9+
stale:
10+
if: github.repository == 'github/codeql'
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/stale@v3
16+
with:
17+
repo-token: ${{ secrets.GITHUB_TOKEN }}
18+
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.'
19+
close-issue-message: 'This issue was closed because it has been inactive for 7 days.'
20+
days-before-stale: 14
21+
days-before-close: 7
22+
only-labels: awaiting-response
23+
24+
# do not mark PRs as stale
25+
days-before-pr-stale: -1
26+
days-before-pr-close: -1
27+
28+
# Uncomment for dry-run
29+
# debug-only: true
30+
# operations-per-run: 1000

.github/workflows/codeql-analysis.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,18 @@ jobs:
1919

2020
runs-on: ubuntu-latest
2121

22+
permissions:
23+
contents: read
24+
security-events: write
25+
pull-requests: read
26+
2227
steps:
2328
- name: Checkout repository
2429
uses: actions/checkout@v2
2530

2631
# Initializes the CodeQL tools for scanning.
2732
- name: Initialize CodeQL
28-
uses: github/codeql-action/init@v1
33+
uses: github/codeql-action/init@main
2934
# Override language selection by uncommenting this and choosing your languages
3035
with:
3136
languages: csharp
@@ -34,7 +39,7 @@ jobs:
3439
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
3540
# If this step fails, then you should remove it and run the build manually (see below)
3641
- name: Autobuild
37-
uses: github/codeql-action/autobuild@v1
42+
uses: github/codeql-action/autobuild@main
3843

3944
# ℹ️ Command-line programs to run using the OS shell.
4045
# 📚 https://git.io/JvXDl
@@ -48,4 +53,4 @@ jobs:
4853
# make release
4954

5055
- name: Perform CodeQL Analysis
51-
uses: github/codeql-action/analyze@v1
56+
uses: github/codeql-action/analyze@main

.github/workflows/csv-coverage.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Build/check CSV flow coverage report
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
qlModelShaOverride:
7+
description: 'github/codeql repo SHA used for looking up the CSV models'
8+
required: false
9+
push:
10+
branches:
11+
- main
12+
- 'rc/**'
13+
pull_request:
14+
paths:
15+
- '.github/workflows/csv-coverage.yml'
16+
- '*/ql/src/**/*.ql'
17+
- '*/ql/src/**/*.qll'
18+
- 'misc/scripts/library-coverage/*.py'
19+
# input data files
20+
- '*/documentation/library-coverage/cwe-sink.csv'
21+
- '*/documentation/library-coverage/frameworks.csv'
22+
# coverage report files
23+
- '*/documentation/library-coverage/flow-model-coverage.csv'
24+
- '*/documentation/library-coverage/flow-model-coverage.rst'
25+
26+
jobs:
27+
build:
28+
29+
runs-on: ubuntu-latest
30+
31+
steps:
32+
- name: Clone self (github/codeql)
33+
uses: actions/checkout@v2
34+
with:
35+
path: script
36+
- name: Clone self (github/codeql) at a given SHA for analysis
37+
if: github.event.inputs.qlModelShaOverride != ''
38+
uses: actions/checkout@v2
39+
with:
40+
path: codeqlModels
41+
ref: github.event.inputs.qlModelShaOverride
42+
- name: Clone self (github/codeql) for analysis
43+
if: github.event.inputs.qlModelShaOverride == ''
44+
uses: actions/checkout@v2
45+
with:
46+
path: codeqlModels
47+
- name: Set up Python 3.8
48+
uses: actions/setup-python@v2
49+
with:
50+
python-version: 3.8
51+
- name: Download CodeQL CLI
52+
uses: dsaltares/fetch-gh-release-asset@aa37ae5c44d3c9820bc12fe675e8670ecd93bd1c
53+
with:
54+
repo: "github/codeql-cli-binaries"
55+
version: "latest"
56+
file: "codeql-linux64.zip"
57+
token: ${{ secrets.GITHUB_TOKEN }}
58+
- name: Unzip CodeQL CLI
59+
run: unzip -d codeql-cli codeql-linux64.zip
60+
- name: Build modeled package list
61+
run: |
62+
PATH="$PATH:codeql-cli/codeql" python script/misc/scripts/library-coverage/generate-report.py ci codeqlModels script
63+
- name: Upload CSV package list
64+
uses: actions/upload-artifact@v2
65+
with:
66+
name: csv-flow-model-coverage
67+
path: flow-model-coverage-*.csv
68+
- name: Upload RST package list
69+
uses: actions/upload-artifact@v2
70+
with:
71+
name: rst-flow-model-coverage
72+
path: flow-model-coverage-*.rst
73+
# - name: Check coverage files
74+
# if: github.event.pull_request
75+
# run: |
76+
# python script/misc/scripts/library-coverage/compare-files.py codeqlModels
77+

.github/workflows/docs-review.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

config/identical-files.json

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl3.qll",
66
"java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl4.qll",
77
"java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl5.qll",
8+
"java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl6.qll",
89
"cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll",
910
"cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll",
1011
"cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll",
@@ -36,6 +37,7 @@
3637
"cpp/ql/src/semmle/code/cpp/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
3738
"cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
3839
"cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
40+
"cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/tainttracking3/TaintTrackingImpl.qll",
3941
"csharp/ql/src/semmle/code/csharp/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
4042
"csharp/ql/src/semmle/code/csharp/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
4143
"csharp/ql/src/semmle/code/csharp/dataflow/internal/tainttracking3/TaintTrackingImpl.qll",
@@ -55,6 +57,10 @@
5557
"csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImplConsistency.qll",
5658
"python/ql/src/semmle/python/dataflow/new/internal/DataFlowImplConsistency.qll"
5759
],
60+
"DataFlow Java/C# Flow Summaries": [
61+
"java/ql/src/semmle/code/java/dataflow/internal/FlowSummaryImpl.qll",
62+
"csharp/ql/src/semmle/code/csharp/dataflow/internal/FlowSummaryImpl.qll"
63+
],
5864
"SsaReadPosition Java/C#": [
5965
"java/ql/src/semmle/code/java/dataflow/internal/rangeanalysis/SsaReadPositionCommon.qll",
6066
"csharp/ql/src/semmle/code/csharp/dataflow/internal/rangeanalysis/SsaReadPositionCommon.qll"
@@ -244,6 +250,10 @@
244250
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/AliasAnalysis.qll",
245251
"csharp/ql/src/experimental/ir/implementation/unaliased_ssa/internal/AliasAnalysis.qll"
246252
],
253+
"SSA PrintAliasAnalysis": [
254+
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/PrintAliasAnalysis.qll",
255+
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/PrintAliasAnalysis.qll"
256+
],
247257
"C++ SSA AliasAnalysisImports": [
248258
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/AliasAnalysisImports.qll",
249259
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/AliasAnalysisImports.qll"
@@ -376,7 +386,6 @@
376386
],
377387
"DuplicationProblems.inc.qhelp": [
378388
"cpp/ql/src/Metrics/Files/DuplicationProblems.inc.qhelp",
379-
"csharp/ql/src/Metrics/Files/DuplicationProblems.inc.qhelp",
380389
"javascript/ql/src/Metrics/DuplicationProblems.inc.qhelp",
381390
"python/ql/src/Metrics/DuplicationProblems.inc.qhelp"
382391
],
@@ -429,10 +438,15 @@
429438
"SSA C#": [
430439
"csharp/ql/src/semmle/code/csharp/dataflow/internal/SsaImplCommon.qll",
431440
"csharp/ql/src/semmle/code/csharp/controlflow/internal/pressa/SsaImplCommon.qll",
432-
"csharp/ql/src/semmle/code/csharp/dataflow/internal/basessa/SsaImplCommon.qll"
441+
"csharp/ql/src/semmle/code/csharp/dataflow/internal/basessa/SsaImplCommon.qll",
442+
"csharp/ql/src/semmle/code/cil/internal/SsaImplCommon.qll"
433443
],
434444
"CryptoAlgorithms Python/JS": [
435445
"javascript/ql/src/semmle/javascript/security/CryptoAlgorithms.qll",
436-
"python/ql/src/semmle/crypto/Crypto.qll"
446+
"python/ql/src/semmle/python/concepts/CryptoAlgorithms.qll"
447+
],
448+
"SensitiveDataHeuristics Python/JS": [
449+
"javascript/ql/src/semmle/javascript/security/internal/SensitiveDataHeuristics.qll",
450+
"python/ql/src/semmle/python/security/internal/SensitiveDataHeuristics.qll"
437451
]
438452
}

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

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Linq;
66
using Microsoft.Build.Construction;
77
using System.Xml;
8+
using System.IO;
89

910
namespace Semmle.Autobuild.Cpp.Tests
1011
{
@@ -43,6 +44,8 @@ bool IBuildActions.FileExists(string file)
4344
public IDictionary<string, int> RunProcess = new Dictionary<string, int>();
4445
public IDictionary<string, string> RunProcessOut = new Dictionary<string, string>();
4546
public IDictionary<string, string> RunProcessWorkingDirectory = new Dictionary<string, string>();
47+
public HashSet<string> CreateDirectories { get; } = new HashSet<string>();
48+
public HashSet<(string, string)> DownloadFiles { get; } = new HashSet<(string, string)>();
4649

4750
int IBuildActions.RunProcess(string cmd, string args, string? workingDirectory, IDictionary<string, string>? env, out IList<string> stdOut)
4851
{
@@ -135,6 +138,14 @@ string IBuildActions.PathCombine(params string[] parts)
135138

136139
string IBuildActions.GetFullPath(string path) => path;
137140

141+
string? IBuildActions.GetFileName(string? path) => Path.GetFileName(path?.Replace('\\', '/'));
142+
143+
public string? GetDirectoryName(string? path)
144+
{
145+
var dir = Path.GetDirectoryName(path?.Replace('\\', '/'));
146+
return dir is null ? path : path?.Substring(0, dir.Length);
147+
}
148+
138149
void IBuildActions.WriteAllText(string filename, string contents)
139150
{
140151
}
@@ -153,6 +164,18 @@ public string EnvironmentExpandEnvironmentVariables(string s)
153164
s = s.Replace($"%{kvp.Key}%", kvp.Value);
154165
return s;
155166
}
167+
168+
public void CreateDirectory(string path)
169+
{
170+
if (!CreateDirectories.Contains(path))
171+
throw new ArgumentException($"Missing CreateDirectory, {path}");
172+
}
173+
174+
public void DownloadFile(string address, string fileName)
175+
{
176+
if (!DownloadFiles.Contains((address, fileName)))
177+
throw new ArgumentException($"Missing DownloadFile, {address}, {fileName}");
178+
}
156179
}
157180

158181
/// <summary>
@@ -213,6 +236,7 @@ CppAutobuilder CreateAutoBuilder(bool isWindows,
213236
Actions.GetEnvironmentVariable[$"CODEQL_EXTRACTOR_{codeqlUpperLanguage}_SOURCE_ARCHIVE_DIR"] = "";
214237
Actions.GetEnvironmentVariable[$"CODEQL_EXTRACTOR_{codeqlUpperLanguage}_ROOT"] = $@"C:\codeql\{codeqlUpperLanguage.ToLowerInvariant()}";
215238
Actions.GetEnvironmentVariable["CODEQL_JAVA_HOME"] = @"C:\codeql\tools\java";
239+
Actions.GetEnvironmentVariable["CODEQL_PLATFORM"] = "win64";
216240
Actions.GetEnvironmentVariable["SEMMLE_DIST"] = @"C:\odasa";
217241
Actions.GetEnvironmentVariable["SEMMLE_JAVA_HOME"] = @"C:\odasa\tools\java";
218242
Actions.GetEnvironmentVariable["SEMMLE_PLATFORM_TOOLS"] = @"C:\odasa\tools";
@@ -273,7 +297,8 @@ public void TestDefaultCppAutobuilder()
273297
[Fact]
274298
public void TestCppAutobuilderSuccess()
275299
{
276-
Actions.RunProcess[@"cmd.exe /C C:\odasa\tools\csharp\nuget\nuget.exe restore C:\Project\test.sln"] = 1;
300+
Actions.RunProcess[@"cmd.exe /C nuget restore C:\Project\test.sln -DisableParallelProcessing"] = 1;
301+
Actions.RunProcess[@"cmd.exe /C C:\Project\.nuget\nuget.exe restore C:\Project\test.sln -DisableParallelProcessing"] = 0;
277302
Actions.RunProcess[@"cmd.exe /C CALL ^""C:\Program Files ^(x86^)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat^"" && set Platform=&& type NUL && C:\odasa\tools\odasa index --auto msbuild C:\Project\test.sln /p:UseSharedCompilation=false /t:rebuild /p:Platform=""x86"" /p:Configuration=""Release"" /p:MvcBuildViews=true"] = 0;
278303
Actions.RunProcessOut[@"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe -prerelease -legacy -property installationPath"] = "";
279304
Actions.RunProcess[@"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe -prerelease -legacy -property installationPath"] = 1;
@@ -286,11 +311,13 @@ public void TestCppAutobuilderSuccess()
286311
Actions.FileExists[@"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"] = true;
287312
Actions.EnumerateFiles[@"C:\Project"] = "foo.cs\ntest.slx";
288313
Actions.EnumerateDirectories[@"C:\Project"] = "";
314+
Actions.CreateDirectories.Add(@"C:\Project\.nuget");
315+
Actions.DownloadFiles.Add(("https://dist.nuget.org/win-x86-commandline/latest/nuget.exe", @"C:\Project\.nuget\nuget.exe"));
289316

290317
var autobuilder = CreateAutoBuilder(true);
291318
var solution = new TestSolution(@"C:\Project\test.sln");
292319
autobuilder.ProjectsOrSolutionsToBuild.Add(solution);
293-
TestAutobuilderScript(autobuilder, 0, 2);
320+
TestAutobuilderScript(autobuilder, 0, 3);
294321
}
295322
}
296323
}

cpp/autobuilder/Semmle.Autobuild.Cpp/Semmle.Autobuild.Cpp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</ItemGroup>
1818

1919
<ItemGroup>
20-
<PackageReference Include="Microsoft.Build" Version="16.0.461" />
20+
<PackageReference Include="Microsoft.Build" Version="16.9.0" />
2121
</ItemGroup>
2222

2323
<ItemGroup>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lgtm
2+
* The `cpp/tainted-arithmetic`, `cpp/arithmetic-with-extreme-values`, and `cpp/uncontrolled-arithmetic` queries now recognize more functions as returning the absolute value of their input. As a result, they produce fewer false positives.

0 commit comments

Comments
 (0)