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

Conversation

trop[bot]
Copy link
Contributor

@trop trop bot commented May 9, 2022

Backport of #33913

See that PR for details.

Notes: Fixed 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>
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label May 9, 2022
@trop trop bot mentioned this pull request May 9, 2022
5 tasks
@trop trop bot added 19-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels May 9, 2022
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label May 9, 2022
@codebytere codebytere changed the title fix: fix a crash in safeStorage on Linux fix: a crash in safeStorage on Linux May 10, 2022
@codebytere codebytere changed the title fix: a crash in safeStorage on Linux fix: crash in safeStorage on Linux May 10, 2022
@jkleinsc jkleinsc merged commit b07e17a into 19-x-y May 11, 2022
@jkleinsc jkleinsc deleted the trop/19-x-y-bp-fix-fix-a-crash-in-safestorage-on-linux-1652103652246 branch May 11, 2022 14:20
@release-clerk
Copy link

release-clerk bot commented May 11, 2022

Release Notes Persisted

Fixed a crash in safeStorage on Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
19-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants