Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 18, 2026

Integration tests fail on Ubuntu with AuthenticationException: The remote certificate is invalid because of errors in the certificate chain: NotSignatureValid when making HTTPS requests through the test proxy. The tests use self-signed certificates, but HttpClient lacks SSL validation configuration to accept them.

Changes

  • Configure HttpClientHandler in both TestHelper.GetHttpClient() methods to bypass SSL validation using DangerousAcceptAnyServerCertificateValidator
  • Add comments explaining this is safe for integration tests where we control both client and server
var handler = new HttpClientHandler 
{ 
    Proxy = proxy, 
    UseProxy = true,
    // Accept self-signed certificates generated for testing. This is safe in integration tests
    // where we control both the client and server, but should not be used in production code.
    ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
};

This allows tests to pass on both Ubuntu and Windows runners when using self-signed certificates.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 8e04c839-e4d0-457f-92d9-58117341cc87.com
    • Triggering command: /home/REDACTED/work/FidgetProxy/FidgetProxy/Keboo.Web.Proxy.IntegrationTests/bin/Release/net10.0/Keboo.Web.Proxy.IntegrationTests /home/REDACTED/work/FidgetProxy/FidgetProxy/Keboo.Web.Proxy.IntegrationTests/bin/Release/net10.0/Keboo.Web.Proxy.IntegrationTests (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Problem

The integration tests are failing on Ubuntu with an SSL certificate validation error:

TUnit.Engine.Exceptions.TestFailedException: HttpRequestException: The SSL connection could not be established, see inner exception.
...
System.Security.Authentication.AuthenticationException: The remote certificate is invalid because of errors in the certificate chain: NotSignatureValid

This occurs in StressTests.cs at line 40 when making HTTPS requests through the test proxy.

Root Cause

The test suite creates self-signed certificates for testing, but the HttpClient created in TestHelper.GetHttpClient() doesn't have SSL certificate validation configured to accept these self-signed certificates. While this might work on some platforms, Ubuntu's stricter SSL validation causes the test to fail.

Solution

Update the HttpClientHandler in Keboo.Web.Proxy.IntegrationTests/Helpers/TestHelper.cs to disable SSL certificate validation for the test environment. This is safe for integration tests since we control both the client and server.

Specifically, modify the GetHttpClient(int localProxyPort, bool enableBasicProxyAuthorization = false) method to set:

ServerCertificateCustomValidationCallback = HttpClientHandler.DangerBypassAllCertificateValidation

This will allow the HttpClient to accept the self-signed certificates used in the test environment.

Files to Modify

  • Keboo.Web.Proxy.IntegrationTests/Helpers/TestHelper.cs - Update the HttpClientHandler configuration to bypass certificate validation for tests

Expected Result

The integration tests should pass on both Ubuntu and Windows action runners, as the HttpClient will accept the self-signed certificates generated for testing purposes.

This pull request was created from Copilot chat.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 18, 2026 16:36
- Updated HttpClientHandler to bypass SSL certificate validation in test environment
- Added ServerCertificateCustomValidationCallback to both GetHttpClient methods
- Fixes SSL errors on Ubuntu when using self-signed certificates in tests

Co-authored-by: Keboo <952248+Keboo@users.noreply.github.com>
- Added explanatory comments for ServerCertificateCustomValidationCallback usage
- Clarifies this is safe for integration tests but not production code
- Addresses code review feedback

Co-authored-by: Keboo <952248+Keboo@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix SSL certificate validation in integration tests Fix SSL certificate validation for integration tests on Ubuntu Jan 18, 2026
Copilot AI requested a review from Keboo January 18, 2026 16:40
Adopts consistent private field naming conventions across `CertificateManager` and certificate maker implementations.
Removes `ExceptionHandler` dependency from certificate maker constructors, simplifying their design and shifting error handling.
Updates default root certificate names to explicitly indicate their non-trustworthy nature, enhancing security clarity.
Cleans up unit tests by leveraging simplified assertion methods and optimizing `Task.WhenAll` usage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants