flagon-io/g1t

public

Git for AI scale: a forge for thousands of agents working on the same code at once.

Commit

Secret-refusal tests build their key-shaped values at run time

So no whole key-shaped string sits in the source for secret scanners to flag. The values were never real keys.

syntaqxcommitted Parentce402c0Browse files
1 file+14−110/1 viewed
+14−11
674674
675675 #[test]
676676 fn credentials_are_refused() {
677+ // Key-shaped values are joined at run time: no whole key sits in the
678+ // source for secret scanners to flag.
679+ let join = |a: &str, b: &str| format!("{a}{b}");
677680 for text in [
678− "The key is sk-ant-api03-abcdefghijklmnopqrstuvwxyz",
679− "use ghp_abcdefghijklmnopqrstuvwxyz0123456789 to clone",
680− "AWS: AKIAIOSFODNN7EXAMPLE",
681− "STRIPE_KEY=sk_live_51HabcdefghijklmnopQRSTUV",
682− "password = hunter2hunter2",
683− "db: postgres://admin:s3cret@db.internal:5432/app",
684− "token is 3f9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d3e2f1a0b9c8d7e6f5a4b3c2d1e0f9a",
685− "-----BEGIN RSA PRIVATE KEY-----\nMIIE...",
686− "secret: Zq8wN3vR7tY2uI5oP1aS6dF4gH9jK0lX",
687− "it is xK9mQ2vL8nR4tP7wZ3yB6cF1dG5hJ0sA",
681+ join("The key is sk-", "ant-api03-abcdefghijklmnopqrstuvwxyz"),
682+ join("use gh", "p_abcdefghijklmnopqrstuvwxyz0123456789 to clone"),
683+ join("AWS: AK", "IAIOSFODNN7EXAMPLE"),
684+ join("STRIPE_KEY=sk_l", "ive_51HabcdefghijklmnopQRSTUV"),
685+ "password = hunter2hunter2".to_owned(),
686+ "db: postgres://admin:s3cret@db.internal:5432/app".to_owned(),
687+ "token is 3f9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d3e2f1a0b9c8d7e6f5a4b3c2d1e0f9a".to_owned(),
688+ "-----BEGIN RSA PRIVATE KEY-----\nMIIE...".to_owned(),
689+ "secret: Zq8wN3vR7tY2uI5oP1aS6dF4gH9jK0lX".to_owned(),
690+ "it is xK9mQ2vL8nR4tP7wZ3yB6cF1dG5hJ0sA".to_owned(),
688691 ] {
689− assert!(secret_in(text).is_some(), "{text}");
692+ assert!(secret_in(&text).is_some(), "{text}");
690693 }
691694 }
692695