feat(core): scaffold workspace and implement symbol triage foundation
This commit is contained in:
parent
cee9baec84
commit
a61cf3053f
15 changed files with 5295 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
/target
|
||||
.superpowers/
|
||||
5098
Cargo.lock
generated
Normal file
5098
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
45
Cargo.toml
Normal file
45
Cargo.toml
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
[workspace]
|
||||
resolver = "2"
|
||||
members = [
|
||||
"crates/molotov-core",
|
||||
"crates/molotov-bootstrap",
|
||||
"crates/molotov-gui",
|
||||
"crates/molotov-cli",
|
||||
".",
|
||||
]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
authors = ["Molotov Contributors"]
|
||||
license = "GPL-3.0-or-later"
|
||||
|
||||
[workspace.dependencies]
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
thiserror = "1.0"
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = "0.3"
|
||||
tokio = { version = "1.40", features = ["full"] }
|
||||
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "stream", "json"] }
|
||||
sha2 = "0.10"
|
||||
zip = { version = "2.2", default-features = false, features = ["deflate"] }
|
||||
x509-parser = "0.16"
|
||||
clap = { version = "4.5", features = ["derive"] }
|
||||
eframe = "0.30"
|
||||
rbx_dom_weak = "4.2"
|
||||
tempfile = "3.12"
|
||||
libc = "0.2"
|
||||
nix = { version = "0.29", features = ["process", "sched"] }
|
||||
|
||||
[package]
|
||||
name = "molotov"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[dependencies]
|
||||
molotov-core = { path = "crates/molotov-core" }
|
||||
molotov-bootstrap = { path = "crates/molotov-bootstrap" }
|
||||
molotov-gui = { path = "crates/molotov-gui" }
|
||||
molotov-cli = { path = "crates/molotov-cli" }
|
||||
23
crates/molotov-bootstrap/Cargo.toml
Normal file
23
crates/molotov-bootstrap/Cargo.toml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
[package]
|
||||
name = "molotov-bootstrap"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[dependencies]
|
||||
molotov-core = { path = "../molotov-core" }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
reqwest = { workspace = true }
|
||||
sha2 = { workspace = true }
|
||||
zip = { workspace = true }
|
||||
x509-parser = { workspace = true }
|
||||
rbx_dom_weak = { workspace = true }
|
||||
nix = { workspace = true }
|
||||
libc = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = { workspace = true }
|
||||
18
crates/molotov-bootstrap/src/error.rs
Normal file
18
crates/molotov-bootstrap/src/error.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum MolotovError {
|
||||
#[error("I/O error: {0}")]
|
||||
Io(#[from] std::io::Error),
|
||||
#[error("Network request failed: {0}")]
|
||||
Network(#[from] reqwest::Error),
|
||||
#[error("Signature verification failed: expected {expected}, found {found}")]
|
||||
SignatureMismatch { expected: String, found: String },
|
||||
#[error("APK parsing error: {0}")]
|
||||
ApkMalformed(String),
|
||||
#[error("FastFlag error: {0}")]
|
||||
FastFlag(String),
|
||||
#[error("Sandbox error: {0}")]
|
||||
Sandbox(String),
|
||||
}
|
||||
2
crates/molotov-bootstrap/src/lib.rs
Normal file
2
crates/molotov-bootstrap/src/lib.rs
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
pub mod error;
|
||||
11
crates/molotov-cli/Cargo.toml
Normal file
11
crates/molotov-cli/Cargo.toml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "molotov-cli"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[dependencies]
|
||||
molotov-core = { path = "../molotov-core" }
|
||||
molotov-bootstrap = { path = "../molotov-bootstrap" }
|
||||
clap = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
4
crates/molotov-cli/src/lib.rs
Normal file
4
crates/molotov-cli/src/lib.rs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
pub fn run(_args: &[String]) {
|
||||
println!("Molotov CLI placeholder");
|
||||
}
|
||||
10
crates/molotov-core/Cargo.toml
Normal file
10
crates/molotov-core/Cargo.toml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[package]
|
||||
name = "molotov-core"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[dependencies]
|
||||
tracing = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
libc = { workspace = true }
|
||||
2
crates/molotov-core/src/lib.rs
Normal file
2
crates/molotov-core/src/lib.rs
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
pub mod symbols;
|
||||
34
crates/molotov-core/src/symbols.rs
Normal file
34
crates/molotov-core/src/symbols.rs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum SymbolCategory {
|
||||
Cordial,
|
||||
Host,
|
||||
Stub,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct SymbolTriage {
|
||||
symbols: HashMap<String, SymbolCategory>,
|
||||
}
|
||||
|
||||
impl SymbolTriage {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
symbols: HashMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn register(&mut self, symbol: &str, category: SymbolCategory) {
|
||||
self.symbols.insert(symbol.to_string(), category);
|
||||
}
|
||||
|
||||
pub fn lookup(&self, symbol: &str) -> Option<SymbolCategory> {
|
||||
self.symbols.get(symbol).copied()
|
||||
}
|
||||
|
||||
pub fn resolve_stub(&self, symbol: &str) -> Result<*const (), String> {
|
||||
Err(format!("ENOSYS: symbol '{}' is an explicit failure stub", symbol))
|
||||
}
|
||||
}
|
||||
22
crates/molotov-core/tests/symbol_triage_test.rs
Normal file
22
crates/molotov-core/tests/symbol_triage_test.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
use molotov_core::symbols::{SymbolCategory, SymbolTriage};
|
||||
|
||||
#[test]
|
||||
fn test_symbol_triage_categorization() {
|
||||
let mut triage = SymbolTriage::new();
|
||||
triage.register("AAssetManager_open", SymbolCategory::Cordial);
|
||||
triage.register("malloc", SymbolCategory::Host);
|
||||
triage.register("unsupported_telemetry_stub", SymbolCategory::Stub);
|
||||
|
||||
assert_eq!(triage.lookup("AAssetManager_open"), Some(SymbolCategory::Cordial));
|
||||
assert_eq!(triage.lookup("malloc"), Some(SymbolCategory::Host));
|
||||
assert_eq!(triage.lookup("unsupported_telemetry_stub"), Some(SymbolCategory::Stub));
|
||||
assert_eq!(triage.lookup("unknown_symbol"), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_stub_never_fakes_success() {
|
||||
let triage = SymbolTriage::new();
|
||||
let res = triage.resolve_stub("fake_func");
|
||||
assert!(res.is_err(), "Stub must return an explicit error, never fake success");
|
||||
}
|
||||
11
crates/molotov-gui/Cargo.toml
Normal file
11
crates/molotov-gui/Cargo.toml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "molotov-gui"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[dependencies]
|
||||
molotov-core = { path = "../molotov-core" }
|
||||
molotov-bootstrap = { path = "../molotov-bootstrap" }
|
||||
eframe = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
4
crates/molotov-gui/src/lib.rs
Normal file
4
crates/molotov-gui/src/lib.rs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
pub fn run() {
|
||||
println!("Molotov GUI placeholder");
|
||||
}
|
||||
9
src/main.rs
Normal file
9
src/main.rs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
fn main() {
|
||||
let args: Vec<String> = std::env::args().collect();
|
||||
if args.len() > 1 {
|
||||
molotov_cli::run(&args[1..]);
|
||||
} else {
|
||||
molotov_gui::run();
|
||||
}
|
||||
}
|
||||
Reference in a new issue