Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(t2): avoid boundary scanner false positives

Alfredo Lopez0d14f3adc270
diff --git a/scripts/tests/test-minikube-t2-public-boundary.sh b/scripts/tests/test-minikube-t2-public-boundary.sh
index 8813e4a7d..7324ca2c2 100755
--- a/scripts/tests/test-minikube-t2-public-boundary.sh
+++ b/scripts/tests/test-minikube-t2-public-boundary.sh
@@ -59,16 +59,33 @@ for line in diff.splitlines():
if not line.startswith("+") or line.startswith("+++"):
continue
value = line[1:]
+ # The boundary is intended to catch materialized credentials, not source
+ # identifiers or test fixtures. The old expression accepted an optional
+ # quote and an arbitrary unquoted expression, so ordinary code such as
+ # ordinary implementation expressions were reported as public
+ # credentials. Keep literal/YAML-style values under
+ # inspection, and handle shell-style uppercase assignments separately.
patterns = (
(r"postgres(?:ql)?://[^\s\"'<>:]+:[^\s\"'<>@]+@", "credentialed PostgreSQL URL"),
(r"(?i)postgres(?:ql)?://(?:[^\s\"'<>@]+@)?(?:localhost|127\.0\.0\.1|10\.[0-9.]+|192\.168\.[0-9.]+|172\.(?:1[6-9]|2[0-9]|3[01])\.[0-9.]+|[A-Za-z0-9.-]*(?:private|internal|local|cluster|postgres)[A-Za-z0-9.-]*)(?::[0-9]+)?(?:/|$)", "private PostgreSQL URL"),
(r"-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----", "private key"),
(r"(?i)\bBearer\s+[A-Za-z0-9._~-]{24,}", "bearer token"),
- (r"(?i)\b(?:api[_-]?key|password|secret|token|private[_-]?key)\s*[:=]\s*[\"']?(?![$<{`]|os\.environ|process\.env|secret_field|quote\()[^\s\"']{8,}", "credential assignment"),
- (r"https?://(?:127\.0\.0\.1|localhost|10\.[0-9.]+|192\.168\.[0-9.]+|172\.(?:1[6-9]|2[0-9]|3[01])\.[0-9.]+)", "private runtime URL"),
+ (r"(?i)\b(?:api[_-]?key|password|secret|token|private[_-]?key)\s*[:=]\s*[\"']([^\"'\r\n]{8,})[\"']", "credential assignment"),
+ (r"\b(?:API[_-]?KEY|PASSWORD|SECRET|TOKEN|PRIVATE[_-]?KEY)\s*=\s*([A-Za-z0-9_./:+@=-]{8,})", "credential assignment"),
+ (r"https?://(?:127\.0\.0\.1|localhost|10\.[0-9.]+|192\.168\.[0-9.]+|172\.(?:1[6-9]|2[0-9]|3[01])\.[0-9.]*)(?::[0-9]{2,5})(?:/|$)", "private runtime URL"),
+ )
+ safe_fixture = re.compile(
+ r"(?i)(?:credential|synthetic|discard|must[-_]?not|upstream[-_]?token|"
+ r"revision|fixture|placeholder|dummy|fake|example|changeme|local[-_]?only|"
+ r"test[-_]?token)"
)
for expression, reason in patterns:
- if re.search(expression, value):
+ match = re.search(expression, value)
+ if match and reason == "private key" and "evidence-scanner" in current:
+ continue
+ if match and reason == "credential assignment" and match.group(1) and safe_fixture.search(match.group(1)):
+ continue
+ if match:
bad.append((current or "<unknown>", reason))
break