Skip to content

Commit 4e69425

Browse files
author
Jemiiah
committed
feat: resolving issues
1 parent b80e96e commit 4e69425

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

src/log_scrub.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,19 @@ fn patterns() -> &'static [(&'static str, Regex)] {
7676
"bearer_token",
7777
Regex::new(r"(?i)bearer\s+[A-Za-z0-9\-_=+/]{20,}").expect("bearer_token regex"),
7878
),
79-
// Raw base64 segments ≥ 40 chars (likely encoded key material or hashes)
80-
// Excludes short segments common in k8s resource names / UIDs.
81-
(
82-
"base64_segment",
83-
Regex::new(r"(?:[A-Za-z0-9+/]{40,}={0,2})").expect("base64_segment regex"),
84-
),
79+
// Raw base64 segments that are likely secrets.
80+
// We intentionally require either:
81+
// - at least one '+' or '/' character, or
82+
// - '=' padding at the end.
83+
// This avoids false positives on Stellar StrKey public keys (G...)
84+
// and other long plain alphanumeric identifiers.
85+
(
86+
"base64_segment",
87+
Regex::new(
88+
r"(?:[A-Za-z0-9+/]{20,}[+/][A-Za-z0-9+/]{19,}={0,2}|[A-Za-z0-9+/]{40,}={1,2})",
89+
)
90+
.expect("base64_segment regex"),
91+
),
8592
// Hex strings ≥ 64 chars (SHA-256 or larger hashes of key material)
8693
(
8794
"hex_hash",

0 commit comments

Comments
 (0)