Skip to content

Commit 597608a

Browse files
authored
Merge branch 'main' into feature/cpp-mmio-unsanitized-memcpy
2 parents ac50b21 + b0fa3e7 commit 597608a

65 files changed

Lines changed: 1550 additions & 782 deletions

File tree

Some content is hidden

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

MODULE.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,13 @@ use_repo(
237237
swift,
238238
"swift_toolchain",
239239
"swift_toolchain_ubuntu22.04",
240+
"swift_toolchain_ubuntu22.04-aarch64",
240241
"swift_toolchain_xcode",
241242
)
242243

243244
register_toolchains(
244245
"@swift_toolchain//:swift_toolchain_exec_ubuntu22.04",
246+
"@swift_toolchain//:swift_toolchain_exec_ubuntu22.04-aarch64",
245247
"@swift_toolchain//:swift_toolchain_exec_xcode",
246248
dev_dependency = True,
247249
)

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ module Input implements InputSig<Location, DataFlowImplSpecific::CppDataFlow> {
1717

1818
class SummarizedCallableBase = Function;
1919

20-
class SourceBase = Function;
21-
22-
class SinkBase = Function;
23-
2420
class FlowSummaryCallBase = CallInstruction;
2521

2622
predicate callableFromSource(SummarizedCallableBase c) { exists(c.getBlock()) }
@@ -232,7 +228,7 @@ private module Input2 implements Impl::Private::InputSig2 {
232228

233229
bindingset[source, sc]
234230
SourceSinkReportingElement getASourceReportingElement(
235-
Input::SourceBase source, Impl::Private::SummaryComponent sc
231+
Input::SummarizedCallableBase source, Impl::Private::SummaryComponent sc
236232
) {
237233
exists(Call call | call.getTarget() = source |
238234
sc = Impl::Private::SummaryComponent::return(_) and
@@ -312,7 +308,7 @@ private module Input2 implements Impl::Private::InputSig2 {
312308

313309
bindingset[sink, sc]
314310
SourceSinkReportingElement getASinkReportingElement(
315-
Input::SinkBase sink, Impl::Private::SummaryComponent sc
311+
Input::SummarizedCallableBase sink, Impl::Private::SummaryComponent sc
316312
) {
317313
exists(Call call, ArgumentPosition pos |
318314
call.getTarget() = sink and
@@ -525,9 +521,10 @@ private class SourceModelFunction extends Public::SourceElement instanceof Funct
525521
}
526522

527523
override predicate isSource(
528-
string output, string kind, Public::Provenance provenance, string model
524+
string output, string kind, Public::Provenance provenance, boolean isExact, string model
529525
) {
530-
sourceModel(namespace, type, subtypes, name, signature, ext, output, kind, provenance, model)
526+
sourceModel(namespace, type, subtypes, name, signature, ext, output, kind, provenance, model) and
527+
isExact = true
531528
}
532529
}
533530

@@ -544,7 +541,10 @@ private class SinkModelFunction extends Public::SinkElement instanceof Function
544541
this = interpretElement(namespace, type, subtypes, name, signature, ext)
545542
}
546543

547-
override predicate isSink(string input, string kind, Public::Provenance provenance, string model) {
548-
sinkModel(namespace, type, subtypes, name, signature, ext, input, kind, provenance, model)
544+
override predicate isSink(
545+
string input, string kind, Public::Provenance provenance, boolean isExact, string model
546+
) {
547+
sinkModel(namespace, type, subtypes, name, signature, ext, input, kind, provenance, model) and
548+
isExact = true
549549
}
550550
}

cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/internal/AliasedSSA.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,7 @@ private predicate isRelatableMemoryLocation(VariableMemoryLocation vml) {
815815
vml.getStartBitOffset() != Ints::unknown()
816816
}
817817

818+
pragma[no_dynamic_join_order]
818819
private predicate isCoveredOffset(Allocation var, int offsetRank, VariableMemoryLocation vml) {
819820
exists(int startRank, int endRank, VirtualVariable vvar |
820821
vml.getStartBitOffset() = rank[startRank](IntValue offset_ | isRelevantOffset(vvar, offset_)) and

csharp/documentation/library-coverage/coverage.csv

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ Internal.IL,,,68,,,,,,,,,,,,,,,,,,,41,27
1010
Internal.Pgo,,,9,,,,,,,,,,,,,,,,,,,2,7
1111
Internal.TypeSystem,,,365,,,,,,,,,,,,,,,,,,,216,149
1212
Microsoft.ApplicationBlocks.Data,28,,,,,,,,,,,,28,,,,,,,,,,
13+
Microsoft.AspNet.OData,,,5,,,,,,,,,,,,,,,,,,,5,
1314
Microsoft.AspNetCore.Components,2,4,2,,,,,,,2,,,,,,,,,4,,,1,1
1415
Microsoft.AspNetCore.Http,,,1,,,,,,,,,,,,,,,,,,,1,
1516
Microsoft.AspNetCore.Mvc,,,2,,,,,,,,,,,,,,,,,,,,2
17+
Microsoft.AspNetCore.OData.Deltas,,,5,,,,,,,,,,,,,,,,,,,5,
1618
Microsoft.AspNetCore.WebUtilities,,,2,,,,,,,,,,,,,,,,,,,2,
1719
Microsoft.CSharp,,,2,,,,,,,,,,,,,,,,,,,2,
1820
Microsoft.Data.SqlClient,7,,4,,,,,,,,,,7,,,,,,,,,4,
@@ -44,5 +46,5 @@ NHibernate,3,,,,,,,,,,,,3,,,,,,,,,,
4446
Newtonsoft.Json,,,91,,,,,,,,,,,,,,,,,,,73,18
4547
ServiceStack,194,,7,27,,,,,75,,,,92,,,,,,,,,7,
4648
SourceGenerators,,,5,,,,,,,,,,,,,,,,,,,,5
47-
System,59,48,12495,,6,5,12,,,4,1,,31,2,,6,15,17,5,3,,6382,6113
49+
System,59,48,12500,,6,5,12,,,4,1,,31,2,,6,15,17,5,3,,6387,6113
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``",48,12495,59,5
12-
Others,"``Amazon.Lambda.APIGatewayEvents``, ``Amazon.Lambda.Core``, ``Dapper``, ``ILCompiler``, ``ILLink.RoslynAnalyzer``, ``ILLink.Shared``, ``ILLink.Tasks``, ``Internal.IL``, ``Internal.Pgo``, ``Internal.TypeSystem``, ``Microsoft.ApplicationBlocks.Data``, ``Microsoft.AspNetCore.Components``, ``Microsoft.AspNetCore.Http``, ``Microsoft.AspNetCore.Mvc``, ``Microsoft.AspNetCore.WebUtilities``, ``Microsoft.CSharp``, ``Microsoft.Data.SqlClient``, ``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.VisualBasic``, ``Microsoft.Win32``, ``Mono.Linker``, ``MySql.Data.MySqlClient``, ``NHibernate``, ``Newtonsoft.Json``, ``SourceGenerators``, ``Windows.Security.Cryptography.Core``",60,2406,162,4
13-
Totals,,108,14908,415,9
11+
System,"``System.*``, ``System``",48,12500,59,5
12+
Others,"``Amazon.Lambda.APIGatewayEvents``, ``Amazon.Lambda.Core``, ``Dapper``, ``ILCompiler``, ``ILLink.RoslynAnalyzer``, ``ILLink.Shared``, ``ILLink.Tasks``, ``Internal.IL``, ``Internal.Pgo``, ``Internal.TypeSystem``, ``Microsoft.ApplicationBlocks.Data``, ``Microsoft.AspNet.OData``, ``Microsoft.AspNetCore.Components``, ``Microsoft.AspNetCore.Http``, ``Microsoft.AspNetCore.Mvc``, ``Microsoft.AspNetCore.OData.Deltas``, ``Microsoft.AspNetCore.WebUtilities``, ``Microsoft.CSharp``, ``Microsoft.Data.SqlClient``, ``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.VisualBasic``, ``Microsoft.Win32``, ``Mono.Linker``, ``MySql.Data.MySqlClient``, ``NHibernate``, ``Newtonsoft.Json``, ``SourceGenerators``, ``Windows.Security.Cryptography.Core``",60,2416,162,4
13+
Totals,,108,14923,415,9
1414

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependabotProxy.cs

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace Semmle.Extraction.CSharp.DependencyFetching
1111
{
12-
public class DependabotProxy : IDisposable
12+
public class DependabotProxy : IDependabotProxy
1313
{
1414
/// <summary>
1515
/// Represents configurations for package registries.
@@ -21,24 +21,15 @@ public record class RegistryConfig(string Type, string URL);
2121
private readonly string host;
2222
private readonly string port;
2323

24-
/// <summary>
25-
/// The full address of the Dependabot proxy, if available.
26-
/// </summary>
27-
internal string Address { get; }
28-
/// <summary>
29-
/// The URLs of package registries that are configured for the proxy.
30-
/// </summary>
31-
internal HashSet<string> RegistryURLs { get; }
32-
/// <summary>
33-
/// The path to the temporary file where the certificate is stored.
34-
/// </summary>
35-
internal string? CertificatePath { get; private set; }
36-
/// <summary>
37-
/// The certificate used for the Dependabot proxy.
38-
/// </summary>
39-
internal X509Certificate2? Certificate { get; private set; }
24+
public string Address { get; }
25+
26+
public HashSet<string> RegistryURLs { get; }
27+
28+
public string? CertificatePath { get; private set; }
29+
30+
public X509Certificate2? Certificate { get; private set; }
4031

41-
internal static DependabotProxy? GetDependabotProxy(
32+
internal static IDependabotProxy? GetDependabotProxy(
4233
ILogger logger, IDiagnosticsWriter diagnosticsWriter, TemporaryDirectory tempWorkingDirectory)
4334
{
4435
// Setting HTTP(S)_PROXY and SSL_CERT_FILE have no effect on Windows or macOS,

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependencyManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ public sealed partial class DependencyManager : IDisposable, ICompilationInfoCon
2727
private readonly ILogger logger;
2828
private readonly IDiagnosticsWriter diagnosticsWriter;
2929
private readonly NugetPackageRestorer nugetPackageRestorer;
30-
private readonly DependabotProxy? dependabotProxy;
30+
private readonly IDependabotProxy? dependabotProxy;
3131
private readonly IDotNet dotnet;
3232
private readonly FileContent fileContent;
33-
private readonly FileProvider fileProvider;
33+
private readonly IFileProvider fileProvider;
3434

3535
// Only used as a set, but ConcurrentDictionary is the only concurrent set in .NET.
3636
private readonly IDictionary<string, bool> usedReferences = new ConcurrentDictionary<string, bool>();

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DotNet.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ private DotNet(IDotNetCliInvoker dotnetCliInvoker, ILogger logger, bool runDotne
3131
}
3232
}
3333

34-
private DotNet(ILogger logger, string? dotNetPath, TemporaryDirectory tempWorkingDirectory, DependabotProxy? dependabotProxy) : this(new DotNetCliInvoker(logger, Path.Join(dotNetPath ?? string.Empty, "dotnet"), dependabotProxy), logger, dotNetPath is null, tempWorkingDirectory) { }
34+
private DotNet(ILogger logger, string? dotNetPath, TemporaryDirectory tempWorkingDirectory, IDependabotProxy? dependabotProxy) : this(new DotNetCliInvoker(logger, Path.Join(dotNetPath ?? string.Empty, "dotnet"), dependabotProxy), logger, dotNetPath is null, tempWorkingDirectory) { }
3535

3636
internal static IDotNet Make(IDotNetCliInvoker dotnetCliInvoker, ILogger logger, bool runDotnetInfo) => new DotNet(dotnetCliInvoker, logger, runDotnetInfo);
3737

38-
public static IDotNet Make(ILogger logger, string? dotNetPath, TemporaryDirectory tempWorkingDirectory, DependabotProxy? dependabotProxy) => new DotNet(logger, dotNetPath, tempWorkingDirectory, dependabotProxy);
38+
public static IDotNet Make(ILogger logger, string? dotNetPath, TemporaryDirectory tempWorkingDirectory, IDependabotProxy? dependabotProxy) => new DotNet(logger, dotNetPath, tempWorkingDirectory, dependabotProxy);
3939

4040
private static void HandleRetryExitCode143(string dotnet, int attempt, ILogger logger)
4141
{
@@ -90,7 +90,8 @@ private List<string> GetRestoreArgs(RestoreSettings restoreSettings)
9090
args.Add("/p:EnableWindowsTargeting=true");
9191
}
9292

93-
args.AddRange(restoreSettings.NugetSources);
93+
var nugetSources = restoreSettings.NugetSources.SelectMany<string, string>(source => ["-s", source]).ToList();
94+
args.AddRange(nugetSources);
9495

9596
return args;
9697
}

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DotNetCliInvoker.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
1212
internal sealed class DotNetCliInvoker : IDotNetCliInvoker
1313
{
1414
private readonly ILogger logger;
15-
private readonly DependabotProxy? proxy;
15+
private readonly IDependabotProxy? proxy;
1616

1717
public string Exec { get; }
1818

19-
public DotNetCliInvoker(ILogger logger, string exec, DependabotProxy? dependabotProxy)
19+
public DotNetCliInvoker(ILogger logger, string exec, IDependabotProxy? dependabotProxy)
2020
{
2121
this.logger = logger;
2222
this.proxy = dependabotProxy;

0 commit comments

Comments
 (0)