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

[PM-14252] Switch to oo7 and drop libsecret #11900

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

quexten
Copy link
Contributor

@quexten quexten commented Nov 7, 2024

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-14252

📔 Objective

Oo7 (https://github.com/bilelmoussaoui/oo7) is the library for interacting with desktop Linux keyrings that many modern projects are switching towards. It supports accessing secret service directly, but also going via the secret portal in sandboxes (for flatpak/snap).
Note: Migration code is included. If there are clients that are on snap / flatpak, they will migrate from storing directly in secret service to the file backend + portal based approach.

The API is a lot more sane and the library is pure rust, which should reduce bugs we have with linux platform secrets management. Also drops dependency on compiling against c libraries.

(Also should make cross compiling for ARM possible)

📸 Screenshots

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

Copy link

codecov bot commented Nov 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 33.42%. Comparing base (5592d64) to head (b0fcfc1).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #11900   +/-   ##
=======================================
  Coverage   33.41%   33.42%           
=======================================
  Files        2841     2841           
  Lines       89008    89008           
  Branches    16979    16979           
=======================================
+ Hits        29744    29751    +7     
+ Misses      56927    56920    -7     
  Partials     2337     2337           

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

Copy link
Contributor

github-actions bot commented Nov 7, 2024

Logo
Checkmarx One – Scan Summary & Details0059064d-decd-4dac-9229-71997c86475c

New Issues

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Angular_Improper_Type_Pipe_Usage /apps/web/src/app/auth/trial-initiation/trial-initiation.component.html: 100 Attack Vector
MEDIUM Angular_Improper_Type_Pipe_Usage /apps/web/src/app/auth/trial-initiation/trial-initiation.component.html: 97 Attack Vector
MEDIUM Angular_Improper_Type_Pipe_Usage /apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.html: 43 Attack Vector
MEDIUM Angular_Improper_Type_Pipe_Usage /apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.html: 31 Attack Vector
MEDIUM Angular_Improper_Type_Pipe_Usage /apps/web/src/app/auth/trial-initiation/secrets-manager/secrets-manager-trial-paid-stepper.component.html: 20 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 353 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 353 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 353 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 353 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 353 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 353 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 353 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 353 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 353 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 353 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 353 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 239 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 239 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 239 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 239 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 239 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 239 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 239 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 239 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 239 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 239 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 239 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 450 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 450 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 450 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 450 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 450 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 450 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 450 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 450 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 450 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 450 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 450 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 250 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 250 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 250 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 250 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 250 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 250 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 250 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 250 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 250 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 250 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 250 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 234 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 234 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 234 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 234 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 234 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 234 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 234 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 234 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 234 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 234 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 234 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 50 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 50 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 50 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 50 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 50 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 50 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 50 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 50 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 50 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 50 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 50 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 49 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 49 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 49 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 49 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/vault-filter.component.ts: 49 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/platform/components/approve-ssh-request.html: 6 Attack Vector
MEDIUM Client_Privacy_Violation /libs/vault/src/components/password-history-view/password-history-view.component.html: 6 Attack Vector
MEDIUM Client_Privacy_Violation /libs/vault/src/components/password-history-view/password-history-view.component.ts: 29 Attack Vector
MEDIUM Client_Privacy_Violation /libs/vault/src/components/password-history-view/password-history-view.component.ts: 29 Attack Vector
MEDIUM Client_Privacy_Violation /libs/vault/src/components/password-history-view/password-history-view.component.ts: 29 Attack Vector
MEDIUM Client_Privacy_Violation /libs/vault/src/components/password-history-view/password-history-view.component.ts: 29 Attack Vector

Fixed Issues

Severity Issue Source File / Package
MEDIUM Client_Privacy_Violation /apps/desktop/src/platform/components/approve-ssh-request.html: 6
MEDIUM Client_Privacy_Violation /libs/vault/src/components/password-history-view/password-history-view.component.html: 6
MEDIUM Client_Privacy_Violation /libs/vault/src/components/password-history-view/password-history-view.component.html: 6

@quexten quexten marked this pull request as ready for review November 8, 2024 15:11
@quexten quexten requested a review from a team as a code owner November 8, 2024 15:11
@quexten quexten changed the title Switch to oo7 and drop libsecret [PM-14252] Switch to oo7 and drop libsecret Nov 8, 2024
Copy link
Member

@dani-garcia dani-garcia left a comment

Choose a reason for hiding this comment

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

Nice, looks pretty good to me!

@@ -28,14 +28,16 @@ pub trait BiometricTrait {
#[allow(async_fn_in_trait)]
async fn available() -> Result<bool>;
fn derive_key_material(secret: Option<&str>) -> Result<OsDerivedKey>;
fn set_biometric_secret(
#[allow(async_fn_in_trait)]
Copy link
Member

Choose a reason for hiding this comment

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

Can we lift the #[allow()] to the trait to avoid repeating it multiple times?

@@ -84,7 +82,7 @@ security-framework = { version = "=3.0.0", optional = true }
security-framework-sys = { version = "=2.12.0", optional = true }

[target.'cfg(target_os = "linux")'.dependencies]
gio = { version = "=0.19.5", optional = true }
libsecret = { version = "=0.5.0", optional = true }
Copy link
Member

Choose a reason for hiding this comment

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

If we're removing the libsecret crate can we also remove the dependency to the libsecret system package?

"depends": ["libnotify4", "libxtst6", "libnss3", "libsecret-1-0", "libxss1"]

sudo apt-get -y install pkg-config libxss-dev libsecret-1-dev rpm musl-dev musl-tools

sudo apt-get -y install pkg-config libxss-dev libsecret-1-dev rpm

}
}

pub fn get_password_keytar(service: &str, account: &str) -> Result<String> {
get_password(service, account)
// forces to read via secret service; remvove after 2024.03
Copy link
Member

Choose a reason for hiding this comment

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

Do you mean remove after 2025.03?

apps/desktop/desktop_native/core/src/password/unix.rs Outdated Show resolved Hide resolved
Copy link
Member

@dani-garcia dani-garcia left a comment

Choose a reason for hiding this comment

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

When building this I'm getting some Cargo dep conflicts that require me to downgrade zbus to 4.2.0, do you see that issue as well?

Other than that, I've tested this and it works perfect, great work!

@@ -84,7 +82,7 @@ security-framework = { version = "=3.0.0", optional = true }
security-framework-sys = { version = "=2.12.0", optional = true }

[target.'cfg(target_os = "linux")'.dependencies]
gio = { version = "=0.19.5", optional = true }
libsecret = { version = "=0.5.0", optional = true }
oo7 = "0.3.3"
Copy link
Member

Choose a reason for hiding this comment

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

We should pin the dep like the rest of them

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