1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-26 09:33:22 +00:00

Merge main

This commit is contained in:
Bernd Schoolmann
2025-08-29 15:06:37 +02:00
412 changed files with 5482 additions and 2605 deletions

View File

@@ -7,32 +7,35 @@ publish = { workspace = true }
[features]
default = [
"dep:widestring",
"dep:windows",
"dep:core-foundation",
"dep:security-framework",
"dep:security-framework-sys",
"dep:zbus",
"dep:zbus_polkit",
"dep:widestring",
"dep:windows",
"dep:core-foundation",
"dep:security-framework",
"dep:security-framework-sys",
"dep:zbus",
"dep:zbus_polkit"
]
manual_test = []
[dependencies]
aes = { workspace = true }
anyhow = { workspace = true }
arboard = { workspace = true, features = [
"wayland-data-control",
] }
arboard = { workspace = true, features = ["wayland-data-control"] }
base64 = { workspace = true }
bitwarden-russh = { workspace = true }
byteorder = { workspace = true }
bytes = { workspace = true }
cbc = { workspace = true, features = ["alloc"] }
homedir = { workspace = true }
pin-project = { workspace = true }
dirs = { workspace = true }
ed25519 = { workspace = true, features = ["pkcs8"] }
futures = { workspace = true }
homedir = { workspace = true }
interprocess = { workspace = true, features = ["tokio"] }
log = { workspace = true }
pin-project = { workspace = true }
pkcs8 = { workspace = true, features = ["alloc", "encryption", "pem"] }
rand = { workspace = true }
rsa = { workspace = true }
russh-cryptovec = { workspace = true }
scopeguard = { workspace = true }
sha2 = { workspace = true }
@@ -43,17 +46,12 @@ ssh-key = { workspace = true, features = [
"rsa",
"getrandom",
] }
bitwarden-russh = { workspace = true }
sysinfo = { workspace = true, features = ["windows"] }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["io-util", "sync", "macros", "net"] }
tokio-stream = { workspace = true, features = ["net"] }
tokio-util = { workspace = true, features = ["codec"] }
thiserror = { workspace = true }
typenum = { workspace = true }
pkcs8 = { workspace = true, features = ["alloc", "encryption", "pem"] }
rsa = { workspace = true }
ed25519 = { workspace = true, features = ["pkcs8"] }
bytes = { workspace = true }
sysinfo = { workspace = true, features = ["windows"] }
zeroizing-alloc = { workspace = true }
chacha20poly1305 = { workspace = true }
serde = { workspace = true, features = ["derive"] }
@@ -93,3 +91,6 @@ ashpd = { workspace = true }
zbus = { workspace = true, optional = true }
zbus_polkit = { workspace = true, optional = true }
[lints]
workspace = true

View File

@@ -1,5 +1,6 @@
use anyhow::Result;
#[allow(clippy::unused_async)]
pub async fn run_command(_value: String) -> Result<String> {
todo!("Unix does not support autofill");
}

View File

@@ -1,5 +1,6 @@
use anyhow::Result;
#[allow(clippy::unused_async)]
pub async fn run_command(_value: String) -> Result<String> {
todo!("Windows does not support autofill");
}

View File

@@ -1,5 +1,6 @@
use anyhow::Result;
#[allow(clippy::unused_async)]
pub async fn set_autostart(_autostart: bool, _params: Vec<String>) -> Result<()> {
unimplemented!();
}

View File

@@ -30,6 +30,8 @@ fn internal_ipc_codec<T: AsyncRead + AsyncWrite>(inner: T) -> Framed<T, LengthDe
}
/// Resolve the path to the IPC socket.
// FIXME: Remove unwraps! They panic and terminate the whole application.
#[allow(clippy::unwrap_used)]
pub fn path(name: &str) -> std::path::PathBuf {
#[cfg(target_os = "windows")]
{

View File

@@ -4,22 +4,26 @@ use security_framework::passwords::{
delete_generic_password, get_generic_password, set_generic_password,
};
#[allow(clippy::unused_async)]
pub async fn get_password(service: &str, account: &str) -> Result<String> {
let password = get_generic_password(service, account).map_err(convert_error)?;
let result = String::from_utf8(password)?;
Ok(result)
}
#[allow(clippy::unused_async)]
pub async fn set_password(service: &str, account: &str, password: &str) -> Result<()> {
set_generic_password(service, account, password.as_bytes())?;
Ok(())
}
#[allow(clippy::unused_async)]
pub async fn delete_password(service: &str, account: &str) -> Result<()> {
delete_generic_password(service, account).map_err(convert_error)?;
Ok(())
}
#[allow(clippy::unused_async)]
pub async fn is_available() -> Result<bool> {
Ok(true)
}

View File

@@ -14,6 +14,7 @@ use windows::{
const CRED_FLAGS_NONE: u32 = 0;
#[allow(clippy::unused_async)]
pub async fn get_password(service: &str, account: &str) -> Result<String> {
let target_name = U16CString::from_str(target_name(service, account))?;
@@ -46,6 +47,7 @@ pub async fn get_password(service: &str, account: &str) -> Result<String> {
Ok(password)
}
#[allow(clippy::unused_async)]
pub async fn set_password(service: &str, account: &str, password: &str) -> Result<()> {
let mut target_name = U16CString::from_str(target_name(service, account))?;
let mut user_name = U16CString::from_str(account)?;
@@ -77,6 +79,7 @@ pub async fn set_password(service: &str, account: &str, password: &str) -> Resul
Ok(())
}
#[allow(clippy::unused_async)]
pub async fn delete_password(service: &str, account: &str) -> Result<()> {
let target_name = U16CString::from_str(target_name(service, account))?;
@@ -87,6 +90,7 @@ pub async fn delete_password(service: &str, account: &str) -> Result<()> {
Ok(())
}
#[allow(clippy::unused_async)]
pub async fn is_available() -> Result<bool> {
Ok(true)
}

View File

@@ -19,6 +19,8 @@ const SCREEN_LOCK_MONITORS: [ScreenLock; 2] = [
},
];
// FIXME: Remove unwraps! They panic and terminate the whole application.
#[allow(clippy::unwrap_used)]
pub async fn on_lock(tx: tokio::sync::mpsc::Sender<()>) -> Result<(), Box<dyn std::error::Error>> {
let connection = Connection::session().await?;
@@ -41,6 +43,8 @@ pub async fn on_lock(tx: tokio::sync::mpsc::Sender<()>) -> Result<(), Box<dyn st
Ok(())
}
// FIXME: Remove unwraps! They panic and terminate the whole application.
#[allow(clippy::unwrap_used)]
pub async fn is_lock_monitor_available() -> bool {
let connection = Connection::session().await.unwrap();
for monitor in SCREEN_LOCK_MONITORS {

View File

@@ -1,7 +1,9 @@
#[allow(clippy::unused_async)]
pub async fn on_lock(_: tokio::sync::mpsc::Sender<()>) -> Result<(), Box<dyn std::error::Error>> {
unimplemented!();
}
#[allow(clippy::unused_async)]
pub async fn is_lock_monitor_available() -> bool {
false
}

View File

@@ -90,7 +90,7 @@ impl ssh_agent::Agent<peerinfo::models::PeerInfo, BitwardenSshKey>
return false;
}
let request_id = self.get_request_id().await;
let request_id = self.get_request_id();
let request_data = match request_parser::parse_request(data) {
Ok(data) => data,
Err(e) => {
@@ -138,7 +138,7 @@ impl ssh_agent::Agent<peerinfo::models::PeerInfo, BitwardenSshKey>
return true;
}
let request_id = self.get_request_id().await;
let request_id = self.get_request_id();
let mut rx_channel = self.get_ui_response_rx.lock().await.resubscribe();
let message = SshAgentUIRequest {
@@ -263,7 +263,7 @@ impl BitwardenDesktopAgent<BitwardenSshKey> {
Ok(())
}
async fn get_request_id(&self) -> u32 {
fn get_request_id(&self) -> u32 {
if !self.is_running() {
println!("[BitwardenDesktopAgent] Agent is not running, but tried to get request id");
return 0;

View File

@@ -26,6 +26,8 @@ pub struct NamedPipeServerStream {
}
impl NamedPipeServerStream {
// FIXME: Remove unwraps! They panic and terminate the whole application.
#[allow(clippy::unwrap_used)]
pub fn new(cancellation_token: CancellationToken, is_running: Arc<AtomicBool>) -> Self {
let (tx, rx) = tokio::sync::mpsc::channel(16);
tokio::spawn(async move {

View File

@@ -18,7 +18,7 @@ use crate::ssh_agent::peercred_unix_listener_stream::PeercredUnixListenerStream;
use super::{BitwardenDesktopAgent, BitwardenSshKey, SshAgentUIRequest};
impl BitwardenDesktopAgent<BitwardenSshKey> {
pub async fn start_server(
pub fn start_server(
auth_request_tx: tokio::sync::mpsc::Sender<SshAgentUIRequest>,
auth_response_rx: Arc<Mutex<tokio::sync::broadcast::Receiver<(u32, bool)>>>,
) -> Result<Self, anyhow::Error> {

View File

@@ -14,7 +14,7 @@ use tokio_util::sync::CancellationToken;
use super::{BitwardenDesktopAgent, BitwardenSshKey, SshAgentUIRequest};
impl BitwardenDesktopAgent<BitwardenSshKey> {
pub async fn start_server(
pub fn start_server(
auth_request_tx: tokio::sync::mpsc::Sender<SshAgentUIRequest>,
auth_response_rx: Arc<Mutex<tokio::sync::broadcast::Receiver<(u32, bool)>>>,
) -> Result<Self, anyhow::Error> {