Skip to content

Feat/sandbox ca list 5001 - #5091

Closed
MrMha wants to merge 2 commits into
boykopovar:mainfrom
MrMha:feat/sandbox-ca-list-5001
Closed

MrMha wants to merge 2 commits into
boykopovar:mainfrom
MrMha:feat/sandbox-ca-list-5001

Conversation

@MrMha

@MrMha MrMha commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What

Propose a host-provided certificate bundle for /<sandbox word>/common/cert/CA_LIST.cer, addressing #5001. Carry screamm's offered commit dc51db5b4c517f731c07247b7702febd529e7922 without changing its implementation; the integration retains the original commit as a parent and preserves its authorship.

Add a libc path-provider registration API for an exact normalized, case-insensitive guest path. Libkernel registers the certificate path and generates its contents on the first resolution. Windows exports certificates from the current user's ROOT and CA stores. On non-Windows hosts, the provider uses the first readable regular file among SSL_CERT_FILE and the configured distro bundle paths.

The provider writes the selected bytes to cert_cache/CA_LIST.cer, setting a newly written cache file read-only, and caches the resolved path for the process. It checks for a BEGIN CERTIFICATE marker; it does not parse or validate certificates. An empty result falls back to ordinary guest-path resolution. Sibling paths receive no provider mapping.

The host trust-store design and console file format remain unverified. This PR is a design proposal; draft status is recommended until the design and implementation gaps below are resolved.

Tested

Prior local validation recorded for head 52fa8c361570d557d2ed115fb629183c4cb922b5: Linux x86-64, GCC 13.3.

  • Four focused native resolver/provider cases passed: explicit SSL_CERT_FILE, distro fallback, input without a certificate marker, and a blocked cache-directory write.
  • Checks covered bytes, normalized/case-insensitive lookup, new-cache permissions, timestamps and sibling names. The tested paths left no temporary files; this does not establish cleanup after every failure.
  • All four cases also passed with ASan/UBSan. LeakSanitizer was unavailable.
  • Compilation used C++20 and -Wall -Wextra -Werror; -Wno-deprecated-declarations covered the existing std::filesystem::u8path use. Local code-convention and whitespace checks were reported as passing.
    Those four results were supplied in the work record and were not rerun here. This review separately compiled the unchanged production certificate-provider source with a minimal provider-registration harness on Linux/GCC 13.3. Precreating an identical owner-writable cache reproduced the permissions bug described below. This harness does not exercise the real guest resolver, kernel/stream wrappers or TLS.

No full runtime build, guest_sandbox_certificates CTest, Windows-store export or title run is claimed for this integration head. Historical Windows/title and Linux results in #5001 concern the original branch and, for titles, additional patches. The inspected GitHub full Linux/Windows runtime jobs were skipped.

Outstanding work

  • Resolve the reproduced cache-permissions bug: the identical-content early return bypasses permission enforcement, so an existing writable cache stays writable.
  • Failure cleanup needs review: after temporary-file creation, later permission or rename failures can throw without removing the temporary file. This is a source-inspection finding, not a reproduced failure in this review.
  • Coordinate overlap with fix(libc): preserve path services through process exit #4994 in General.cpp and fix(libc): fail a rename of a path that ends in a dot component with EINVAL #5008 in libkernel's test registration. Their implementations concern path-service lifetime and rename semantics, respectively; these overlaps do not by themselves establish dependencies.
  • At inspected main 5d50886ee4045dc2a081d8d93bf8e667f6d82325, this branch was 36 main commits behind, with merge base c7632f036f68f71a5e514f5b20f6df68a9062ada. Update it while preserving the carried commit and validate the resulting head.

Checklist

  • Based on current main; no other open PR implements the same functions (see outstanding work above)
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no silent stubs added
  • No notes, investigation files or images added to the repository
  • No new third-party code
  • Generic behaviour, not specific to one title
  • Depends on: none (implementation dependency; overlap coordination is outstanding)
  • Unblocks: none (no locally verified title progress or Game bring-up discussion)
  • AI-assisted: yes

screamm and others added 2 commits October 13, 2026 11:23
Titles that bundle OpenSSL load the console's CA file from the sandbox
directory and fail every HTTPS request without it. ProsperoRadio
(PPSA99001, libcurl 8.18.0 + OpenSSL 3.5.2) on main + boykopovar#4796 + boykopovar#4525:

  [ProsperoRadio][http] https://all.api.radio-browser.info/json/servers: Problem with the SSL CA cert (path? access rights?) (error adding trust anchors from file: /gkbHtXc3Wq/common/cert/CA_LIST.cer)

SwanStation (PPSA98510) stops on the same file (boykopovar#5001).

The guest path resolver now accepts exact-path providers, and libkernel
registers one for /<sceKernelGetFsSandboxRandomWord()>/common/cert/CA_LIST.cer.
On first use it writes a PEM bundle once per process to
cert_cache/CA_LIST.cer in the run directory, read-only: on Windows the
current user's ROOT and CA system stores, elsewhere SSL_CERT_FILE or the
first distro bundle that exists. Without a certificate the path keeps
resolving under the guest root and does not exist, as before. Every other
path under the sandbox word is unchanged. The console file's format and
the rest of its common/cert directory are unverified and recorded in
docs/dev/debt/libkernel.md.

With this change, boykopovar#4796, boykopovar#4525 and boykopovar#5025 on Windows 11, 60 s each:

  [ProsperoRadio][http] 11846160 bytes in 1458 ms: 1161 passes, 803 waits (679 woken) for 1428 ms
  [ProsperoRadio][catalog] page offset=0 bytes=11846160 objects=10000 accepted=9549 total=9549
  ...
  [ProsperoRadio][catalog] page offset=60000 bytes=1712035 objects=1494 accepted=1436 total=59371

  [SwanStationPS5] update: latest 1.2.5, this 1.1.3, available
  [SwanStationPS5] gamedb: index written

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Integrate screamm's dc51db5 without changing its implementation, preserving the original commit and author. Retain current-main technical debt entries.
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#5144 core/libs/prx/libkernel/File/src/SandboxCertificates.cpp
core/libs/tests/GuestSandboxCertificates.cpp
#5280 core/libs/prx/libkernel/File/src/SandboxCertificates.cpp
core/libs/tests/GuestSandboxCertificates.cpp

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.

@MrMha

MrMha commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Title-need evidence relevant to the closure, attributed to an existing public run rather than a new local title test:

@babyhuey's 14 October report on #5280 identifies ProsperoLichess, PPSA99009, Game bring-up #4982. On the reported main baseline f40b6930, Windows 11 / RTX 3080 / WinLibs GCC 15.2 Release, its log has:

ca=/gkbHtXc3Wq/common/cert/CA_LIST.cer (MISSING)
curl 77

The same report says merging #5280's 8fd97c29 onto that baseline changes the CA lookup to found and produces lichess probe status=200; the daily puzzle and Lichess TV load. This supplies a named title and baseline failure for the missing CA-file use case. Those are the contributor's results on those revisions, not an independent rerun or a claim about today's main or this PR's unchanged head.

#5280 already carries the original certificate implementation with additional trust/precedence fixes. Its maintainer review says the host-trust design awaits a decision in #5001. This PR also still lists cache-permission/cleanup findings in its description. The evidence supports the need for a CA-path solution, while validation and the design decision remain necessary; it does not establish this branch as merge-ready.

AI-assisted: yes (Codex).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build docs libc libkernel needs rebase Conflicts with main, rebase needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants