Skip to content

Commit 54ced06

Browse files
authored
Merge branch 'main' into python/captured-variables-for-typetracking
2 parents 00b85cb + 246d904 commit 54ced06

File tree

186 files changed

+30130
-23197
lines changed

Some content is hidden

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

186 files changed

+30130
-23197
lines changed

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3031,6 +3031,17 @@ module Impl<FullStateConfigSig Config> {
30313031
this instanceof PathNodeSinkGroup
30323032
}
30333033

3034+
private string ppType() {
3035+
this instanceof PathNodeSink and result = ""
3036+
or
3037+
this.(PathNodeMid).getAp() instanceof AccessPathNil and result = ""
3038+
or
3039+
exists(DataFlowType t | t = this.(PathNodeMid).getAp().getHead().getContainerType() |
3040+
// The `concat` becomes "" if `ppReprType` has no result.
3041+
result = concat(" : " + ppReprType(t))
3042+
)
3043+
}
3044+
30343045
private string ppAp() {
30353046
this instanceof PathNodeSink and result = ""
30363047
or
@@ -3046,14 +3057,14 @@ module Impl<FullStateConfigSig Config> {
30463057
}
30473058

30483059
/** Gets a textual representation of this element. */
3049-
string toString() { result = this.getNodeEx().toString() + this.ppAp() }
3060+
string toString() { result = this.getNodeEx().toString() + this.ppType() + this.ppAp() }
30503061

30513062
/**
30523063
* Gets a textual representation of this element, including a textual
30533064
* representation of the call context.
30543065
*/
30553066
string toStringWithContext() {
3056-
result = this.getNodeEx().toString() + this.ppAp() + this.ppCtx()
3067+
result = this.getNodeEx().toString() + this.ppType() + this.ppAp() + this.ppCtx()
30573068
}
30583069

30593070
/**
@@ -3998,14 +4009,14 @@ module Impl<FullStateConfigSig Config> {
39984009
*/
39994010
class PartialPathNode extends TPartialPathNode {
40004011
/** Gets a textual representation of this element. */
4001-
string toString() { result = this.getNodeEx().toString() + this.ppAp() }
4012+
string toString() { result = this.getNodeEx().toString() + this.ppType() + this.ppAp() }
40024013

40034014
/**
40044015
* Gets a textual representation of this element, including a textual
40054016
* representation of the call context.
40064017
*/
40074018
string toStringWithContext() {
4008-
result = this.getNodeEx().toString() + this.ppAp() + this.ppCtx()
4019+
result = this.getNodeEx().toString() + this.ppType() + this.ppAp() + this.ppCtx()
40094020
}
40104021

40114022
/**
@@ -4046,6 +4057,19 @@ module Impl<FullStateConfigSig Config> {
40464057
*/
40474058
int getSinkDistance() { result = distSink(this.getNodeEx().getEnclosingCallable()) }
40484059

4060+
private string ppType() {
4061+
this instanceof PartialPathNodeRev and result = ""
4062+
or
4063+
this.(PartialPathNodeFwd).getAp() instanceof PartialAccessPathNil and result = ""
4064+
or
4065+
exists(DataFlowType t |
4066+
t = this.(PartialPathNodeFwd).getAp().(PartialAccessPathCons).getType()
4067+
|
4068+
// The `concat` becomes "" if `ppReprType` has no result.
4069+
result = concat(" : " + ppReprType(t))
4070+
)
4071+
}
4072+
40494073
private string ppAp() {
40504074
exists(string s |
40514075
s = this.(PartialPathNodeFwd).getAp().toString() or

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3031,6 +3031,17 @@ module Impl<FullStateConfigSig Config> {
30313031
this instanceof PathNodeSinkGroup
30323032
}
30333033

3034+
private string ppType() {
3035+
this instanceof PathNodeSink and result = ""
3036+
or
3037+
this.(PathNodeMid).getAp() instanceof AccessPathNil and result = ""
3038+
or
3039+
exists(DataFlowType t | t = this.(PathNodeMid).getAp().getHead().getContainerType() |
3040+
// The `concat` becomes "" if `ppReprType` has no result.
3041+
result = concat(" : " + ppReprType(t))
3042+
)
3043+
}
3044+
30343045
private string ppAp() {
30353046
this instanceof PathNodeSink and result = ""
30363047
or
@@ -3046,14 +3057,14 @@ module Impl<FullStateConfigSig Config> {
30463057
}
30473058

30483059
/** Gets a textual representation of this element. */
3049-
string toString() { result = this.getNodeEx().toString() + this.ppAp() }
3060+
string toString() { result = this.getNodeEx().toString() + this.ppType() + this.ppAp() }
30503061

30513062
/**
30523063
* Gets a textual representation of this element, including a textual
30533064
* representation of the call context.
30543065
*/
30553066
string toStringWithContext() {
3056-
result = this.getNodeEx().toString() + this.ppAp() + this.ppCtx()
3067+
result = this.getNodeEx().toString() + this.ppType() + this.ppAp() + this.ppCtx()
30573068
}
30583069

30593070
/**
@@ -3998,14 +4009,14 @@ module Impl<FullStateConfigSig Config> {
39984009
*/
39994010
class PartialPathNode extends TPartialPathNode {
40004011
/** Gets a textual representation of this element. */
4001-
string toString() { result = this.getNodeEx().toString() + this.ppAp() }
4012+
string toString() { result = this.getNodeEx().toString() + this.ppType() + this.ppAp() }
40024013

40034014
/**
40044015
* Gets a textual representation of this element, including a textual
40054016
* representation of the call context.
40064017
*/
40074018
string toStringWithContext() {
4008-
result = this.getNodeEx().toString() + this.ppAp() + this.ppCtx()
4019+
result = this.getNodeEx().toString() + this.ppType() + this.ppAp() + this.ppCtx()
40094020
}
40104021

40114022
/**
@@ -4046,6 +4057,19 @@ module Impl<FullStateConfigSig Config> {
40464057
*/
40474058
int getSinkDistance() { result = distSink(this.getNodeEx().getEnclosingCallable()) }
40484059

4060+
private string ppType() {
4061+
this instanceof PartialPathNodeRev and result = ""
4062+
or
4063+
this.(PartialPathNodeFwd).getAp() instanceof PartialAccessPathNil and result = ""
4064+
or
4065+
exists(DataFlowType t |
4066+
t = this.(PartialPathNodeFwd).getAp().(PartialAccessPathCons).getType()
4067+
|
4068+
// The `concat` becomes "" if `ppReprType` has no result.
4069+
result = concat(" : " + ppReprType(t))
4070+
)
4071+
}
4072+
40494073
private string ppAp() {
40504074
exists(string s |
40514075
s = this.(PartialPathNodeFwd).getAp().toString() or
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
package,sink,source,summary,sink:code,sink:encryption-decryptor,sink:encryption-encryptor,sink:encryption-keyprop,sink:encryption-symmetrickey,sink:html,sink:remote,sink:sql,sink:xss,source:file,source:local,source:remote,summary:taint,summary:value
2-
Dapper,55,,,,,,,,,,55,,,,,,
3-
JsonToItemsTaskFactory,,,7,,,,,,,,,,,,,7,
4-
Microsoft.ApplicationBlocks.Data,28,,,,,,,,,,28,,,,,,
5-
Microsoft.CSharp,,,24,,,,,,,,,,,,,24,
6-
Microsoft.EntityFrameworkCore,6,,,,,,,,,,6,,,,,,
7-
Microsoft.Extensions.Caching.Distributed,,,15,,,,,,,,,,,,,15,
8-
Microsoft.Extensions.Caching.Memory,,,46,,,,,,,,,,,,,45,1
9-
Microsoft.Extensions.Configuration,,,83,,,,,,,,,,,,,80,3
10-
Microsoft.Extensions.DependencyInjection,,,62,,,,,,,,,,,,,62,
11-
Microsoft.Extensions.DependencyModel,,,12,,,,,,,,,,,,,12,
12-
Microsoft.Extensions.FileProviders,,,16,,,,,,,,,,,,,16,
13-
Microsoft.Extensions.FileSystemGlobbing,,,15,,,,,,,,,,,,,13,2
14-
Microsoft.Extensions.Hosting,,,17,,,,,,,,,,,,,16,1
15-
Microsoft.Extensions.Http,,,10,,,,,,,,,,,,,10,
16-
Microsoft.Extensions.Logging,,,37,,,,,,,,,,,,,37,
17-
Microsoft.Extensions.Options,,,8,,,,,,,,,,,,,8,
18-
Microsoft.Extensions.Primitives,,,63,,,,,,,,,,,,,63,
19-
Microsoft.Interop,,,27,,,,,,,,,,,,,27,
20-
Microsoft.NET.Build.Tasks,,,1,,,,,,,,,,,,,1,
21-
Microsoft.NETCore.Platforms.BuildTasks,,,4,,,,,,,,,,,,,4,
22-
Microsoft.VisualBasic,,,10,,,,,,,,,,,,,5,5
23-
Microsoft.Win32,,,8,,,,,,,,,,,,,8,
24-
MySql.Data.MySqlClient,48,,,,,,,,,,48,,,,,,
25-
Newtonsoft.Json,,,91,,,,,,,,,,,,,73,18
26-
ServiceStack,194,,7,27,,,,,,75,92,,,,,7,
27-
System,65,8,12154,,8,8,9,,4,,33,3,1,3,4,10163,1991
28-
Windows.Security.Cryptography.Core,1,,,,,,,1,,,,,,,,,
1+
package,sink,source,summary,sink:code,sink:encryption-decryptor,sink:encryption-encryptor,sink:encryption-keyprop,sink:encryption-symmetrickey,sink:html,sink:remote,sink:sql,sink:xss,source:file,source:file-write,source:local,source:remote,summary:taint,summary:value
2+
Dapper,55,,,,,,,,,,55,,,,,,,
3+
JsonToItemsTaskFactory,,,7,,,,,,,,,,,,,,7,
4+
Microsoft.ApplicationBlocks.Data,28,,,,,,,,,,28,,,,,,,
5+
Microsoft.CSharp,,,24,,,,,,,,,,,,,,24,
6+
Microsoft.EntityFrameworkCore,6,,,,,,,,,,6,,,,,,,
7+
Microsoft.Extensions.Caching.Distributed,,,15,,,,,,,,,,,,,,15,
8+
Microsoft.Extensions.Caching.Memory,,,46,,,,,,,,,,,,,,45,1
9+
Microsoft.Extensions.Configuration,,,83,,,,,,,,,,,,,,80,3
10+
Microsoft.Extensions.DependencyInjection,,,62,,,,,,,,,,,,,,62,
11+
Microsoft.Extensions.DependencyModel,,,12,,,,,,,,,,,,,,12,
12+
Microsoft.Extensions.FileProviders,,,16,,,,,,,,,,,,,,16,
13+
Microsoft.Extensions.FileSystemGlobbing,,,15,,,,,,,,,,,,,,13,2
14+
Microsoft.Extensions.Hosting,,,17,,,,,,,,,,,,,,16,1
15+
Microsoft.Extensions.Http,,,10,,,,,,,,,,,,,,10,
16+
Microsoft.Extensions.Logging,,,37,,,,,,,,,,,,,,37,
17+
Microsoft.Extensions.Options,,,8,,,,,,,,,,,,,,8,
18+
Microsoft.Extensions.Primitives,,,63,,,,,,,,,,,,,,63,
19+
Microsoft.Interop,,,27,,,,,,,,,,,,,,27,
20+
Microsoft.NET.Build.Tasks,,,1,,,,,,,,,,,,,,1,
21+
Microsoft.NETCore.Platforms.BuildTasks,,,4,,,,,,,,,,,,,,4,
22+
Microsoft.VisualBasic,,,10,,,,,,,,,,,,,,5,5
23+
Microsoft.Win32,,,8,,,,,,,,,,,,,,8,
24+
MySql.Data.MySqlClient,48,,,,,,,,,,48,,,,,,,
25+
Newtonsoft.Json,,,91,,,,,,,,,,,,,,73,18
26+
ServiceStack,194,,7,27,,,,,,75,92,,,,,,7,
27+
System,65,25,12154,,8,8,9,,4,,33,3,1,17,3,4,10163,1991
28+
Windows.Security.Cryptography.Core,1,,,,,,,1,,,,,,,,,,

csharp/documentation/library-coverage/coverage.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ C# framework & library support
88

99
Framework / library,Package,Flow sources,Taint & value steps,Sinks (total),`CWE-079` :sub:`Cross-site scripting`
1010
`ServiceStack <https://servicestack.net/>`_,"``ServiceStack.*``, ``ServiceStack``",,7,194,
11-
System,"``System.*``, ``System``",8,12154,65,7
11+
System,"``System.*``, ``System``",25,12154,65,7
1212
Others,"``Dapper``, ``JsonToItemsTaskFactory``, ``Microsoft.ApplicationBlocks.Data``, ``Microsoft.CSharp``, ``Microsoft.EntityFrameworkCore``, ``Microsoft.Extensions.Caching.Distributed``, ``Microsoft.Extensions.Caching.Memory``, ``Microsoft.Extensions.Configuration``, ``Microsoft.Extensions.DependencyInjection``, ``Microsoft.Extensions.DependencyModel``, ``Microsoft.Extensions.FileProviders``, ``Microsoft.Extensions.FileSystemGlobbing``, ``Microsoft.Extensions.Hosting``, ``Microsoft.Extensions.Http``, ``Microsoft.Extensions.Logging``, ``Microsoft.Extensions.Options``, ``Microsoft.Extensions.Primitives``, ``Microsoft.Interop``, ``Microsoft.NET.Build.Tasks``, ``Microsoft.NETCore.Platforms.BuildTasks``, ``Microsoft.VisualBasic``, ``Microsoft.Win32``, ``MySql.Data.MySqlClient``, ``Newtonsoft.Json``, ``Windows.Security.Cryptography.Core``",,556,138,
13-
Totals,,8,12717,397,7
13+
Totals,,25,12717,397,7
1414

csharp/ql/integration-tests/all-platforms/diag_dotnet_incompatible/diagnostics.expected

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
2-
"attributes": {},
3-
"helpLinks": [],
4-
"internal": false,
52
"markdownMessage": "CodeQL found some projects which cannot be built with .NET Core:\n\n- `test.csproj`",
63
"severity": "warning",
74
"source": {
@@ -16,9 +13,6 @@
1613
}
1714
}
1815
{
19-
"attributes": {},
20-
"helpLinks": [],
21-
"internal": false,
2216
"markdownMessage": "CodeQL was unable to build the following projects using MSBuild:\n\n- `test.csproj`\n\nSet up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
2317
"severity": "error",
2418
"source": {

csharp/ql/integration-tests/all-platforms/diag_missing_project_files/diagnostics.expected

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
2-
"attributes": {},
3-
"helpLinks": [],
4-
"internal": false,
52
"markdownMessage": "CodeQL was unable to build the following projects using MSBuild:\n\n- `test.sln`\n\nSet up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
63
"severity": "error",
74
"source": {
@@ -16,9 +13,6 @@
1613
}
1714
}
1815
{
19-
"attributes": {},
20-
"helpLinks": [],
21-
"internal": false,
2216
"markdownMessage": "Some project files were not found when CodeQL built your project:\n\n- `Example.csproj`\n- `Example.Test.csproj`\n\nThis may lead to subsequent failures. You can check for common causes for missing project files:\n\n- Ensure that the project is built using the [intended operating system](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on) and that filenames on case-sensitive platforms are correctly specified.\n- If your repository uses Git submodules, ensure that those are [checked out](https://github.com/actions/checkout#usage) before the CodeQL Action is run.\n- If you auto-generate some project files as part of your build process, ensure that these are generated before the CodeQL Action is run.",
2317
"severity": "error",
2418
"source": {

csharp/ql/integration-tests/all-platforms/diag_missing_xamarin_sdk/diagnostics.expected

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
2-
"attributes": {},
3-
"helpLinks": [],
4-
"internal": false,
52
"markdownMessage": "CodeQL was unable to build the following projects using .NET Core:\n\n- `test.csproj`\n\nSet up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
63
"severity": "error",
74
"source": {
@@ -16,9 +13,6 @@
1613
}
1714
}
1815
{
19-
"attributes": {},
20-
"helpLinks": [],
21-
"internal": false,
2216
"markdownMessage": "CodeQL was unable to build the following projects using MSBuild:\n\n- `test.csproj`\n\nSet up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
2317
"severity": "error",
2418
"source": {
@@ -33,9 +27,6 @@
3327
}
3428
}
3529
{
36-
"attributes": {},
37-
"helpLinks": [],
38-
"internal": false,
3930
"markdownMessage": "[Configure your workflow](https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-xamarin-applications) for this SDK before running CodeQL.",
4031
"severity": "error",
4132
"source": {

csharp/ql/integration-tests/all-platforms/dotnet_run/test.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
from create_database_utils import *
32
from diagnostics_test_utils import *
43

@@ -22,35 +21,35 @@ def check_build_out(msg, s):
2221
# no arguments, but `--`
2322
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test-db', 'dotnet run --'], "test2-db")
2423
check_build_out("Default reply", s)
25-
check_diagnostics(diagnostics_dir="test2-db/diagnostic")
24+
check_diagnostics(test_db="test2-db")
2625

2726
# one argument, no `--`
2827
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test2-db', 'dotnet run hello'], "test3-db")
2928
check_build_out("Default reply", s)
30-
check_diagnostics(diagnostics_dir="test3-db/diagnostic")
29+
check_diagnostics(test_db="test3-db")
3130

3231
# one argument, but `--`
3332
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test3-db', 'dotnet run -- hello'], "test4-db")
3433
check_build_out("Default reply", s)
35-
check_diagnostics(diagnostics_dir="test4-db/diagnostic")
34+
check_diagnostics(test_db="test4-db")
3635

3736
# two arguments, no `--`
3837
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test4-db', 'dotnet run hello world'], "test5-db")
3938
check_build_out("hello, world", s)
40-
check_diagnostics(diagnostics_dir="test5-db/diagnostic")
39+
check_diagnostics(test_db="test5-db")
4140

4241
# two arguments, and `--`
4342
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test5-db', 'dotnet run -- hello world'], "test6-db")
4443
check_build_out("hello, world", s)
45-
check_diagnostics(diagnostics_dir="test6-db/diagnostic")
44+
check_diagnostics(test_db="test6-db")
4645

4746
# shared compilation enabled; tracer should override by changing the command
4847
# to `dotnet run -p:UseSharedCompilation=true -p:UseSharedCompilation=false -- hello world`
4948
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test6-db', 'dotnet run -p:UseSharedCompilation=true -- hello world'], "test7-db")
5049
check_build_out("hello, world", s)
51-
check_diagnostics(diagnostics_dir="test7-db/diagnostic")
50+
check_diagnostics(test_db="test7-db")
5251

5352
# option passed into `dotnet run`
5453
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test7-db', 'dotnet build', 'dotnet run --no-build hello world'], "test8-db")
5554
check_build_out("hello, world", s)
56-
check_diagnostics(diagnostics_dir="test8-db/diagnostic")
55+
check_diagnostics(test_db="test8-db")

csharp/ql/integration-tests/posix-only/diag_autobuild_script/diagnostics.expected

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
2-
"attributes": {},
3-
"helpLinks": [],
4-
"internal": false,
52
"markdownMessage": "CodeQL attempted to build your project using a script located at `build.sh`, which failed.\n\nSet up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
63
"severity": "error",
74
"source": {
@@ -16,9 +13,6 @@
1613
}
1714
}
1815
{
19-
"attributes": {},
20-
"helpLinks": [],
21-
"internal": false,
2216
"markdownMessage": "CodeQL could not find any project or solution files in your repository.\n\nSet up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
2317
"severity": "error",
2418
"source": {

csharp/ql/integration-tests/posix-only/diag_multiple_scripts/diagnostics.expected

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
2-
"attributes": {},
3-
"helpLinks": [],
4-
"internal": false,
52
"markdownMessage": "CodeQL could not find any project or solution files in your repository.\n\nSet up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
63
"severity": "error",
74
"source": {
@@ -16,9 +13,6 @@
1613
}
1714
}
1815
{
19-
"attributes": {},
20-
"helpLinks": [],
21-
"internal": false,
2216
"markdownMessage": "CodeQL found multiple potential build scripts for your project and attempted to run `build.sh`, which failed. This may not be the right build script for your project.\n\nSet up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
2317
"severity": "error",
2418
"source": {

0 commit comments

Comments
 (0)