diff options
| author | Chris Rose <offline@offby1.net> | 2026-06-04 00:33:00 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-06-04 00:33:00 -0700 |
| commit | c54d4921662acb372666885037febb5cfde81977 (patch) | |
| tree | 0f1d9cfc0410b202a22c39fbe648d4b516c448e4 | |
| parent | chore(deps): bump lukemathwalker/cargo-chef (diff) | |
| download | atuin-c54d4921662acb372666885037febb5cfde81977.zip | |
chore: update GitHub app token format
| -rw-r--r-- | crates/atuin-client/src/secrets.rs | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/crates/atuin-client/src/secrets.rs b/crates/atuin-client/src/secrets.rs index 459e6238..e8a6ab62 100644 --- a/crates/atuin-client/src/secrets.rs +++ b/crates/atuin-client/src/secrets.rs @@ -67,8 +67,11 @@ pub static SECRET_PATTERNS: &[(&str, &str, TestValue)] = &[ ), ( "GitHub App Installation Access Token", - "ghs_[A-Za-z0-9]{36}", - TestValue::Single("ghs_1234567890abcdefghijklmnopqrstuvwx000"), // not a real token + "ghs_[A-Za-z0-9._-]{36,}", + TestValue::Multiple(&[ + "ghs_1234567890abcdefghijklmnopqrstuvwx000", // not a real token + "ghs_abc-def.ghi_jklMNOP0123456789qrstuv-wxyzABCD", // new token format, fake data + ]), ), ( "GitHub Refresh Token", @@ -164,4 +167,28 @@ mod tests { } } } + + #[test] + fn test_secrets_embedded() { + for (name, regex, test) in SECRET_PATTERNS { + let re = + Regex::new(regex).unwrap_or_else(|_| panic!("Failed to compile regex for {name}")); + + match test { + TestValue::Single(test) => { + let embedded = format!("some random text {test} some more random text"); + assert!(re.is_match(&embedded), "{name} embedded test failed!"); + } + TestValue::Multiple(tests) => { + for test_str in tests.iter() { + let embedded = format!("some random text {test_str} some more random text"); + assert!( + re.is_match(&embedded), + "{name} embedded test with value \"{test_str}\" failed!" + ); + } + } + } + } + } } |
