Skip to content

Move network-dependent s_client tests into integration_test, fix getaddrinfo UB - #3407

Open
justsmth wants to merge 2 commits into
aws:mainfrom
justsmth:skip-remote-connection-tests
Open

Move network-dependent s_client tests into integration_test, fix getaddrinfo UB#3407
justsmth wants to merge 2 commits into
aws:mainfrom
justsmth:skip-remote-connection-tests

Conversation

@justsmth

@justsmth justsmth commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Description of changes:

Two commits. No issue number; this came out of chasing intermittent SClientTest failures in CI.

  • Move network-dependent s_client tests into integration_test -- the 5 SClientTest cases that connect to amazon.com:443 move to tool-openssl/s_client_integration_test.cc, joining the OCSP responder tests. integration_test is deliberately absent from util/all_tests.json, so the default test run no longer touches the network. NoConnect and Help do not connect, so they stay in tool_openssl_test.
  • Fix UB on getaddrinfo failure in Connect -- the early return was gated on quiet, which openssl s_client sets, so a DNS failure fell through into a loop over an uninitialized addrinfo * and then freeaddrinfo() on it.

Call-outs:

  • The UB is a SIGSEGV, not a test failure: with no egress, tool_openssl_test crashed on its first networked test and aborted the other 500+. It is reachable from the shipped openssl s_client on any DNS failure, so it is worth fixing independently of the test move. Happy to split it into its own PR.
  • integration_test now needs the SClientTool link closure, so ssl/CMakeLists.txt reaches into tool-openssl/. Slightly awkward layering; open to a better arrangement.
  • ocsp-external-tests.yml still runs on every PR, so these tests can still go red -- just in an isolated job rather than the main matrix. I left the workflow name and job id untouched so a pinned required check does not break.

Testing:

Existing tests, plus a container with routing cut (0 routes, no DNS): util/all_tests.go reports "All unit tests passed!" and never invokes integration_test. Run explicitly there, integration_test fails without crashing.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.
`

Connect() only returned early from a getaddrinfo failure when |quiet| was false. The openssl s_client path passes quiet=true, so a DNS failure fell through to the loop over |result|, which getaddrinfo leaves uninitialized on error, and then to freeaddrinfo() on that same garbage pointer.

Reproduced in a container with no external routing: tool_openssl_test --gtest_filter=SClientTest.Connect died with SIGSEGV at transport_common.cc:160, with ret=-3 (EAI_AGAIN) and result=0x7. Because it crashed the process, it also aborted the 500+ remaining tests in that binary. With this change the same run fails cleanly and the rest of the suite completes.

The error return is now unconditional; only reporting the error is gated on |quiet|.
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🔒 Security ReviewView Report

Please review before merging.

skmcgrail
skmcgrail previously approved these changes Aug 5, 2026
@codecov-commenter

codecov-commenter commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.13%. Comparing base (f01746a) to head (614a2a1).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
tool-openssl/s_client_integration_test.cc 0.00% 20 Missing ⚠️
tool/transport_common.cc 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3407      +/-   ##
==========================================
- Coverage   78.20%   78.13%   -0.07%     
==========================================
  Files         695      696       +1     
  Lines      124220   124220              
  Branches    17263    17265       +2     
==========================================
- Hits        97148    97065      -83     
- Misses      26151    26319     +168     
+ Partials      921      836      -85     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Five of the seven SClientTest cases connect to amazon.com:443 and fail intermittently in CI when egress is unavailable or rate limited. They now live in tool-openssl/s_client_integration_test.cc, built into the integration_test executable alongside the OCSP responder tests.

integration_test is deliberately absent from util/all_tests.json, so the default test run (go run util/all_tests.go, ninja run_tests) never invokes it. Environments without outbound access, such as internal sandbox builds, get a hermetic default suite without needing to opt out of anything.

NoConnect and Help do not open a connection, so they stay in tool_openssl_test. The moved tests are renamed to the SClientIntegrationTest suite to match OCSPIntegrationTest and to keep binaries distinguishable in logs.
@justsmth
justsmth force-pushed the skip-remote-connection-tests branch from 41c78da to 614a2a1 Compare August 5, 2026 21:07
@justsmth justsmth changed the title Add AWSLC_SKIP_REMOTE_CONNECTION_TESTS and fix a getaddrinfo crash in Connect Move network-dependent s_client tests into integration_test, fix getaddrinfo UB Aug 5, 2026
@justsmth

justsmth commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

Per Samuel's recommendation, I instead moved the tests that connect to live endpoints into the "integration_test".

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.

4 participants