fix(http2): trust the system CA list for HTTPS requests #11145
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11145"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by p3n1cillin on 2026-10-25T19:33:39Z.
What
#10167 (libSceHttp2's HTTP/2 transport) has merged, and it already accepts
is_auto_proxy_conf0 and 1. This PR is based directly onmainf759e165d9and has five commits. They fix what still stops the catalog titles that use libSceHttp2 from reaching an HTTPS server.Default trust. Each libSceSsl context starts with no trust anchors, so a request without a verify callback throws
sceHttp2: TLS failed. None of the four titles that use libSceHttp2 loads a certificate or installs a callback:netxm.c;webui_update.cpp;fetch.cpp;porpoise_http.cpp.The change:
SslTrustSystemRoots_nid_no_patch. For one connection, it trusts the system CA list after the context's own authorities. The list is/<sandbox word>/common/cert/CA_LIST.cer, which #5280 serves from the host trust store.sceSslCreateConnection.Dropped from this PR:
is_auto_proxy_confchange: #10167 covers it.WSAStartupof the title's own now resolves without it (probe below), so that commit is gone.One copy of the libSceSsl helper. This PR now owns
SslTrustSystemRoots_nid_no_patch. That includes thelibkernellink thatguest_ssl_context_lifetime_testsneeds for it. #11134 (libSceHttp) is restacked on this PR and only adds its call, so the merged stack has one implementation. This PR doesn't depend on #11134.The debt entries record what is inferred and what isn't measured: that the console's roots are exactly this file.
Tests in this PR
Each test serves its own
CA_LIST.certhrough the working-directory override of the sandbox path thatguest_sandbox_certificatescovers, so they don't depend on the host's trust store. I have run them on Windows only.guest_ssl_system_roots(libSceSsl), against the fixture loopback server:system(list = fixture root): a context without certificates fails the handshake with0x8095f00cwithout the helper and connects with it; a context with an unrelated authority does the same, so the list is trusted after the context's own chain. Adding the list to a started connection throws, and an unknown id returns0x8095f006.context(list without the fixture root): a context that loaded the fixture root still connects with and without the helper; a context without certificates still fails with the helper.emptyandblank(empty list, list with no certificate): the helper throws with the path, twice.guest_http2_system_roots(libSceHttp2): a request from ansceSslInitcontext with no loaded certificate reaches thelocalhostloopback server over h2, with the host name and known-CA checks on.Mutation checks on this head:
Export.cpp,guest_ssl_system_roots_emptyand_blankfail.SslTrustSystemRoots_nid_no_patchcall inTransport.cpp,guest_http2_system_rootsfails andguest_http2_transportstill passes.Tested
Windows 11 Pro (26300), Ryzen 5 7600X, WinLibs GCC 15.2.0, Release. Full build of this branch (head
c38629b159) onmainf759e165d9:main74acfad65b, same trust code): a native probe makes RetroArch's updater request:sceHttp2Init, thensceHttp2CreateTemplate(http, "PS5-RetroArch-Updater/1", 3, 1), then GET, with noWSAStartupof its own.https://github.com/andhttps://www.google.com/both return 200 over h2.SslTrustSystemRoots_nid_no_patchcall removed from the transport, the same request throwssceHttp2: TLS failed.tools/check_conventions.py --base f759e165d9passes. The fifth commit, from @oneandonlydean's review, takes the kernel file calls from libkernel'sFile.hppandApi.hppinstead of a localextern "C"block. No title was run on this head: the four titles' libSceHttp2 requests are user-triggered (updater, model download) or plainhttp://(OliSe).Title evidence, from @wachi35676 (comment): PSFlyCast (PPSA99247) and PSSwanStation (PPSA99248) check the GitHub API for updates through libSceHttp2. That comment covered the earlier head, stacked on #10167, which had the same trust code.
mainbefore #10167 merged, both fail with0x80436063.More title evidence, from @JJenkx (comment): on Linux, PPSA06652's HTTP/1 request reaches TLS with these CA commits and #11611's stack, with verification callbacks reporting
errors=0. Without them,sceSslConnectfails with0x8095f0fd.Checklist
main; no other open PR implements the same functions (#11134 is stacked on this PR and reuses its libSceSsl helper)NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T19:40:33Z.
Review: DISMISSED
Reviewed the current PR metadata and overlap against exact head
d5cfffa51914a7521731addf5a5eea7c0b2a972e.Two integration blockers remain before this stack can be reviewed as merge-ready:
CONFLICTING/DIRTYwith the currentmainand labels itneeds rebase. The branch is stacked on #10167's older head, so the current PR checks do not include a build or focused test run for a clean merge with today's base. Please resolve the current-main conflicts on your branch, then rerun the relevant tests on that rebased tree.SslTrustSystemRoots_nid_no_patchand its libSceSsl implementation, while open #11134 adds the same helper and CA-list behavior. The body acknowledges that overlap but the checklist only saysDepends on: #10167. Please declare and coordinate the #11134 ordering, then remove/reuse the duplicate helper when rebasing so the merged stack has one implementation. #11134 currently has an outstanding review request, so this may need to wait for that resolution.I did not rebase or modify the author's branch. Current conventions, intake and labels checks pass, but they do not clear the merge conflict or validate the product code on the current base. No approval until these stack issues are resolved.
Imported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-25T21:45:51Z.
Review: COMMENTED
Reviewed head
d5cfffa519by reading the diff and the existing review thread. I did not build or run this, so everything below is from the code, not from a test of mine.Scope note first. The diff here is 12 files and about 1,500 added lines because the PR is stacked on #10167 (the HTTP/2 transport), which is not merged. The description says only the last two commits are new, but GitHub shows the whole stack, and the PR is DIRTY against
main. I did not review the transport itself line by line. This review covers what the description says is new: automatic-proxy acceptance, the Winsock start and the system-roots trust in libSceSsl. I'd suggest retargeting this onto #10167's branch, or waiting until #10167 lands, so the diff shows only the two commits.libSceSsl (
SslTrustSystemRoots_nid_no_patch).authoritieslist. The destructor setslinkedSystemRoots->next = nullptrbeforembedtls_x509_crt_free(&authorities), so the shared chain is not freed with the session. That is the part I would have worried about, and it looks right.trustedpoints directly at the shared chain; mbedTLS only reads it, so concurrent sessions are fine.ReadSystemCaListreturns an empty string if the file cannot be opened, andSystemRoots()then caches an empty chain for the rest of the process. A transient failure to open the sandboxed path therefore disables trust permanently, with no message. A one-line diagnostic on the empty result, or not caching a failure, would help.std::string("/") + sceKernelGetFsSandboxRandomWord()is undefined if that function returns null. Presumably it never does; a guard costs nothing.Resolver. It calls
WSAStartupin the constructor of a function-local static and has no matchingWSACleanupin the visible destructor path. For a process-lifetime singleton that is harmless in practice, but it will unbalance the Winsock count if the resolver is ever torn down earlier.Proxy. Accepting
is_auto_proxy_confand connecting directly is a reasonable stance given there is no system proxy setting, and the debt entry says the console behaviour is inferred.I'm leaving a comment. MarcZX10's
CHANGES_REQUESTED(the rebase and the stack integration) is the blocker, not anything in the parts I read.AI-assisted: yes. Written with AI assistance and reviewed by me.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-27T03:23:36Z.
Review: CHANGES_REQUESTED
Checked the rebased head: the chain linking in
Session::Configureand the unlink in~Sessionare correct, the system list is shared read-only, and the debt entries are in place. Two things before merge:core/libs/prx/libSceSsl/Export.cpp:892(SslTrustSystemRoots_nid_no_patch) and the call inTransport.cpp:354have no test in the repo; the only test change is thelibkernellink. The Windows probe in the description can't be re-run from the tree. A Linux test is possible with what's already there:GuestSandboxCertificates.cppsetsSSL_CERT_FILEto serve a chosen bundle atCA_LIST.cer, andGuestHttp2Transport.cpp/SslCertificateFixture.hpphave a loopback server with its own CA. Serve the fixture root as the system list, then check that a connection withoutsceSslLoadCertfails the handshake without the helper and succeeds with it (and that a context-loaded CA still works alongside it).Export.cpp:223: an empty CA list returns an empty chain andSystemRoots()then returnsnullptr, so the connection silently trusts nothing, which is the failure this PR fixes. Throw (naming the path) when the file is empty or yields no certificate, like the missing-file case.Title evidence from @wachi35676 and @JJenkx is noted; once the test is in, this is ready.