Skip to content

Commit

Permalink
display warning about problematic key names
Browse files Browse the repository at this point in the history
  • Loading branch information
tangowithfoxtrot committed Feb 21, 2024
1 parent 710ae61 commit f3ad7f3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/bws/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,14 @@ async fn process_commands() -> Result<()> {
.map(|s| (s.key.clone(), s.value.clone()))
.collect::<std::collections::HashMap<String, String>>();

let valid_key_regex = regex::Regex::new("^[a-zA-Z_][a-zA-Z0-9_]*$").unwrap();

for key in environment.keys() {
if !valid_key_regex.is_match(key) {
eprintln!("Warning: secret name '{}' is not POSIX-compliant", key);
}
}

let command = if command.is_empty() {
let mut buffer = String::new();
std::io::stdin().read_to_string(&mut buffer)?;
Expand Down

0 comments on commit f3ad7f3

Please sign in to comment.