Skip to content

Commit

Permalink
Fix http connexion with certificates
Browse files Browse the repository at this point in the history
  • Loading branch information
ddiakiteaneo committed Nov 7, 2024
1 parent d201790 commit 8813a44
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

using ArmoniK.Api.Client.Options;
using ArmoniK.Api.Client.Submitter;
using ArmoniK.Api.gRPC.V1;

using Microsoft.Extensions.Configuration;

Expand Down Expand Up @@ -95,16 +96,22 @@ public static async Task<uint> RpcCalled(string service_name,
certChain,
sslPolicyErrors) =>
{
if (caCert != null)
if (!options.AllowUnsafeConnection)
{
certChain.ChainPolicy.ExtraStore.Add(new X509Certificate2(caCert!.GetEncoded()));
certChain.ChainPolicy.VerificationFlags = X509VerificationFlags.AllowUnknownCertificateAuthority;
certChain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck;
if (caCert != null)
{
certChain.ChainPolicy.ExtraStore.Add(new X509Certificate2(caCert!.GetEncoded()));

Check warning on line 103 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net8.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Dereference of a possibly null reference.

Check warning on line 103 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net6.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Dereference of a possibly null reference.

Check warning on line 103 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net8.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Dereference of a possibly null reference.

Check warning on line 103 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net8.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Dereference of a possibly null reference.

Check warning on line 103 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net6.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Dereference of a possibly null reference.

Check warning on line 103 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net6.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Dereference of a possibly null reference.
certChain.ChainPolicy.VerificationFlags = X509VerificationFlags.AllowUnknownCertificateAuthority;
certChain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck;
return certChain.Build(cert);

Check warning on line 106 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net8.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Possible null reference argument for parameter 'certificate' in 'bool X509Chain.Build(X509Certificate2 certificate)'.

Check warning on line 106 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net6.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Possible null reference argument for parameter 'certificate' in 'bool X509Chain.Build(X509Certificate2 certificate)'.

Check warning on line 106 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net8.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Possible null reference argument for parameter 'certificate' in 'bool X509Chain.Build(X509Certificate2 certificate)'.

Check warning on line 106 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net8.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Possible null reference argument for parameter 'certificate' in 'bool X509Chain.Build(X509Certificate2 certificate)'.

Check warning on line 106 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net6.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Possible null reference argument for parameter 'certificate' in 'bool X509Chain.Build(X509Certificate2 certificate)'.

Check warning on line 106 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net6.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Possible null reference argument for parameter 'certificate' in 'bool X509Chain.Build(X509Certificate2 certificate)'.
}

certChain.ChainPolicy.VerificationFlags = X509VerificationFlags.NoFlag;

Check warning on line 109 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net8.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Dereference of a possibly null reference.

Check warning on line 109 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net6.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Dereference of a possibly null reference.

Check warning on line 109 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net8.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Dereference of a possibly null reference.

Check warning on line 109 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net8.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Dereference of a possibly null reference.

Check warning on line 109 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net6.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Dereference of a possibly null reference.

Check warning on line 109 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net6.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Dereference of a possibly null reference.
certChain.ChainPolicy.RevocationMode = X509RevocationMode.Online;
return certChain.Build(cert);

Check warning on line 111 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net8.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Possible null reference argument for parameter 'certificate' in 'bool X509Chain.Build(X509Certificate2 certificate)'.

Check warning on line 111 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net6.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Possible null reference argument for parameter 'certificate' in 'bool X509Chain.Build(X509Certificate2 certificate)'.

Check warning on line 111 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net8.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Possible null reference argument for parameter 'certificate' in 'bool X509Chain.Build(X509Certificate2 certificate)'.

Check warning on line 111 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net8.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Possible null reference argument for parameter 'certificate' in 'bool X509Chain.Build(X509Certificate2 certificate)'.

Check warning on line 111 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net6.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Possible null reference argument for parameter 'certificate' in 'bool X509Chain.Build(X509Certificate2 certificate)'.

Check warning on line 111 in packages/csharp/ArmoniK.Api.Client.Test/ConfTest.cs

View workflow job for this annotation

GitHub Actions / Test API (C#, dotnet test -f net6.0 --logger "trx;LogFileName=test-results.trx", csharp/ArmoniK.A...

Possible null reference argument for parameter 'certificate' in 'bool X509Chain.Build(X509Certificate2 certificate)'.
}

return certChain.Build(cert);
return true;
};

var client = new HttpClient(handler);
var call_endpoint = Environment.GetEnvironmentVariable("Http__Endpoint") + "/calls.json";
try
Expand Down

0 comments on commit 8813a44

Please sign in to comment.