electron_hardener/
lib.rs

1//! A library for working with Electron [fuses] and preventing runtime behavior modifications.
2//!
3//! `electron-hardener` provides a way to harden Electron applications against a specific class of runtime behavior
4//! modification. Specifically, if an unprivileged process can't write to the application's binary file or process
5//! address space, it should not be able to change what an app does at runtime.
6//!
7//! This library provides two sets of functionality:
8//! - An interface to view and modify the status of fuses in an application, similar to the [official fuses package].
9//! - A fast and configurable alternative implementation of the [electron-evil-feature-patcher] tool created by [Dimitri Witkowski].
10//!     All patches it can perform are also exposed in this crate. See its README for more details on how it works.
11//!
12//! Functionality is tested on a minimum version of Electron 15. Older versions may partially work but this is not guaranteed.
13//!
14//! ### A Note on Effectiveness
15//!
16//! Any patching this tool does is considered a strong "best effort" as the Chromium, Electron, and Node.JS teams are free to potentially
17//! make changes to the argument parser, set of flags, etc.
18//!
19//! For a stronger assurance, consider disabling the [dev tools messages](patcher::DevToolsMessage).
20//!
21//! [fuses]: https://www.electronjs.org/docs/tutorial/fuses
22//! [official fuses package]: https://github.com/electron/fuses
23//! [electron-evil-feature-patcher]: https://github.com/antelle/electron-evil-feature-patcher
24//! [Dimitri Witkowski]: https://github.com/antelle
25#![warn(missing_docs)]
26
27mod error;
28pub use error::{BinaryError, PatcherError};
29
30pub mod fuses;
31pub use fuses::Fuse;
32
33pub mod patcher;
34
35/// An Electron application binary.
36pub struct ElectronApp<'a> {
37    contents: &'a mut [u8],
38    wire_start: usize,
39    wire_end: usize,
40}