Skip to content

Commit 46d6e9b

Browse files
committed
Expand placeholder secret detection
Adds more common placeholder values so config diagnostics catch default and sample webhook secrets during validation.
1 parent f50afb3 commit 46d6e9b

1 file changed

Lines changed: 35 additions & 1 deletion

File tree

crates/config/src/lib.rs

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,15 @@ impl Diagnostic {
250250
}
251251

252252
const PLACEHOLDER_SECRETS: &[&str] =
253-
&["CHANGE_ME", "CHANGEME", "changeme", "your-secret", "secret"];
253+
&[
254+
"CHANGE_ME",
255+
"CHANGEME",
256+
"changeme",
257+
"replace-with-a-random-webhook-secret",
258+
"replace-me",
259+
"your-secret",
260+
"secret",
261+
];
254262

255263
fn next_step_for(field: &str, _message: &str) -> &'static str {
256264
match field {
@@ -458,6 +466,32 @@ mod tests {
458466
assert!(errs.contains(&"github.private_key_path"));
459467
}
460468

469+
#[test]
470+
fn flags_starter_webhook_secret_placeholder() {
471+
let dir = tmpdir();
472+
let pem = write_pem(&dir);
473+
let bin = write_bin(&dir);
474+
let cfg = config_with(
475+
GitHubAppConfig {
476+
app_id: 1,
477+
private_key_path: pem,
478+
webhook_secret: "replace-with-a-random-webhook-secret".into(),
479+
api_base_url: None,
480+
},
481+
WorkerConfig {
482+
concurrency: 1,
483+
coven_code_bin: bin,
484+
workspace_root: dir.clone(),
485+
timeout_secs: 600,
486+
max_retries: 2,
487+
},
488+
vec![good_familiar()],
489+
);
490+
let diags = cfg.check();
491+
let errs = errors(&diags);
492+
assert!(errs.contains(&"github.webhook_secret"));
493+
}
494+
461495
#[test]
462496
fn flags_missing_binary_and_empty_familiars() {
463497
let dir = tmpdir();

0 commit comments

Comments
 (0)