pub(crate) fn validate_environment_name(name: &str) -> std::io::Result<()> {
let lower = name.to_ascii_lowercase();
if name.is_empty()
|| !name
.bytes()
.enumerate()
.all(|(i, c)| c == b'_' || c.is_ascii_alphabetic() || (i > 0 && c.is_ascii_digit()))
|| name.starts_with("WORKFLOW_")
|| [
"token",
"secret",
"password",
"credential",
"private_key",
"api_key",
"access_key",
"cookie",
]
.iter()
.any(|p| lower.contains(p))
{
return Err(std::io::Error::other(
"reproduction environment accepts scientific variable names; credentials remain in external profiles",
));
}
Ok(())
}