aboutsummaryrefslogtreecommitdiffstats
path: root/atuin-client/src/secrets.rs
diff options
context:
space:
mode:
authorEllie Huxtable <ellie@elliehuxtable.com>2024-04-18 16:41:28 +0100
committerGitHub <noreply@github.com>2024-04-18 16:41:28 +0100
commit95cc472037fcb3207b510e67f1a44af4e2a2cae9 (patch)
treefc1d3e71d8e0bdb806370e4144fd6f373bcc9c5e /atuin-client/src/secrets.rs
parentfeat: show preview auto (#1804) (diff)
downloadatuin-95cc472037fcb3207b510e67f1a44af4e2a2cae9.zip
chore: move crates into crates/ dir (#1958)
I'd like to tidy up the root a little, and it's nice to have all the rust crates in one place
Diffstat (limited to 'atuin-client/src/secrets.rs')
-rw-r--r--atuin-client/src/secrets.rs59
1 files changed, 0 insertions, 59 deletions
diff --git a/atuin-client/src/secrets.rs b/atuin-client/src/secrets.rs
deleted file mode 100644
index 21f015cd..00000000
--- a/atuin-client/src/secrets.rs
+++ /dev/null
@@ -1,59 +0,0 @@
-// This file will probably trigger a lot of scanners. Sorry.
-
-// A list of (name, regex, test), where test should match against regex
-pub static SECRET_PATTERNS: &[(&str, &str, &str)] = &[
- (
- "AWS Access Key ID",
- "AKIA[0-9A-Z]{16}",
- "AKIAIOSFODNN7EXAMPLE",
- ),
- (
- "Atuin login",
- r"atuin\s+login",
- "atuin login -u mycoolusername -p mycoolpassword -k \"lots of random words\"",
- ),
- (
- "GitHub PAT (old)",
- "ghp_[a-zA-Z0-9]{36}",
- "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", // legit, I expired it
- ),
- (
- "GitHub PAT (new)",
- "github_pat_[a-zA-Z0-9]{22}_[a-zA-Z0-9]{59}",
- "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", // also legit, also expired
- ),
- (
- "Slack OAuth v2 bot",
- "xoxb-[0-9]{11}-[0-9]{11}-[0-9a-zA-Z]{24}",
- "xoxb-17653672481-19874698323-pdFZKVeTuE8sk7oOcBrzbqgy",
- ),
- (
- "Slack OAuth v2 user token",
- "xoxp-[0-9]{11}-[0-9]{11}-[0-9a-zA-Z]{24}",
- "xoxp-17653672481-19874698323-pdFZKVeTuE8sk7oOcBrzbqgy",
- ),
- (
- "Slack webhook",
- "T[a-zA-Z0-9_]{8}/B[a-zA-Z0-9_]{8}/[a-zA-Z0-9_]{24}",
- "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX",
- ),
- ("Stripe test key", "sk_test_[0-9a-zA-Z]{24}", "sk_test_1234567890abcdefghijklmnop"),
- ("Stripe live key", "sk_live_[0-9a-zA-Z]{24}", "sk_live_1234567890abcdefghijklmnop"),
-];
-
-#[cfg(test)]
-mod tests {
- use regex::Regex;
-
- use crate::secrets::SECRET_PATTERNS;
-
- #[test]
- fn test_secrets() {
- for (name, regex, test) in SECRET_PATTERNS {
- let re =
- Regex::new(regex).unwrap_or_else(|_| panic!("Failed to compile regex for {name}"));
-
- assert!(re.is_match(test), "{name} test failed!");
- }
- }
-}