Skip to content

SSL: try the system CA bundle first, never pass a null cert path - #60

Merged
antirotor merged 3 commits into
ynput:developfrom
SunriseProductions:bugfix/contrib-ssl-system-ca-first
Nov 4, 2026
Merged

antirotor merged 3 commits into
ynput:developfrom
SunriseProductions:bugfix/contrib-ssl-system-ca-first

Conversation

@DexterSchenk

@DexterSchenk DexterSchenk commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The USD resolver fails to start in Houdini 22 with RuntimeError: basic_string::_M_construct null not valid.

  • With no AYON_SSL_CERT_PATH set, setSSL() shells out to openssl version -d.
  • Houdini 22's hython puts $HFS/dsolib first on LD_LIBRARY_PATH whenever that variable is already set, and the ayon-usd launch hook sets it. The system openssl binary then loads Houdini's libcrypto and fails with undefined symbol: BIO_new_dgram_sctp.
  • The CLI's empty output makes parseOutput throw, and that exception escapes setSSL() straight away: the later fallbacks (compiled-in OPENSSLDIR, bundled certs/cacert.pem) are never tried.
  • The constructor's catch then calls set_ca_cert_path(nullptr). httplib takes a std::string, so constructing one from null throws, and the whole AyonApi init aborts.

Houdini 21 is unaffected: its libcrypto is compatible with the system openssl.

Fix

  • On Linux, check the standard system CA bundles before running the CLI: /etc/pki/tls/certs/ca-bundle.crt (RHEL/Rocky), /etc/ssl/certs/ca-certificates.crt (Debian/Ubuntu), /etc/ssl/ca-bundle.pem (openSUSE), /etc/ssl/cert.pem (Alpine/Arch). Where one exists, this also skips the popen on every init. macOS keeps the CLI's OPENSSLDIR first (e.g. Homebrew's bundle, which can carry keychain CAs).
  • A failing CLI or OPENSSLDIR lookup now logs a warning and falls through to the next source, ending at the bundled certs/cacert.pem.
  • Drop the set_ca_cert_path(nullptr). httplib then uses its default CA lookup: OpenSSL's default verify paths on Linux, the system store on Windows, the keychain on macOS when built with CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN. The error log says so.

AYON_SSL_CERT_PATH and SSL_CERT_FILE still take precedence, as before.

Testing

Rocky 9, Houdini 22.0.368, ayon-usd-resolver built against this change, a hosted AYON server, LD_LIBRARY_PATH set, no cert env vars:

Build Result
without this change basic_string::_M_construct null not valid; the resolver never initialises
with this change Using system CA bundle: /etc/pki/tls/certs/ca-bundle.crt; numbered and hero ayon:// URIs resolve, and both test stages open
  • The resolver also builds and runs with this change on Houdini 21.0.559/700/792, Maya 2026.2 and standalone OpenUSD 25.05, all without cert env vars.
  • The nullptr removal isn't exercised by that run, because the system bundle is found first.
  • The fall-through commit (9523234, from an independent review) is syntax-checked against the pinned httplib/spdlog/json headers; it only wraps the two lookups and changes no path when a bundle is found.

🤖 Generated with Claude Code

DexterSchenk and others added 2 commits October 30, 2026 08:08
On Linux the CA lookup shells out to `openssl version -d`. Houdini 22's hython puts its dsolib on
LD_LIBRARY_PATH, so the system openssl binary loads Houdini's libcrypto and fails
(undefined symbol: BIO_new_dgram_sctp). The compiled-in OPENSSLDIR has no cert.pem either, so setSSL
throws, and the constructor's catch called set_ca_cert_path(nullptr). That builds a std::string from
null (basic_string::_M_construct null not valid) and aborts the whole AyonApi init, so the resolver
never starts.

- check the standard system bundles (RHEL, Debian, macOS) before running the CLI
- drop the null set_ca_cert_path; httplib then uses OpenSSL's default verify paths

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
setSSL() let the exception from getOpenSSLDirByCLI() escape when the `openssl` CLI was missing or
broken (empty output -> parseOutput throws), so the compiled-in OPENSSLDIR and the bundled
certs/cacert.pem were never tried. Both lookups now log a warning and fall through.

The system bundle list runs on Linux only (plus the openSUSE path): on macOS the CLI's OPENSSLDIR,
e.g. Homebrew's bundle that can carry keychain CAs, stays ahead of the stock /etc/ssl/cert.pem as
before. The constructor's comment and error log now say what httplib falls back to per platform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YRNAzpFt5VwUwBTHRbRQRm

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The throwing is_regular_file probe can abort certificate discovery on an inaccessible candidate, skipping later usable system, OpenSSL, and bundled certificates.

1 open issue
What changed in this PR

This PR addresses SSL initialization failures in Houdini 22 by improving CA bundle discovery and removing a null certificate-path call that aborts AyonApi construction.

Changes:

  • Prefer standard Linux CA bundles before invoking OpenSSL, while preserving certificate environment-variable precedence.
  • Catch CLI and compiled-in OpenSSL directory lookup failures so discovery can continue.
  • Leave httplib’s default CA lookup enabled when discovery fails, rather than passing a null path.
File Description
src/​AyonCppApi/​AyonCppApi.cpp Updates CA bundle selection, lookup fallbacks, and constructor error handling.

Review effort: Balanced

Comment thread src/AyonCppApi/AyonCppApi.cpp Resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@antirotor
antirotor merged commit 320a4b3 into ynput:develop Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants