Skip to content

Improve secure key env var match default case#20097

Open
neuronull wants to merge 1 commit intomainfrom
neuronull/secure-key-env-var-match-default-case
Open

Improve secure key env var match default case#20097
neuronull wants to merge 1 commit intomainfrom
neuronull/secure-key-env-var-match-default-case

Conversation

@neuronull
Copy link
Copy Markdown
Contributor

🎟️ Tracking

📔 Objective

Improves the logging of the default case for the secure key env var check.

I noticed this while observing tracing output from ssh agent. It reads:

2026-04-07T21:00:21.928081Z  INFO desktop_core::secure_memory::secure_key:  is not a valid secure key container backend, using automatic selection

, notably, the default match case is currently doing two things that could be improved: if the env var is not set, the log statement doesn't reflect that because it's an empty string. It doesn't delineate between the Ok(string) case and the Err case. Even though both result in a None return, it's more clear to read the logs what is going on.

Sine the existing code had info for both cases, I'm assuming the env var is not required/expected (hence using info for the Err case, instead of something like error or warn).

@neuronull neuronull self-assigned this Apr 10, 2026
@neuronull neuronull added the desktop Desktop Application label Apr 10, 2026
@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown
Contributor

Logo
Checkmarx One – Scan Summary & Details2d921176-dea4-4ab1-aff7-d0ff504340e4


New Issues (23) Checkmarx found the following issues in this Pull Request
# Severity Issue Source File / Package Checkmarx Insight
1 HIGH CVE-2025-13631 Npm-electron-39.2.6
detailsRecommended version: 41.2.0
Description: Inappropriate implementation in Google Updater in Google Chrome on Mac prior to 143.0.7499.41 allowed a remote attacker to perform Privilege Escala...
Attack Vector: NETWORK
Attack Complexity: LOW
Vulnerable Package
2 HIGH CVE-2025-13633 Npm-electron-39.2.6
detailsRecommended version: 41.2.0
Description: Use After Free in Digital Credentials in Google Chrome prior to 143.0.7499.41 allowed a remote attacker who had compromised the renderer process to...
Attack Vector: NETWORK
Attack Complexity: LOW
Vulnerable Package
3 HIGH CVE-2025-13638 Npm-electron-39.2.6
detailsRecommended version: 41.2.0
Description: Use After Free in Media Stream in Google Chrome prior to 143.0.7499.41 allowed a remote attacker to potentially exploit heap corruption via a craft...
Attack Vector: NETWORK
Attack Complexity: LOW
Vulnerable Package
4 HIGH CVE-2025-13639 Npm-electron-39.2.6
detailsRecommended version: 41.2.0
Description: Inappropriate implementation in WebRTC in Google Chrome prior to 143.0.7499.41 allowed a remote attacker to perform arbitrary read/write via a craf...
Attack Vector: NETWORK
Attack Complexity: LOW
Vulnerable Package
5 HIGH CVE-2025-13720 Npm-electron-39.2.6
detailsRecommended version: 41.2.0
Description: Bad cast in Loader in Google Chrome prior to 143.0.7499.41 allowed a remote attacker who had compromised the renderer process to potentially exploi...
Attack Vector: NETWORK
Attack Complexity: LOW
Vulnerable Package
6 HIGH CVE-2025-13721 Npm-electron-39.2.6
detailsRecommended version: 41.2.0
Description: Race in v8 in Google Chrome prior to 143.0.7499.41 allowed a remote attacker to potentially exploit heap corruption via a crafted HTML page.
Attack Vector: NETWORK
Attack Complexity: HIGH
Vulnerable Package
7 HIGH CVE-2026-0628 Npm-electron-39.2.6
detailsRecommended version: 41.2.0
Description: Insufficient policy enforcement in WebView tag in Google Chrome prior to 143.0.7499.192 allowed an attacker who convinced a user to install a malic...
Attack Vector: NETWORK
Attack Complexity: LOW
Vulnerable Package
8 HIGH CVE-2026-1861 Npm-electron-39.2.6
detailsRecommended version: 41.2.0
Description: Heap Buffer Overflow in libvpx in Google Chrome prior to 144.0.7559.132 allowed a remote attacker to potentially exploit heap corruption via a craf...
Attack Vector: NETWORK
Attack Complexity: LOW
Vulnerable Package
9 HIGH CVE-2026-34770 Npm-electron-39.2.6
detailsRecommended version: 41.2.0
Description: Electron is a framework for writing cross-platform desktop applications using JavaScript, HTML and CSS. Prior to versions 38.8.6, 39.x prior to 39....
Attack Vector: LOCAL
Attack Complexity: HIGH
Vulnerable Package
10 HIGH CVE-2026-34771 Npm-electron-39.2.6
detailsRecommended version: 41.2.0
Description: Electron is a framework for writing cross-platform desktop applications using JavaScript, HTML and CSS. Prior to versions 38.8.6, 39.x prior to 39....
Attack Vector: NETWORK
Attack Complexity: HIGH
Vulnerable Package
11 HIGH CVE-2026-34774 Npm-electron-39.2.6
detailsRecommended version: 41.2.0
Description: Electron is a framework for writing cross-platform desktop applications using JavaScript, HTML and CSS. Prior to versions 39.8.1, 40.x prior to 40....
Attack Vector: NETWORK
Attack Complexity: HIGH
Vulnerable Package
12 HIGH CVE-2026-34780 Npm-electron-39.2.6
detailsRecommended version: 41.2.0
Description: Electron is a framework for writing cross-platform desktop applications using JavaScript, HTML and CSS. From versions 39.0.0-alpha.1 prior to 39.8....
Attack Vector: NETWORK
Attack Complexity: HIGH
Vulnerable Package
13 HIGH SSRF /libs/common/src/services/api.service.ts: 1327
detailsThe application sends a request to a remote server, for some resource, using createRequest in /libs/common/src/services/api.service.ts:1270. How...
Attack Vector
14 HIGH SSRF /libs/common/src/services/api.service.ts: 1335
detailsThe application sends a request to a remote server, for some resource, using createRequest in /libs/common/src/services/api.service.ts:1270. How...
Attack Vector
15 HIGH SSRF /libs/common/src/services/api.service.ts: 1328
detailsThe application sends a request to a remote server, for some resource, using createRequest in /libs/common/src/services/api.service.ts:1270. How...
Attack Vector
16 HIGH SSRF /libs/common/src/services/api.service.ts: 1327
detailsThe application sends a request to a remote server, for some resource, using createRequest in /libs/common/src/services/api.service.ts:1241. How...
Attack Vector
17 HIGH SSRF /libs/common/src/services/api.service.ts: 1335
detailsThe application sends a request to a remote server, for some resource, using createRequest in /libs/common/src/services/api.service.ts:1241. How...
Attack Vector
18 HIGH SSRF /libs/common/src/services/api.service.ts: 1328
detailsThe application sends a request to a remote server, for some resource, using createRequest in /libs/common/src/services/api.service.ts:1241. How...
Attack Vector
19 MEDIUM CVE-2025-13632 Npm-electron-39.2.6
detailsRecommended version: 41.2.0
Description: Inappropriate implementation in DevTools in Google Chrome prior to 143.0.7499.41 allowed an attacker who convinced a user to install a malicious ex...
Attack Vector: NETWORK
Attack Complexity: LOW
Vulnerable Package
20 MEDIUM CVE-2025-13635 Npm-electron-39.2.6
detailsRecommended version: 41.2.0
Description: Inappropriate implementation in Downloads in Google Chrome prior to 143.0.7499.41 allowed a local attacker to perform UI spoofing via a crafted HTM...
Attack Vector: LOCAL
Attack Complexity: LOW
Vulnerable Package
21 MEDIUM CVE-2025-13636 Npm-electron-39.2.6
detailsRecommended version: 41.2.0
Description: Inappropriate implementation in Split View in Google Chrome prior to 143.0.7499.41 allowed a remote attacker who convinced a user to engage in spec...
Attack Vector: NETWORK
Attack Complexity: LOW
Vulnerable Package
22 MEDIUM CVE-2025-13637 Npm-electron-39.2.6
detailsRecommended version: 41.2.0
Description: Inappropriate implementation in Downloads in Google Chrome prior to 143.0.7499.41 allowed a remote attacker who convinced a user to engage in speci...
Attack Vector: NETWORK
Attack Complexity: LOW
Vulnerable Package
23 LOW CVE-2025-13640 Npm-electron-39.2.6
detailsRecommended version: 41.2.0
Description: Inappropriate implementation in Passwords in Google Chrome prior to 143.0.7499.41 allowed a local attacker to bypass authentication via physical ac...
Attack Vector: PHYSICAL
Attack Complexity: LOW
Vulnerable Package

Fixed Issues (1) Great job! The following issues were fixed in this Pull Request
Severity Issue Source File / Package
HIGH SSRF /libs/common/src/services/api.service.ts: 1343

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

❌ Patch coverage is 40.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.82%. Comparing base (afdce14) to head (21cbaaf).
⚠️ Report is 44 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...op_native/core/src/secure_memory/secure_key/mod.rs 40.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #20097      +/-   ##
==========================================
+ Coverage   46.67%   46.82%   +0.14%     
==========================================
  Files        3880     3882       +2     
  Lines      116114   116386     +272     
  Branches    17671    17738      +67     
==========================================
+ Hits        54200    54498     +298     
+ Misses      59447    59409      -38     
- Partials     2467     2479      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@neuronull neuronull marked this pull request as ready for review April 10, 2026 20:23
@neuronull neuronull requested a review from a team as a code owner April 10, 2026 20:23
@neuronull neuronull requested a review from Thomas-Avery April 10, 2026 20:23
@neuronull neuronull added the ai-review Request a Claude code review label Apr 10, 2026
Comment on lines +183 to 188
Err(error) => {
info!(
"{} is not a valid secure key container backend, using automatic selection",
env_var.unwrap_or_default()
%error,
env_var = ENV_VAR_SECURE_KEY_CONTAINER_BACKEND,
"failed to read environment variable, using automatic selection"
);
Copy link
Copy Markdown
Contributor

@Thomas-Avery Thomas-Avery Apr 10, 2026

Choose a reason for hiding this comment

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

💭 The hot path here is users not setting SECURE_KEY_CONTAINER_BACKEND and us using automatic selection.

I would suggest matching on std::env::VarError::NotPresent and just having a debug! or no log for that. Then having the other error options being what you have here.

Feels like unhelpful noise to have something like:

INFO error=environment variable not found env_var=SECURE_KEY_CONTAINER_BACKEND failed to read environment variable, using automatic selection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review desktop Desktop Application

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants