Skip to content

Cherry pick PR #11413: Load SSL root certificates to memory at app start#11539

Open
cobalt-github-releaser-bot wants to merge 1 commit into
25.lts.1+from
cherry-pick-25.lts.1+-11413
Open

Cherry pick PR #11413: Load SSL root certificates to memory at app start#11539
cobalt-github-releaser-bot wants to merge 1 commit into
25.lts.1+from
cherry-pick-25.lts.1+-11413

Conversation

@cobalt-github-releaser-bot

@cobalt-github-releaser-bot cobalt-github-releaser-bot commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

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

@cobalt-github-releaser-bot

Copy link
Copy Markdown
Collaborator Author

MERGE CONFLICT CAT

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.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Gemini Suggested Commit Message


net: Load SSL root certificates at startup

Update TrustStoreInMemoryStarboard to load all SSL root certificates
into the BoringSSL trust store during initialization.

In some configurations, such as C26/C27 with a two-slot installation
model, the installation slot containing certificate files may be wiped
during an update while the application is still running. By loading
certificates into memory at startup, the browser avoids runtime crashes
caused by the disappearance of these files from the disk.

Additionally, this change ensures that certificate loading failures
do not trigger a NOTREACHED() crash at runtime.

Issue: 535681824
Issue: 533843031

💡 Pro Tips for a Better Commit Message:

  1. Influence the Result: Want to change the output? You can write custom prompts or instructions directly in the Pull Request description. The model uses that text to generate the message.
  2. Re-run the Generator: Post a comment with: /generate-commit-message

@yuying-y
yuying-y force-pushed the cherry-pick-25.lts.1+-11413 branch 2 times, most recently from c4460af to c87bafa Compare July 24, 2026 20:39
@yuying-y
yuying-y marked this pull request as ready for review July 24, 2026 21:17

@gemini-code-assist gemini-code-assist Bot 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.

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.

Comment thread net/cert/internal/trust_store_in_memory_starboard.cc Outdated
Comment thread net/cert/internal/trust_store_in_memory_starboard.cc Outdated
@yuying-y
yuying-y force-pushed the cherry-pick-25.lts.1+-11413 branch from c87bafa to 7e1dda9 Compare July 24, 2026 21:18
@yuying-y
yuying-y requested a review from oxve July 24, 2026 23:38
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)
@yuying-y
yuying-y force-pushed the cherry-pick-25.lts.1+-11413 branch from 7e1dda9 to aed49bd Compare July 24, 2026 23:39
@yuying-y yuying-y changed the title Cherry pick PR #11413: Load SSL root certificates to avoid runtime wipe crashes Cherry pick PR #11413: Load SSL root certificates to memory at app start Jul 24, 2026
@yuying-y
yuying-y enabled auto-merge (squash) July 24, 2026 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants