Cherry pick PR #11413: Load SSL root certificates to memory at app start#11539
Cherry pick PR #11413: Load SSL root certificates to memory at app start#11539cobalt-github-releaser-bot wants to merge 1 commit into
Conversation
|
Caution There were merge conflicts while cherry picking! Check out cherry-pick-25.lts.1+-11413 and fix the conflicts before proceeding. Check the log at https://github.com/youtube/cobalt/actions/runs/30115628314 for details. |
🤖 Gemini Suggested Commit Message💡 Pro Tips for a Better Commit Message:
|
c4460af to
c87bafa
Compare
There was a problem hiding this comment.
Code Review
This pull request refactors TrustStoreInMemoryStarboard to eagerly load all trusted root certificates from disk at startup rather than loading them lazily on demand. This simplifies the class by removing the need for thread synchronization (load_mutex_) and custom hash-based certificate lookup logic. The review feedback suggests optimizing the certificate loading process by caching the certificate directory path instead of repeatedly calling GetCertificateDirPath() inside the loop.
c87bafa to
7e1dda9
Compare
This pull request loads the SSL root certificates at startup directly into the bssl trust store. It also safely guards TryLoadCert against triggering NOTREACHED() if a certificate file fails to load at runtime. This is a new issue with C26/C27 because we switched to 2-slot, one system image, and one installation slot. When the app is updated from system image and runs the package from the installation slot, right before it downloads an update, it'll wipe the installation slot including its own certs, which caused the issue. But before C26, there're 3 slots in total, and the updater doesn't wipe its own slot. On the other hand, the core content (cobalt_shell.pak) and UI fonts (SkFileMemoryChunkStream) are safe from this wipe because they use base::MemoryMappedFile and hold a persistent FILE* handle, which the OS honors natively. Issue: 535681824, 533843031 (cherry picked from commit f5d2add)
7e1dda9 to
aed49bd
Compare

Refer to the original PR: #11413
This pull request loads the SSL root certificates at startup directly into the bssl trust store. It also safely guards TryLoadCert against triggering NOTREACHED() if a certificate file fails to load at runtime.
This fixes a security vulnerability of forged cert with matching subject.
Issue: 533843031