Skip to content

Commit ebe38bc

Browse files
author
Paolo Tranquilli
committed
Merge branch 'main' into redsun82/rust-less-canonical-paths
2 parents 6a8188f + cc4382c commit ebe38bc

File tree

100 files changed

+2840
-784
lines changed

Some content is hidden

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

100 files changed

+2840
-784
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
23
"extensions": [
34
"rust-lang.rust-analyzer",
45
"bungcip.better-toml",

CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ MODULE.bazel @github/codeql-ci-reviewers
4242
# Misc
4343
/misc/scripts/accept-expected-changes-from-ci.py @RasmusWL
4444
/misc/scripts/generate-code-scanning-query-list.py @RasmusWL
45+
46+
# .devcontainer
47+
/.devcontainer/ @github/codeql-ci-reviewers

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ module ProductFlow {
545545
private predicate outImpl1(Flow1::PathNode pred1, Flow1::PathNode succ1, DataFlowCall call) {
546546
Flow1::PathGraph::edges(pred1, succ1, _, _) and
547547
exists(ReturnKindExt returnKind |
548-
succ1.getNode() = returnKind.getAnOutNode(call) and
548+
succ1.getNode() = getAnOutNodeExt(call, returnKind) and
549549
returnKind = getParamReturnPosition(_, pred1.asParameterReturnNode()).getKind()
550550
)
551551
}
@@ -573,7 +573,7 @@ module ProductFlow {
573573
private predicate outImpl2(Flow2::PathNode pred2, Flow2::PathNode succ2, DataFlowCall call) {
574574
Flow2::PathGraph::edges(pred2, succ2, _, _) and
575575
exists(ReturnKindExt returnKind |
576-
succ2.getNode() = returnKind.getAnOutNode(call) and
576+
succ2.getNode() = getAnOutNodeExt(call, returnKind) and
577577
returnKind = getParamReturnPosition(_, pred2.asParameterReturnNode()).getKind()
578578
)
579579
}

csharp/.vscode/launch.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,21 @@
6161
],
6262
"env": {}
6363
},
64+
{
65+
"name": "C#: Tracing Debug",
66+
"type": "coreclr",
67+
"request": "launch",
68+
"preLaunchTask": "dotnet: build",
69+
"program": "${workspaceFolder}/extractor/Semmle.Extraction.CSharp.Driver/bin/Debug/net9.0/Semmle.Extraction.CSharp.Driver.dll",
70+
// Set the path to the folder that should be extracted:
71+
"cwd": "${workspaceFolder}/ql/test/library-tests/dataflow/local",
72+
"args": [
73+
"LocalDataFlow.cs"
74+
],
75+
"env": {},
76+
"stopAtEntry": true,
77+
"justMyCode": false,
78+
"suppressJITOptimizations": true
79+
},
6480
]
6581
}

csharp/documentation/library-coverage/coverage.csv

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ JsonToItemsTaskFactory,,,11,,,,,,,,,,,,,,,,,,,1,10
1313
Microsoft.Android.Build,,1,14,,,,,,,,,,,,,1,,,,,,12,2
1414
Microsoft.Apple.Build,,,7,,,,,,,,,,,,,,,,,,,7,
1515
Microsoft.ApplicationBlocks.Data,28,,,,,,,,,,,,28,,,,,,,,,,
16+
Microsoft.AspNetCore.Components,,2,1,,,,,,,,,,,,,,,,2,,,1,
17+
Microsoft.AspNetCore.WebUtilities,,,2,,,,,,,,,,,,,,,,,,,2,
1618
Microsoft.CSharp,,,2,,,,,,,,,,,,,,,,,,,2,
1719
Microsoft.Diagnostics.Tools.Pgo,,,25,,,,,,,,,,,,,,,,,,,2,23
1820
Microsoft.DotNet.Build.Tasks,,,10,,,,,,,,,,,,,,,,,,,8,2
@@ -44,5 +46,5 @@ MySql.Data.MySqlClient,48,,,,,,,,,,,,48,,,,,,,,,,
4446
Newtonsoft.Json,,,91,,,,,,,,,,,,,,,,,,,73,18
4547
ServiceStack,194,,7,27,,,,,75,,,,92,,,,,,,,,7,
4648
SourceGenerators,,,5,,,,,,,,,,,,,,,,,,,,5
47-
System,54,47,10818,,6,5,5,,,4,1,,33,2,,6,15,17,4,3,,5511,5307
49+
System,54,47,10819,,6,5,5,,,4,1,,33,2,,6,15,17,4,3,,5512,5307
4850
Windows.Security.Cryptography.Core,1,,,,,,,1,,,,,,,,,,,,,,,

csharp/documentation/library-coverage/coverage.rst

Lines changed: 3 additions & 3 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``",47,10818,54,5
12-
Others,"``Amazon.Lambda.APIGatewayEvents``, ``Amazon.Lambda.Core``, ``Dapper``, ``ILCompiler``, ``ILLink.RoslynAnalyzer``, ``ILLink.Shared``, ``ILLink.Tasks``, ``Internal.IL``, ``Internal.Pgo``, ``Internal.TypeSystem``, ``JsonToItemsTaskFactory``, ``Microsoft.Android.Build``, ``Microsoft.Apple.Build``, ``Microsoft.ApplicationBlocks.Data``, ``Microsoft.CSharp``, ``Microsoft.Diagnostics.Tools.Pgo``, ``Microsoft.DotNet.Build.Tasks``, ``Microsoft.DotNet.PlatformAbstractions``, ``Microsoft.EntityFrameworkCore``, ``Microsoft.Extensions.Caching.Distributed``, ``Microsoft.Extensions.Caching.Memory``, ``Microsoft.Extensions.Configuration``, ``Microsoft.Extensions.DependencyInjection``, ``Microsoft.Extensions.DependencyModel``, ``Microsoft.Extensions.Diagnostics.Metrics``, ``Microsoft.Extensions.FileProviders``, ``Microsoft.Extensions.FileSystemGlobbing``, ``Microsoft.Extensions.Hosting``, ``Microsoft.Extensions.Http``, ``Microsoft.Extensions.Logging``, ``Microsoft.Extensions.Options``, ``Microsoft.Extensions.Primitives``, ``Microsoft.Interop``, ``Microsoft.JSInterop``, ``Microsoft.NET.Build.Tasks``, ``Microsoft.NET.Sdk.WebAssembly``, ``Microsoft.NET.WebAssembly.Webcil``, ``Microsoft.VisualBasic``, ``Microsoft.WebAssembly.Build.Tasks``, ``Microsoft.Win32``, ``Mono.Linker``, ``MySql.Data.MySqlClient``, ``Newtonsoft.Json``, ``SourceGenerators``, ``Windows.Security.Cryptography.Core``",57,2068,150,2
13-
Totals,,104,12893,398,7
11+
System,"``System.*``, ``System``",47,10819,54,5
12+
Others,"``Amazon.Lambda.APIGatewayEvents``, ``Amazon.Lambda.Core``, ``Dapper``, ``ILCompiler``, ``ILLink.RoslynAnalyzer``, ``ILLink.Shared``, ``ILLink.Tasks``, ``Internal.IL``, ``Internal.Pgo``, ``Internal.TypeSystem``, ``JsonToItemsTaskFactory``, ``Microsoft.Android.Build``, ``Microsoft.Apple.Build``, ``Microsoft.ApplicationBlocks.Data``, ``Microsoft.AspNetCore.Components``, ``Microsoft.AspNetCore.WebUtilities``, ``Microsoft.CSharp``, ``Microsoft.Diagnostics.Tools.Pgo``, ``Microsoft.DotNet.Build.Tasks``, ``Microsoft.DotNet.PlatformAbstractions``, ``Microsoft.EntityFrameworkCore``, ``Microsoft.Extensions.Caching.Distributed``, ``Microsoft.Extensions.Caching.Memory``, ``Microsoft.Extensions.Configuration``, ``Microsoft.Extensions.DependencyInjection``, ``Microsoft.Extensions.DependencyModel``, ``Microsoft.Extensions.Diagnostics.Metrics``, ``Microsoft.Extensions.FileProviders``, ``Microsoft.Extensions.FileSystemGlobbing``, ``Microsoft.Extensions.Hosting``, ``Microsoft.Extensions.Http``, ``Microsoft.Extensions.Logging``, ``Microsoft.Extensions.Options``, ``Microsoft.Extensions.Primitives``, ``Microsoft.Interop``, ``Microsoft.JSInterop``, ``Microsoft.NET.Build.Tasks``, ``Microsoft.NET.Sdk.WebAssembly``, ``Microsoft.NET.WebAssembly.Webcil``, ``Microsoft.VisualBasic``, ``Microsoft.WebAssembly.Build.Tasks``, ``Microsoft.Win32``, ``Mono.Linker``, ``MySql.Data.MySqlClient``, ``Newtonsoft.Json``, ``SourceGenerators``, ``Windows.Security.Cryptography.Core``",59,2071,150,2
13+
Totals,,106,12897,398,7
1414

csharp/ql/lib/change-notes/2024-11-19-extractor-dotnet.md

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

csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -731,11 +731,9 @@ module LocalFlow {
731731
or
732732
node2 = node1.(LocalFunctionCreationNode).getAnAccess(true)
733733
or
734-
node1 =
735-
unique(FlowSummaryNode n1 |
736-
FlowSummaryImpl::Private::Steps::summaryLocalStep(n1.getSummaryNode(),
737-
node2.(FlowSummaryNode).getSummaryNode(), true, _)
738-
)
734+
FlowSummaryImpl::Private::Steps::summaryLocalMustFlowStep(node1
735+
.(FlowSummaryNode)
736+
.getSummaryNode(), node2.(FlowSummaryNode).getSummaryNode())
739737
}
740738
}
741739

csharp/ql/src/Likely Bugs/ThreadUnsafeICryptoTransform.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class ICryptoTransform extends ValueOrRefType {
5252
}
5353

5454
from UnsafeField field
55+
where field.fromSource()
5556
select field,
5657
"Static field '" + field.getName() +
5758
"' contains a 'System.Security.Cryptography.ICryptoTransform' that could be used in an unsafe way."

csharp/ql/src/Telemetry/DatabaseQuality.qll

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,36 @@ module CallTargetStats implements StatsSig {
6868
)
6969
}
7070

71-
private predicate isInitializedWithCollectionInitializer(PropertyCall c) {
71+
private predicate isInitializedWithObjectOrCollectionInitializer(PropertyCall c) {
7272
exists(Property p, AssignExpr assign |
7373
p = c.getProperty() and
7474
assign = c.getParent() and
7575
assign.getLValue() = c and
76-
assign.getRValue() instanceof CollectionInitializer
76+
assign.getRValue() instanceof ObjectOrCollectionInitializer
7777
)
7878
}
7979

80+
private predicate isEventFieldAccess(EventCall c) {
81+
exists(Event e | c.getEvent() = e |
82+
forall(Accessor a | e.getAnAccessor() = a | a.isCompilerGenerated())
83+
)
84+
}
85+
86+
private predicate isTypeParameterInstantiation(ObjectCreation e) {
87+
e.getType() instanceof TypeParameter
88+
}
89+
8090
additional predicate isNotOkCall(Call c) {
8191
not exists(c.getTarget()) and
8292
not c instanceof DelegateCall and
8393
not c instanceof DynamicExpr and
8494
not isNoSetterPropertyCallInConstructor(c) and
8595
not isNoSetterPropertyInitialization(c) and
8696
not isAnonymousObjectMemberDeclaration(c) and
87-
not isInitializedWithCollectionInitializer(c) and
88-
not c.getParent+() instanceof NameOfExpr
97+
not isInitializedWithObjectOrCollectionInitializer(c) and
98+
not c.getParent+() instanceof NameOfExpr and
99+
not isEventFieldAccess(c) and
100+
not isTypeParameterInstantiation(c)
89101
}
90102

91103
int getNumberOfNotOk() { result = count(Call c | isNotOkCall(c)) }

0 commit comments

Comments
 (0)