mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-24 20:28:06 +02:00
* refactor: Update comments for clarity and add expectations.json files for performance metrics * feat: Implement FP guard for JS/TS local-collection receivers to suppress missing ownership checks * feat: Enhance Rust parameter handling to classify local collections and prevent false ownership checks * refactor: Simplify code formatting for better readability in multiple files * refactor: Improve UTF-8 sequence length handling and enhance clarity in loop iteration * feat: Update Java and Python patterns to include new security rules * refactor: Improve comment clarity and consistency across multiple Rust files * refactor: Simplify code formatting for improved readability in integration tests and module files * refactor: Improve comment formatting and enhance clarity in assertions across multiple files
38 lines
1.1 KiB
Rust
38 lines
1.1 KiB
Rust
// Fixture for symex per-case path-constraint exploration.
|
|
//
|
|
// The match arm with `cap == Cap::Raw` flows tainted environment input
|
|
// into a shell sink. The Cap::Safe arm allowlists the input via match
|
|
// before reaching the sink. After the executor refactor, the symex
|
|
// explorer forks per match arm with a `cap == <arm_value>` path
|
|
// constraint; the Safe arm explores along its own state where the
|
|
// allowlist guards the sink.
|
|
|
|
use std::env;
|
|
use std::process::Command;
|
|
|
|
#[derive(PartialEq)]
|
|
enum Cap {
|
|
Raw,
|
|
Safe,
|
|
}
|
|
|
|
pub fn dispatch(cap: Cap) {
|
|
let user_cmd = env::var("USER_CMD").unwrap_or_default();
|
|
match cap {
|
|
// Raw arm, tainted user_cmd flows directly into the shell.
|
|
Cap::Raw => {
|
|
Command::new("sh")
|
|
.arg("-c")
|
|
.arg(&user_cmd)
|
|
.output()
|
|
.unwrap();
|
|
}
|
|
// Safe arm, allowlist-guarded execution.
|
|
Cap::Safe => {
|
|
let allowed = ["ls", "date"];
|
|
if allowed.contains(&user_cmd.as_str()) {
|
|
Command::new(&user_cmd).output().unwrap();
|
|
}
|
|
}
|
|
}
|
|
}
|