truememory-mirror 1.0.10 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/sanitizer.js +6 -0
package/package.json
CHANGED
package/src/sanitizer.js
CHANGED
|
@@ -33,6 +33,12 @@ export function sanitize(text) {
|
|
|
33
33
|
text = text.replace(/\b(sk-ant-api03-|sk-ant-|sk-proj-|sk-or-v1-|ghp_|gho_|github_pat_|ghu_|ghs_|pk_live_|sk_live_|pk_test_|sk_test_|xoxb-|xoxp-|xapp-|AKIA[A-Z0-9]|AGE-SECRET-KEY-|glpat-|pypi-|npm_)[a-zA-Z0-9_/+=.-]{10,}/g, '[API_KEY]');
|
|
34
34
|
text = text.replace(/\bAIza[a-zA-Z0-9_-]{30,}\b/g, '[API_KEY]');
|
|
35
35
|
text = text.replace(/\b(sk-|pk-)[a-zA-Z0-9_-]{20,}\b/g, '[API_KEY]');
|
|
36
|
+
// AWS secret access keys (40-char base64 with slashes and plus)
|
|
37
|
+
text = text.replace(/\b[A-Za-z0-9/+=]{40}\b/g, (match) => {
|
|
38
|
+
// Only redact if it looks like a secret (has mixed case + special chars)
|
|
39
|
+
if (/[a-z]/.test(match) && /[A-Z]/.test(match) && /[/+=]/.test(match)) return '[API_KEY]';
|
|
40
|
+
return match;
|
|
41
|
+
});
|
|
36
42
|
|
|
37
43
|
// --- JWTs (any alg, not just HS256) ---
|
|
38
44
|
text = text.replace(/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g, '[JWT]');
|