Adopt a consistent rule: anything coming from persistence, other platforms/accounts, terminal escape sequences, or secret-managed inputs must be validated/normalized and handled with collision-safe, non-injectable, non-leaky logic.
Apply this as standards:
themes_dir(). Preserve “foreign” absolute paths (don’t attempt partial cross-platform legacy inference).../parent traversal behavior and add Windows-specific coverage where paths/roots differ.0o600) on Unix.Example patterns (condensed):
// 1) Shell quoting helper
fn shell_single_quote(value: &str) -> String {
format!("'{}'", value.replace("'", "'\\''"))
}
// 2) Secret env insertion with collision safety
fn build_secret_env_vars(secrets: &HashMap<String, ManagedSecretValue>) -> HashMap<OsString, OsString> {
let mut env_vars = HashMap::new();
for (secret_key, secret) in secrets {
// typed secrets: if any env var is already set non-empty, skip that secret entirely
// (and never override existing process env)
for (env_name, env_value) in typed_secret_entries(secret) {
if std::env::var(env_name).is_ok_and(|v| !v.is_empty()) {
continue; // collision: skip
}
env_vars.insert(OsString::from(env_name), OsString::from(env_value));
}
}
env_vars
}
Enter the URL of a public GitHub repository