From 2d2644ac8d844ef68369019757ebb6b5d1b15937 Mon Sep 17 00:00:00 2001
From: Christopher Sellers <1@christophersellers.com>
Date: Wed, 28 Oct 2026 01:43:29 -0700
Subject: [PATCH 1/2] fix(security): harden URL host checks and key-file
emission (batch 3)
Code-scanning URL/sanitization batch: parse hosts via urlparse/URL
hostname equality or allowlist instead of substring/startsWith; write
minted API keys to a 0600 --key-file instead of printing raw keys; close
the incomplete multi-character sanitization gap in api-security tests.
Alerts: 42, 47-56, 71, 68, 18.
Signed-off-by: Christopher Sellers <1@christophersellers.com>
---
.../src/test/security/api-security.test.ts | 27 ++++--
scripts/create_test_api_key.py | 94 +++++++++++++++++--
services/ingestion/tests/test_alerts_1342.py | 5 +-
.../ingestion/tests/test_models_ssrf_1342.py | 5 +-
.../tests/test_regengine_sources_rest_qa.py | 9 +-
.../tests/test_routes_ingest_internal_urls.py | 21 ++---
.../tests/test_stripe_helpers_1342.py | 8 +-
.../scheduler/tests/test_notifications.py | 6 +-
tests/scripts/test_prod_default_guards.py | 44 +++++++++
9 files changed, 179 insertions(+), 40 deletions(-)
diff --git a/frontend/src/test/security/api-security.test.ts b/frontend/src/test/security/api-security.test.ts
index 0fd5376dd..c486c1b16 100644
--- a/frontend/src/test/security/api-security.test.ts
+++ b/frontend/src/test/security/api-security.test.ts
@@ -2,9 +2,9 @@
* TC_PERF_001 - TC_PERF_002: Performance Tests
* TC_SEC_001 - TC_SEC_002: Security Tests
* TC_INT_001: Integration Resilience Tests
- *
+ *
* Tests for load handling, stress conditions, and security vulnerabilities.
- *
+ *
* Compliance: OWASP Top 10
*/
@@ -68,21 +68,34 @@ describe('API Security Tests', () => {
'',
'
',
'javascript:alert(1)',
+ 'data:text/html,',
+ 'vbscript:msgbox(1)',
'