Skip to main content

check_protected_path

Function check_protected_path 

Source
pub fn check_protected_path(
    tool_name: &str,
    is_readonly: bool,
    content: Option<&str>,
) -> Option<String>
Expand description

Check whether a file path is in the protected-paths list (NEW-PERM-2, Goal H2). Used by the permission pipeline to enforce the safety check independently of whether permissions is configured — with_policy alone used to skip this check entirely, allowing writes to .git/hooks/, .env, etc. Returns the offending protected path component if matched, None otherwise.

is_readonly exempts Read and Grep from the check.