1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00

[PM-27583] Add icon to chromium import helper (#17126)

Adds an icon to the windows binary.

---------

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
Oscar Hinton
2025-10-31 10:10:22 +01:00
committed by GitHub
parent 9d2b2d1894
commit 4c1eba2086
11 changed files with 188 additions and 33 deletions

View File

@@ -440,6 +440,24 @@ dependencies = [
"tokio-util",
]
[[package]]
name = "bitwarden_chromium_import_helper"
version = "0.0.0"
dependencies = [
"anyhow",
"base64",
"chromium_importer",
"clap",
"embed-resource",
"scopeguard",
"sysinfo",
"tokio",
"tracing",
"tracing-subscriber",
"verifysign",
"windows 0.61.1",
]
[[package]]
name = "block-buffer"
version = "0.10.4"
@@ -590,23 +608,19 @@ dependencies = [
"base64",
"cbc",
"chacha20poly1305",
"clap",
"dirs",
"hex",
"oo7",
"pbkdf2",
"rand 0.9.1",
"rusqlite",
"scopeguard",
"security-framework",
"serde",
"serde_json",
"sha1",
"sysinfo",
"tokio",
"tracing",
"tracing-subscriber",
"verifysign",
"windows 0.61.1",
]
@@ -1046,7 +1060,7 @@ dependencies = [
"libc",
"option-ext",
"redox_users",
"windows-sys 0.60.2",
"windows-sys 0.61.2",
]
[[package]]
@@ -1163,6 +1177,20 @@ dependencies = [
"zeroize",
]
[[package]]
name = "embed-resource"
version = "3.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55a075fc573c64510038d7ee9abc7990635863992f83ebc52c8b433b8411a02e"
dependencies = [
"cc",
"memchr",
"rustc_version",
"toml 0.9.5",
"vswhom",
"winreg",
]
[[package]]
name = "embed_plist"
version = "1.2.2"
@@ -3109,6 +3137,15 @@ dependencies = [
"syn",
]
[[package]]
name = "serde_spanned"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40734c41988f7306bb04f0ecf60ec0f3f1caa34290e4e8ea471dcd3346483b83"
dependencies = [
"serde",
]
[[package]]
name = "serial_test"
version = "3.2.0"
@@ -3510,12 +3547,36 @@ dependencies = [
"serde",
]
[[package]]
name = "toml"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75129e1dc5000bfbaa9fee9d1b21f974f9fbad9daec557a521ee6e080825f6e8"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime 0.7.0",
"toml_parser",
"toml_writer",
"winnow",
]
[[package]]
name = "toml_datetime"
version = "0.6.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3"
[[package]]
name = "toml_datetime"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bade1c3e902f58d73d3f294cd7f20391c1cb2fbcb643b73566bc773971df91e3"
dependencies = [
"serde",
]
[[package]]
name = "toml_edit"
version = "0.22.26"
@@ -3523,10 +3584,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e"
dependencies = [
"indexmap",
"toml_datetime",
"toml_datetime 0.6.9",
"winnow",
]
[[package]]
name = "toml_parser"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b551886f449aa90d4fe2bdaa9f4a2577ad2dde302c61ecf262d80b116db95c10"
dependencies = [
"winnow",
]
[[package]]
name = "toml_writer"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df8b2b54733674ad286d16267dcfc7a71ed5c776e4ac7aa3c3e2561f7c637bf2"
[[package]]
name = "tracing"
version = "0.1.41"
@@ -3688,7 +3764,7 @@ dependencies = [
"paste",
"serde",
"textwrap",
"toml",
"toml 0.5.11",
"uniffi_meta",
"uniffi_udl",
]
@@ -3742,7 +3818,7 @@ dependencies = [
"quote",
"serde",
"syn",
"toml",
"toml 0.5.11",
"uniffi_meta",
]
@@ -3848,6 +3924,26 @@ version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
[[package]]
name = "vswhom"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b"
dependencies = [
"libc",
"vswhom-sys",
]
[[package]]
name = "vswhom-sys"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb067e4cbd1ff067d1df46c9194b5de0e98efd2810bbc95c5d5e5f25a3231150"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
@@ -4474,6 +4570,16 @@ dependencies = [
"memchr",
]
[[package]]
name = "winreg"
version = "0.55.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb5a765337c50e9ec252c2069be9bf91c7df47afb103b642ba3a53bf8101be97"
dependencies = [
"cfg-if",
"windows-sys 0.59.0",
]
[[package]]
name = "wit-bindgen-rt"
version = "0.39.0"

View File

@@ -2,6 +2,7 @@
resolver = "2"
members = [
"autotype",
"bitwarden_chromium_import_helper",
"chromium_importer",
"core",
"macos_provider",
@@ -68,7 +69,11 @@ tokio = "=1.45.0"
tokio-stream = "=0.1.15"
tokio-util = "=0.7.13"
tracing = "=0.1.41"
tracing-subscriber = { version = "=0.3.20", features = ["fmt", "env-filter", "tracing-log"] }
tracing-subscriber = { version = "=0.3.20", features = [
"fmt",
"env-filter",
"tracing-log",
] }
typenum = "=1.18.0"
uniffi = "=0.28.3"
widestring = "=1.2.0"

View File

@@ -0,0 +1,40 @@
[package]
name = "bitwarden_chromium_import_helper"
version.workspace = true
license.workspace = true
edition.workspace = true
publish.workspace = true
[dependencies]
[target.'cfg(target_os = "windows")'.dependencies]
chromium_importer = { path = "../chromium_importer" }
clap = { version = "=4.5.40", features = ["derive"] }
scopeguard = { workspace = true }
sysinfo = { workspace = true }
verifysign = "=0.2.4"
windows = { workspace = true, features = [
"Wdk_System_SystemServices",
"Win32_Security_Cryptography",
"Win32_Security",
"Win32_Storage_FileSystem",
"Win32_System_IO",
"Win32_System_Memory",
"Win32_System_Pipes",
"Win32_System_ProcessStatus",
"Win32_System_Services",
"Win32_System_Threading",
"Win32_UI_Shell",
"Win32_UI_WindowsAndMessaging",
] }
anyhow = { workspace = true }
base64 = { workspace = true }
tokio = { workspace = true, features = ["full"] }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
[build-dependencies]
embed-resource = "=3.0.6"
[lints]
workspace = true

View File

@@ -0,0 +1,9 @@
fn main() {
if std::env::var("CARGO_CFG_TARGET_OS").expect("to be set by cargo") == "windows" {
println!("cargo:rerun-if-changed=resources.rc");
embed_resource::compile("resources.rc", embed_resource::NONE)
.manifest_optional()
.expect("to compile resources");
}
}

View File

@@ -0,0 +1 @@
1 ICON "../../resources/icon.ico"

View File

@@ -0,0 +1,13 @@
#[cfg(target_os = "windows")]
mod windows;
#[cfg(target_os = "windows")]
#[tokio::main]
async fn main() {
windows::main().await;
}
#[cfg(not(target_os = "windows"))]
fn main() {
// Empty
}

View File

@@ -1,5 +1,3 @@
// Hide everything inside a platform specific module to avoid clippy errors on other platforms
#[cfg(target_os = "windows")]
mod windows_binary {
use anyhow::{anyhow, Result};
use base64::{engine::general_purpose, Engine as _};
@@ -479,7 +477,7 @@ mod windows_binary {
}
}
pub async fn main() {
pub(crate) async fn main() {
if ENABLE_DEVELOPER_LOGGING {
init_logging(LOG_FILENAME.as_ref(), LevelFilter::DEBUG);
}
@@ -508,8 +506,4 @@ mod windows_binary {
}
}
#[tokio::main]
async fn main() {
#[cfg(target_os = "windows")]
windows_binary::main().await;
}
pub(crate) use windows_binary::*;

View File

@@ -54,7 +54,7 @@ function buildImporterBinaries(target, release = true) {
const bin = "bitwarden_chromium_import_helper";
const targetArg = target ? `--target ${target}` : "";
const releaseArg = release ? "--release" : "";
child_process.execSync(`cargo build --bin ${bin} ${releaseArg} ${targetArg} --features windows-binary`, {stdio: 'inherit', cwd: path.join(__dirname, "chromium_importer")});
child_process.execSync(`cargo build --bin ${bin} ${releaseArg} ${targetArg}`);
if (target) {
// Copy the resulting binary to the dist folder

View File

@@ -29,10 +29,6 @@ security-framework = { workspace = true }
[target.'cfg(target_os = "windows")'.dependencies]
chacha20poly1305 = { workspace = true }
clap = { version = "=4.5.40", features = ["derive"] }
scopeguard = { workspace = true }
sysinfo = { workspace = true, optional = true }
verifysign = "=0.2.4"
windows = { workspace = true, features = [
"Wdk_System_SystemServices",
"Win32_Security_Cryptography",
@@ -53,11 +49,3 @@ oo7 = { workspace = true }
[lints]
workspace = true
[features]
windows-binary = ["dep:sysinfo"]
[[bin]]
name = "bitwarden_chromium_import_helper"
path = "src/bin/bitwarden_chromium_import_helper.rs"
required-features = ["windows-binary"]

View File

@@ -14,8 +14,6 @@ The Windows **Application Bound Encryption (ABE)** subsystem consists of two mai
- **client library** — a library that is part of the desktop client application
- **bitwarden_chromium_import_helper.exe** — a password decryptor running as **ADMINISTRATOR** and later as **SYSTEM**
_(The name of the binary will be changed in the released product.)_
See the last section for a concise summary of the entire process.
### Goal