pact-net icon indicating copy to clipboard operation
pact-net copied to clipboard

'WithSslVerificationDisabled' doesnt disable ssl verification

Open bulat30 opened this issue 4 months ago • 12 comments

I'm trying to implement a simple provider test using pact-broker as the pact source. But I get a certificate verification error when connecting to the broker, although I use WithSslVerificationDisabled. I also tried using the PACT_DISABLE_SSL_VERIFICATION and PACT_BROKER_DISABLE_SSL_VERIFICATION variables, but the error persists Package - "PactNet" Version="4.5.0", OS - windows, framework - net7.0

Environment.SetEnvironmentVariable("PACT_DISABLE_SSL_VERIFICATION", "true");
Environment.SetEnvironmentVariable("PACT_BROKER_DISABLE_SSL_VERIFICATION", "true");
var pactVerifier = new PactVerifier(new PactVerifierConfig() { Outputters = new[] { new XunitOutput(testOutputHelper) }, LogLevel = PactLogLevel.Debug });
pactVerifier
               .ServiceProvider("my_service", new Uri("http://localhost:5000"))
               .WithPactBrokerSource(new Uri("https://myhost"), opt =>
                   {
                       opt.PublishResults(Guid.NewGuid().ToString());
                   })
               .WithSslVerificationDisabled()
               .Verify();

Verifier Logs: reqwest::async_impl::client: rustls failed to parse DER certificate MissingOrMalformedExtensions Certificate pact_verifier::pact_broker: Fetching path '/' from pact broker rustls::conn: Sending fatal alert BadCertificate pact_verifier: Failed to load pact - \x1b[31mCould not load pacts from the pact broker.

bulat30 avatar Feb 09 '24 09:02 bulat30