{"record":{"id":"c534d520c6c9a481","repo":"tinyhumansai/openhuman","slug":"blocked-potentially-dangerous-git-argument-arg","errorCode":null,"errorMessage":"Blocked potentially dangerous git argument: {arg}","messagePattern":"Blocked potentially dangerous git argument: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/tools/impl/filesystem/git_operations.rs","lineNumber":64,"sourceCode":"    /// Sanitize git arguments to prevent injection attacks\n    fn sanitize_git_args(&self, args: &str) -> anyhow::Result<Vec<String>> {\n        let mut result = Vec::new();\n        for arg in args.split_whitespace() {\n            // Block dangerous git options that could lead to command injection\n            let arg_lower = arg.to_lowercase();\n            if arg_lower.starts_with(\"--exec=\")\n                || arg_lower.starts_with(\"--upload-pack=\")\n                || arg_lower.starts_with(\"--receive-pack=\")\n                || arg_lower.starts_with(\"--pager=\")\n                || arg_lower.starts_with(\"--editor=\")\n                || arg_lower == \"--no-verify\"\n                || arg_lower.contains(\"$(\")\n                || arg_lower.contains('`')\n                || arg.contains('|')\n                || arg.contains(';')\n                || arg.contains('>')\n            {\n                anyhow::bail!(\"Blocked potentially dangerous git argument: {arg}\");\n            }\n            // Block `-c` config injection (exact match or `-c=...` prefix).\n            // This must not false-positive on `--cached` or `-cached`.\n            if arg_lower == \"-c\" || arg_lower.starts_with(\"-c=\") {\n                anyhow::bail!(\"Blocked potentially dangerous git argument: {arg}\");\n            }\n            result.push(arg.to_string());\n        }\n        Ok(result)\n    }\n\n    /// Check if an operation requires write access\n    fn requires_write_access(&self, operation: &str) -> bool {\n        matches!(\n            operation,\n            \"commit\" | \"add\" | \"checkout\" | \"stash\" | \"reset\" | \"revert\"\n        )\n    }","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/tools/impl/filesystem/git_operations.rs#L46-L82","documentation":"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.","triggerScenarios":"Thrown at src/openhuman/tools/impl/filesystem/git_operations.rs:64 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}