mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 00:03:56 +00:00
Add rust module to prevent run-time memory dumping of main (#9393)
This commit is contained in:
6
apps/desktop/desktop_native/napi/index.d.ts
vendored
6
apps/desktop/desktop_native/napi/index.d.ts
vendored
@@ -41,6 +41,12 @@ export namespace clipboards {
|
||||
export function read(): Promise<string>
|
||||
export function write(text: string, password: boolean): Promise<void>
|
||||
}
|
||||
export namespace processisolations {
|
||||
export function disableCoredumps(): Promise<void>
|
||||
export function isCoreDumpingDisabled(): Promise<boolean>
|
||||
export function disableMemoryAccess(): Promise<void>
|
||||
}
|
||||
|
||||
export namespace powermonitors {
|
||||
export function onLock(callback: (err: Error | null, ) => any): Promise<void>
|
||||
export function isLockMonitorAvailable(): Promise<boolean>
|
||||
|
||||
@@ -206,9 +206,10 @@ if (!nativeBinding) {
|
||||
throw new Error(`Failed to load native binding`)
|
||||
}
|
||||
|
||||
const { passwords, biometrics, clipboards, powermonitors } = nativeBinding
|
||||
const { passwords, biometrics, clipboards, processisolations, powermonitors } = nativeBinding
|
||||
|
||||
module.exports.passwords = passwords
|
||||
module.exports.biometrics = biometrics
|
||||
module.exports.clipboards = clipboards
|
||||
module.exports.processisolations = processisolations
|
||||
module.exports.powermonitors = powermonitors
|
||||
|
||||
@@ -142,6 +142,25 @@ pub mod clipboards {
|
||||
}
|
||||
}
|
||||
|
||||
#[napi]
|
||||
pub mod processisolations {
|
||||
#[napi]
|
||||
pub async fn disable_coredumps() -> napi::Result<()> {
|
||||
desktop_core::process_isolation::disable_coredumps()
|
||||
.map_err(|e| napi::Error::from_reason(e.to_string()))
|
||||
}
|
||||
#[napi]
|
||||
pub async fn is_core_dumping_disabled() -> napi::Result<bool> {
|
||||
desktop_core::process_isolation::is_core_dumping_disabled()
|
||||
.map_err(|e| napi::Error::from_reason(e.to_string()))
|
||||
}
|
||||
#[napi]
|
||||
pub async fn disable_memory_access() -> napi::Result<()> {
|
||||
desktop_core::process_isolation::disable_memory_access()
|
||||
.map_err(|e| napi::Error::from_reason(e.to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
#[napi]
|
||||
pub mod powermonitors {
|
||||
use napi::{threadsafe_function::{ErrorStrategy::CalleeHandled, ThreadsafeFunction, ThreadsafeFunctionCallMode}, tokio};
|
||||
|
||||
Reference in New Issue
Block a user