Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: crash in safeStorage on Linux #34147

Commits on May 9, 2022

  1. fix: fix a crash in safeStorage on Linux

    On Linux, `isEncryptionAvailable()` was crashing instead of returning a
    boolean before the 'ready' event was emitted by the app. The reason of
    the crash is that [`CreateKeyStorage()`](https://source.chromium.org/chromium/chromium/src/+/main:components/os_crypt/os_crypt_linux.cc;l=74;drc=35be6215ec8f09e50176f36753c68f26c63d1885;bpv=1;bpt=0)
    expects the config to be set but the function responsible for setting the
    config, [`SetConfig()`](https://source.chromium.org/chromium/chromium/src/+/main:components/os_crypt/os_crypt_linux.cc;l=237;drc=35be6215ec8f09e50176f36753c68f26c63d1885;bpv=1;bpt=0),
    is called only after the app is ready inside [`PostCreateMainMessageLoop()`](https://github.com/electron/electron/blob/main/shell/browser/electron_browser_main_parts.cc#L499).
    So this changes `IsEncryptionAvailable()` to return `false` when the app
    is not ready on Linux and uses that instead of the raw API in other
    places like `EncryptString()` and `DecryptString()`.
    
    Fixes: #32206
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen authored and electron-bot committed May 9, 2022
    Copy the full SHA
    3476d6a View commit details
    Browse the repository at this point in the history