Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix encryption service not working on Linux#288

Merged
andrewpareles merged 1 commit intovoideditor:mainfrom
eswaldots:main
Feb 28, 2025
Merged

Fix encryption service not working on Linux#288
andrewpareles merged 1 commit intovoideditor:mainfrom
eswaldots:main

Conversation

@eswaldots
Copy link
Contributor

@eswaldots eswaldots commented Feb 16, 2025

Fixes API keys not storing and providers not working on Linux:

[main 2025-02-16T14:41:53.665Z] Error: Error while encrypting the text provided to safeStorage.encryptString. Encryption is not available.
    at EncryptionMainService.encrypt (file:///home/ezwal/Documents/void/out/vs/platform/encryption/electron-main/encryptionMainService.js:31:55)
    at Object.call (file:///home/ezwal/Documents/void/out/vs/base/parts/ipc/common/ipc.js:864:38)
    at ChannelServer.onPromise (file:///home/ezwal/Documents/void/out/vs/base/parts/ipc/common/ipc.js:290:31)
    at ChannelServer.onRawMessage (file:///home/ezwal/Documents/void/out/vs/base/parts/ipc/common/ipc.js:269:29)
    at UniqueContainer.value (file:///home/ezwal/Documents/void/out/vs/base/parts/ipc/common/ipc.js:220:69)
    at Emitter._deliver (file:///home/ezwal/Documents/void/out/vs/base/common/event.js:965:22)
    at Emitter._deliverQueue (file:///home/ezwal/Documents/void/out/vs/base/common/event.js:976:18)
    at Emitter.fire (file:///home/ezwal/Documents/void/out/vs/base/common/event.js:999:18)
    at UniqueContainer.value (file:///home/ezwal/Documents/void/out/vs/base/common/event.js:112:89)
    at Emitter._deliver (file:///home/ezwal/Documents/void/out/vs/base/common/event.js:965:22)
    at Emitter.fire (file:///home/ezwal/Documents/void/out/vs/base/common/event.js:994:18)
    at UniqueContainer.value (file:///home/ezwal/Documents/void/out/vs/base/common/event.js:131:102)
    at Emitter._deliver (file:///home/ezwal/Documents/void/out/vs/base/common/event.js:965:22)
    at Emitter.fire (file:///home/ezwal/Documents/void/out/vs/base/common/event.js:994:18)
    at fn (file:///home/ezwal/Documents/void/out/vs/base/common/event.js:469:40)
    at IpcMainImpl.wrappedListener (file:///home/ezwal/Documents/void/out/vs/base/parts/ipc/electron-main/ipcMain.js:24:17)
    at IpcMainImpl.emit (node:events:519:28)
    at WebContents.<anonymous> (node:electron/js2c/browser_init:2:82563)
    at WebContents.emit (node:events:519:28)
  • Credential/keychain stores are not commonly available on Linux environments, which prevents saving the API keys and models in the editor configuration.

To fix this, if the user does not provide a default text encryption option, the system will default to the basic encryption method, preventing the error.


Important

Fixes encryption on Linux by defaulting to basic encryption in EncryptionMainService when no password-store is specified.

  • Behavior:
    • On Linux, defaults to basic encryption if no password-store is specified in EncryptionMainService.
    • Logs a trace message when defaulting to basic encryption.
  • Files:
    • Changes in encryptionMainService.ts to handle Linux-specific encryption behavior.

This description was created by Ellipsis for a38fc81. It will automatically update as commits are pushed.

@eswaldots eswaldots changed the title Fix encryption service dont working on Linux Fix encryption service don't working on Linux Feb 16, 2025
@eswaldots eswaldots changed the title Fix encryption service don't working on Linux Fix encryption service not working on Linux Feb 16, 2025
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to a38fc81 in 1 minute and 7 seconds

More details
  • Looked at 25 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 drafted comments based on config settings.
1. src/vs/platform/encryption/electron-main/encryptionMainService.ts:26
  • Draft comment:
    Ensure this fallback to basic encryption on Linux is early enough so that any later logic that relies on the command-line switch uses the updated setting. Modifying command line flags at runtime can sometimes be risky if reads have already occurred.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
2. src/vs/platform/encryption/electron-main/encryptionMainService.ts:7
  • Draft comment:
    Good addition to import the isLinux flag. Make sure its usage is consistent across the platform checks.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
3. src/vs/platform/encryption/electron-main/encryptionMainService.ts:26
  • Draft comment:
    Consider using app.commandLine.hasSwitch('password-store') for clarity. Using getSwitchValue and checking for falsy value works, but hasSwitch more clearly expresses the intent of checking presence of a switch.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
4. src/vs/platform/encryption/electron-main/encryptionMainService.ts:28
  • Draft comment:
    Modifying command line arguments during service construction can lead to unexpected side effects if other modules expect the original state. Consider moving this configuration to an earlier initialization phase.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50%
    While modifying command line args during runtime can be risky, this seems to be an initialization-time configuration that needs to happen before encryption settings are applied. The modification is guarded by platform check and only happens if the switch isn't already set. The value is used immediately after, suggesting tight coupling between setting and using the switch. Moving this elsewhere could actually make the code more complex.
    The comment raises a valid concern about command line argument modification timing. Other services could potentially read this switch before this service is constructed.
    However, this appears to be encryption-specific initialization that needs to happen before encryption settings are configured. The tight coupling and immediate usage suggests this is the appropriate place for this code.
    The comment raises a theoretical concern but the current implementation appears reasonable and moving it could add unnecessary complexity. The comment should be removed.
5. src/vs/platform/encryption/electron-main/encryptionMainService.ts:26
  • Draft comment:
    Add an inline comment explaining why the basic encryption fallback is enforced on Linux if no 'password-store' switch is provided, to aid future maintainers.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None

Workflow ID: wflow_Ew51JvxhMMJZCYXQ


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@andrewpareles
Copy link
Contributor

This looks good, but I want to make sure there wasn't a reason Linux was left off here by VSCode. Will check back once rebase is complete

Copy link

@filip-rs filip-rs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple change, LGTM.

@andrewpareles andrewpareles merged commit 7e34037 into voideditor:main Feb 28, 2025
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.

3 participants