INNER CODE UNIT · Rust

normalize_for_blocklist

ovexro/dockpanel · panel/backend/src/routes/mod.rs:269

fn normalize_for_blocklist(cmd: &str) -> String {
    let mut out = String::with_capacity(cmd.len());
    let mut chars = cmd.chars();
    while let Some(c) = chars.next() {
        match c {
            '\'' | '"' => {}
            '\\' => {
                if let Some(next) = chars.next() {
                    out.push(next);
                }
            }
            _ => out.push(c),
        }
    }
    out
}

/// Validate a shell command string for safety (used for cron, pre_build, post_deploy).

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…