fix(http): trust the system CA list for HTTPS requests #11134
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11134"
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:12:47Z.
What
Depends on #9834, which adds libSceHttp's request transport. The libSceSsl helper this PR calls came from #11145, now merged. The stack, from the bottom:
974dfd5ade, unchanged;claude/9834-fixes-1031):mainremoved;The libSceSsl code is the one merged with #11145, as MarcZX10 asked on #11145.
With #9834, every HTTPS request that doesn't install a verify callback fails with
0x80431063, last error0x8095F00C(unknown CA). The cause is that the libSceSsl context the title passes tosceHttpInitstarts with no trust anchors unless the title loads some itself. Titles that rely on the console's built-in trust can't reach any public server.sceHttps*function, loads no certificate and installs no verify callback. Its README reports the Google Drive backup working on firmware 12.40.sceHttpsEnableOptionbefore fetching its public catalog.On the console, both requests pass the known-CA check against public roots, so the system must trust them by default. That is inferred from the titles, not measured.
The change (the libSceSsl parts came with #11145):
/<sandbox word>/common/cert/CA_LIST.cer, once per process. libkernel already serves that file from the host trust store (#5280). The roots are parsed into a separate allocation pool, so they aren't charged to the title'ssceSslInitpool; PokeMMO's is 512 KiB.SslTrustSystemRoots_nid_no_patch(connection), makes one connection trust those roots after the context's own authorities. The session links them into the chain instead of copying them, and unlinks them before freeing.sceSslCreateConnection, and whatsceSslGetCaListandsceSslGetCaCertsreport. Whether a direct libSceSsl connection on the console trusts the system roots is not measured.Tested
Windows 11 Pro (26300), Ryzen 5 7600X, WinLibs GCC 15.2.0, Release, full build of head
35c09d332f(merges cleanly intomaine49d43d625). 164 of 164 pass: the 98 tests that libSceHttp, libSceHttp2, libSceSsl and libSceNet register (including the two trailer cases inguest_http_transportand #11145's five system CA list tests),public_headerswith its 64 compile tests, andguest_offline_imports. The libSceHttp code of this PR is unchanged from the earlier stack; the title runs below were made on that stack:guest_http_transportwith a new no-callback case.cloud: POST send failed (0x80431063). With it:sign-in code shown (… at https://www.google.com/device));client update: download done, 92 MB in 2 s,RESULT client.update PASS);sceAppInstUtilInitializewithout it, from a cleared/data/prosperostore, 60 s each:The new
guest_http_transportcase makes an HTTPS request with no callback to the fixture TLS server:SSL_CERT_FILEto the fixture root, so the request succeeds. With thelibSceHttpcall removed, the test fails. The transport and libSceSsl tests pass.0x8095F00C.tools/check_conventions.py --base origin/mainpasses.Checklist
main; no other open PR implements the same functionsNotImplemented_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:16:29Z.
Review: CHANGES_REQUESTED
I found one blocking input-bound issue in the chunked response reader; details are attached to the terminal-chunk loop below. I did not complete a full review of the 2,194-line diff, so this request is limited to that finding.
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T06:33:52Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The PR's own change, the
SslTrustSystemRoots_nid_no_patchcall and its test, builds, passes and fails without the fix. But the branch no longer merges into currentmain: it conflicts indocs/dev/debt/libSceHttp.md.What I ran
477088125636734d8635ff8d0d30f82ca4209526(merge base750cf6cf487f948017295b1f3717af6f886f0f85)main:2960e9a6e7e1fc99c4ed180c71495b5eb83464c7Because of the conflict, the build and the tests ran on the PR head, not on a merge with current
main.Results
main2960e9a6e7docs/dev/debt/libSceHttp.mdgit diff --checktools/check_conventions.py --base origin/mainAll conventions checks passed.guest_net_ctlskipped)guest_http_transportSslTrustSystemRoots_nid_no_patchcall)guest_http_transportfails (Subprocess aborted)guest_http_transportfails (Subprocess aborted)449a38aa08core/libs/prx/libSceHttp,core/libs/tests/networking,HttpTransportContextAllocation.cpporGuestHttp.cppMerge output
Selected test lines
Negative control A
Negative control
The transport (
Request.cpp) does not exist onmain, so restoring every production file fromorigin/mainwould leave the test unable to compile. Instead I reversed only the production hunks of each fix:SslTrustSystemRoots_nid_no_patchcall from 9c4bf03871,guest_http_transportaborts. That is the expected result, since the newCheckSystemRootTrustcase sends an HTTPS request with no verify callback. The test prints no case name, so I did not confirm which case aborted.DropConsumedfrom 36c6473fd3,guest_http_transportaborts. This is new evidence on MarcZX10's changes request about the unbounded trailer loop: the bound is present and the regression test covers it. I did not check the original review thread line by line.With the production files restored, the test passes again.
Findings
Blocking
mainindocs/dev/debt/libSceHttp.md.mainnow has #11503, which extends thesceHttpParseResponseHeaderentry with the PPSA01494 and PPSA34502 call sites (main L14-L15). This branch rewrites the last sentence of the adjacentsceHttpSetCookieEnabledentry (head L14-L15). The resolution looks mechanical: keepmain'ssceHttpParseResponseHeadertext and the branch's new cookie sentence ("No cookie store is implemented, so the request transport neither keeps nor adds cookies."). The checklist's "Based on currentmain" line is not true until you rebase.Non-blocking
mainwritesanyps5-http-roots-<pid>.pemtostd::filesystem::temp_directory_path()and never removes it (GuestHttpTransport.cpp L538-L544), so every run on Linux adds one file. Suggestion: remove it before returning, or write it into the test's working directory asGuestSandboxCertificates.cppdoes.SSL_CERT_FILE, libkernel writes the fixture root tocert_cache/CA_LIST.cerin the current directory.guest_http_transportruns in libSceHttp's shared binary directory (CMakeLists.txt L53); after my run, acert_cache/CA_LIST.cerwas left there, holding the single "AnyPS5 Tests" fixture root.guest_http2_system_rootsgives itself a dedicatedWORKING_DIRECTORY(libSceHttp2 CMakeLists.txt L55-L57). Doing the same here would keep the fixture cache out of other tests' way.Depends online names #9834 and the extra commits; it could also name #9630, since the author's own comment says this cannot merge before it. On Windows,CheckSystemRootTrustonly checks the unknown-CA failure, so there the success path through the system roots is covered only by the libSceSsl tests from #11145. I could not run it on Windows.Not verified
750cf6cf48).CheckSystemRootTrust.tools/pr_overlap.pywas not run.To get this to a good state
mainand resolve thedocs/dev/debt/libSceHttp.mdconflict as described above.guest_http_transportits ownWORKING_DIRECTORY, and add #9630 to theDepends online.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T07:10:13Z.
Review: CHANGES_REQUESTED
Re-checked — new head, changes still requested
The author’s restack and Windows report address the earlier dependency update, but this head still conflicts with current
mainin the HTTP debt file.What I ran
477088125636734d8635ff8d0d30f82ca4209526against currentmainedf6804cf52c62eacafc592dd6142cb4efe5bd05.git merge-base,git merge-tree --write-tree,git diff --name-status, andgit diff --check.Results
750cf6cf48docs/dev/debt/libSceHttp.mdlibSceNet/Export.cppanddocs/dev/debt/libSceHttp.md4770881256merged with main750cf6cf48; this is not currentmainUnedited available command output
Negative control
mainFindings
Blocking
mainand reconcile thelibSceHttpdebt entry. Main also changedlibSceNet/Export.cppafter the report's base, so rerun the focused integration tests on the refreshed head before requesting another review.Non-blocking
Sources
Not verified
To get this to a good state
mainand the resulting head, and report the exact commits.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T09:02:51Z.
Review: CHANGES_REQUESTED
Re-check — changes requested\n\nThanks, this resolves the earlier HTTP debt conflict and the unbounded chunk-trailer fix is now present in the stack. The Windows report covers 97 HTTP/HTTP2/SSL/Net tests and conventions on the refreshed
4c7d275befbase.\n\nCurrent upstream main has since advanced toaaccd0ba39, and this head is 44 commits behind it. CONTRIBUTING requires keeping the branch up to date with main. Please sync this head to the current main and rerun the relevant HTTP tests and conventions on the resulting exact head. I did not run them locally.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T13:05:21Z.
Review: APPROVED
Re-checked — approved
The rebase onto
main5454cd2e45resolves thedocs/dev/debt/libSceHttp.mdconflict that blocked my last review; the merged tree builds, the HTTP, SSL and net tests pass, and the new test still fails without the fix.What changed since my last review
4770881256→0618c3d9c1, rebased frommain750cf6cf48(via4c7d275bef) to5454cd2e45.git range-diffover the 15 commits: 14 are identical. Only the first #9834 commit (859d586ef7) changed, indocs/dev/debt/libSceHttp.md: the conflict resolution described in the author's comments.main'ssceHttpParseResponseHeadercall-site sentence (PPSA01494, PPSA34502) andmain'ssceHttpWaitRequestsentence are kept, and so is the branch's new cookie sentence ("No cookie store is implemented, so the request transport neither keeps nor adds cookies.").449a38aa08:git range-diffshows 9 of 10 identical, and the first one differs only in context lines from the different bases (GuestOfflineImports.cpp, the debt file).Unblocks: PPSA98001 #12762, PPSA99000 #12763. The author reports a Windows rerun on0618c3d9c1: 97 tests,guest_offline_importsand conventions pass. I accept that as author-reported.What I ran
0618c3d9c135aa5799867caf9550922256fd77b5main:899ae3d1ad32ccea94dc24e66fdc948ce8a88171(merge base5454cd2e455994d992aca39335ce60507eeda1eb)8dcc97550bmain899ae3d1adgit diff --checktools/check_conventions.py --base origin/mainAll conventions checks passed.guest_net_ctlskipped)SslTrustSystemRoots_nid_no_patchcall)guest_http_transportaborts; passes again once restoredSelected test lines
Negative control
Previous findings
docs/dev/debt/libSceHttp.md: Resolved. The merge with currentmainis clean, and both sides' sentences are present (lines 14-15 of the merged file).WORKING_DIRECTORYforguest_http_transport: Still open. CMakeLists.txt L53-L54 is unchanged.Depends online still names only #9834.New findings
Blocking
None.
Non-blocking
Testedsection names an old base. It still says head4770881256onmain750cf6cf48and #9834 head2a6b65da00. The rerun on0618c3d9c1and #9834's449a38aa08appears only in the latest comment. Copying that into the description would keep the description and the head in step.Not verified
CheckSystemRootTrust.tools/pr_overlap.pywas not run.The approval covers this PR's change on top of the bundled #9834 commits. It still has to merge after #9630 and #9834, as the author says.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-30T14:36:55Z.
Review: COMMENTED
This head fails
public_headers, both on its own and merged into currentmain.Ubuntu 26.04, i7-8700, GCC 15.2, Release,
BUILD_TESTING=ON. Head0618c3d9c1merged (--no-commit) ontomainf91137142e. The merge is clean and the full build passes. All HTTP/SSL/net tests pass exceptpublic_headers(38/39). The build CI doesn't run on PRs, so it didn't show up here.The audit finds 43 exports declared a second time outside their public header. All of them come from the
extern "C"blocks in the #9834 files of this stack, and #9834's headb6df6465e7fails the same way:libSceHttp/src/Request.cpp:33-55: thesceNet*andsceSsl*exports andsceHttpUriParse,sceHttpUriMerge,sceHttpParseStatusLine;tests/networking/GuestHttpTransport.cpp:41-64andtests/HttpTransportContextAllocation.cpp:11-20: thesceHttp*,sceNetInitandsceSslInit/Termexports.It goes away if those files include
prx/libSceHttp/include/Http.hpp,prx/libSceNet/include/Net.hppandprx/libSceSsl/include/Ssl.hpp, and theAPS5_VABIlines are dropped. The signatures match the headers.Request.cppkeeps its four*_nid_no_patchlines. One more change is needed:HttpTransportContextAllocation.cppthen has to passreinterpret_cast<::HttpMemoryPoolStats*>(buffer)tosceHttpGetMemoryPoolStats, because the header takes a typed pointer.With that change (3 files, +9/-55), on the same merge:
public_headersand the 64public_headers_compile_*: 103/103 pass.guest_http_transport*: passes 3/3.I checked this on Linux only. The Windows side,
Net.hppincluded afterwinsock2.h, isn't tested.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-30T20:18:08Z.
Review: COMMENTED
Re-checked
f9f85640fdon Linux:public_headerspasses, so both sides are covered now.Ubuntu 26.04, i7-8700, GCC 15.2, Release,
BUILD_TESTING=ON. Head merged (--no-commit) onto currentmain16345cad6a; clean merge, full build OK.public_headersandguest_http_transport*: pass 3/3.public_headers*andguest_offline_imports: 160/160.f9f85640fdon the merge brings back the same 43 duplicate declarations andpublic_headersfails.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-02T23:10:26Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
This pull request does not merge cleanly into
main(5cb015caaa): head35c09d332fconflicts incore/libs/prx/libSceHttp/CMakeLists.txtPlease rebase it onto current
main. I will review the change once it merges cleanly.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T07:53:55Z.
Review: COMMENTED
Reviewed — comments
Nothing blocks this; the points below are optional.
What I ran
Inspected the prepared diff and changed source at head
35c09d332f3e86b6846ba05a25f662e25e8b7de9throughrepo_read.py. No build or tests were run during this review.Results
Findings
Blocking
None.
Non-blocking
HostResolver::Start()leaves already-started detached workers alive if creation of a later worker throws, then the failure path deletes the resolver they access. If fewer than four workers can be created, this can leave threads using freed resolver state. Seecore/libs/prx/libSceHttp/src/Resolver.cpp:44.Not verified
manifest.jsonwere not individually cross-checked against the diff.To get this to a good state
Nothing is required. Consider making resolver worker startup all-or-nothing, or retaining the resolver for the lifetime of any successfully started worker.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.