1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 15:53:27 +00:00

chromium importer working in sandbox

This commit is contained in:
John Harrington
2025-11-19 15:22:23 -07:00
parent f40233fce4
commit aa42630410
13 changed files with 162 additions and 57 deletions

View File

@@ -249,6 +249,7 @@ export declare namespace chromium_importer {
export function getMetadata(): Record<string, NativeImporterMetadata>
export function getAvailableProfiles(browser: string): Array<ProfileInfo>
export function importLogins(browser: string, profileId: string): Promise<Array<LoginImportResult>>
export function requestBrowserAccess(browser: string): void
}
export declare namespace autotype {
export function getForegroundWindowTitle(): string

View File

@@ -11,7 +11,12 @@ if (isRelease) {
process.env.RUST_LOG = 'debug';
}
execSync(`napi build --platform --js false`, { stdio: 'inherit', env: process.env });
const featuresArg = process.env.SANDBOX_BUILD === '1' ? '--features sandbox' : '';
if (featuresArg) {
console.log('Building with sandbox feature enabled.');
}
execSync(`napi build --platform --js false ${featuresArg}`, { stdio: 'inherit', env: process.env });
/* Mac App Store build with sandboxing - Does this belong here?

View File

@@ -1182,11 +1182,18 @@ pub mod chromium_importer {
.map_err(|e| napi::Error::from_reason(e.to_string()))
}
#[cfg_attr(all(target_os = "macos", feature = "sandbox"), napi)]
#[cfg(all(target_os = "macos", feature = "sandbox"))]
#[napi]
pub fn request_browser_access(browser: String) -> napi::Result<()> {
chromium_importer::chromium::request_browser_access(&browser)
.map_err(|e| napi::Error::from_reason(e.to_string()))
#[cfg(all(target_os = "macos", feature = "sandbox"))]
{
chromium_importer::chromium::request_browser_access(&browser)
.map_err(|e| napi::Error::from_reason(e.to_string()))
}
#[cfg(not(all(target_os = "macos", feature = "sandbox")))]
{
// No-op when built without sandbox feature
Ok(())
}
}
}