INNER CODE UNIT · Rust
is_valid_container_id
ovexro/dockpanel · panel/backend/src/routes/mod.rs:246
pub fn is_valid_container_id(id: &str) -> bool {
!id.is_empty()
&& id.len() <= 64
&& id.chars().all(|c| c.is_ascii_hexdigit())
}
/// Validate a user-provided file path (reject traversal and injection).
pub fn is_safe_relative_path(path: &str) -> bool {
!path.is_empty()
&& !path.contains('\0')
&& !path.contains("..")
&& !path.starts_with('/')
&& !path.contains('\\')
&& path.len() <= 4096
}
/// Reduce ordinary shell quoting/escaping so keyword-blocklist matching sees
/// what the shell will actually run, not what was literally typed —