tinyhumansai/openhuman · error
Blocked potentially dangerous git argument: {arg}
Error message
Blocked potentially dangerous git argument: {arg} What it means
sanitize_git_args rejected one token of the user-supplied git argument string because it starts with an option prefix (such as --exec=, --upload-pack=, --receive-pack=, --pager=) that can make git execute an arbitrary command. The whole git invocation is refused before any process is spawned.
Source
Thrown at src/openhuman/tools/impl/filesystem/git_operations.rs:64
/// Sanitize git arguments to prevent injection attacks
fn sanitize_git_args(&self, args: &str) -> anyhow::Result<Vec<String>> {
let mut result = Vec::new();
for arg in args.split_whitespace() {
// Block dangerous git options that could lead to command injection
let arg_lower = arg.to_lowercase();
if arg_lower.starts_with("--exec=")
|| arg_lower.starts_with("--upload-pack=")
|| arg_lower.starts_with("--receive-pack=")
|| arg_lower.starts_with("--pager=")
|| arg_lower.starts_with("--editor=")
|| arg_lower == "--no-verify"
|| arg_lower.contains("$(")
|| arg_lower.contains('`')
|| arg.contains('|')
|| arg.contains(';')
|| arg.contains('>')
{
anyhow::bail!("Blocked potentially dangerous git argument: {arg}");
}
// Block `-c` config injection (exact match or `-c=...` prefix).
// This must not false-positive on `--cached` or `-cached`.
if arg_lower == "-c" || arg_lower.starts_with("-c=") {
anyhow::bail!("Blocked potentially dangerous git argument: {arg}");
}
result.push(arg.to_string());
}
Ok(result)
}
/// Check if an operation requires write access
fn requires_write_access(&self, operation: &str) -> bool {
matches!(
operation,
"commit" | "add" | "checkout" | "stash" | "reset" | "revert"
)
}View on GitHub (pinned to 7491200858)
Solutions
- Remove the injected transport/pager option from the arguments and pass plain git subcommand arguments
- Express the intended operation with safe positional arguments only
- Never pass shell or exec hooks through git_diff/git_add/git_checkout inputs
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/openhuman/tools/impl/filesystem/git_operations.rs:64 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17).
Data as JSON: /api/errors/c534d520c6c9a481.
Report an issue: GitHub.