@@ -57,14 +57,8 @@ assert_equal "$(sanitize_target_endpoint grpc://svc:50051)" "grpc://svc:50051" "
5757assert_equal " $( sanitize_target_endpoint app:80) " " app:80" " sanitize_target_endpoint accepts bare host:port"
5858assert_equal " $( sanitize_target_endpoint app-main) " " app-main" " sanitize_target_endpoint accepts bare hostname"
5959assert_equal " $( sanitize_target_endpoint 10.0.0.1:8080) " " 10.0.0.1:8080" " sanitize_target_endpoint accepts IP:port"
60- assert_equal " $( sanitize_client_max_body_size 50m) " " 50m" " sanitize_client_max_body_size accepts suffix"
6160assert_equal " $( sanitize_dns_label test_label) " " test_label" " sanitize_dns_label accepts lowercase"
6261assert_equal " $( sanitize_dns_label test-label) " " test-label" " sanitize_dns_label accepts hyphen"
63- assert_equal " $( sanitize_proxy_timeout 30) " " 30" " sanitize_proxy_timeout accepts numeric value"
64- assert_equal " $( sanitize_proxy_timeout 30s) " " 30s" " sanitize_proxy_timeout accepts seconds suffix"
65- assert_equal " $( sanitize_proxy_timeout 5m) " " 5m" " sanitize_proxy_timeout accepts minutes suffix"
66- assert_equal " $( sanitize_proxy_timeout 1h) " " 1h" " sanitize_proxy_timeout accepts hours suffix"
67- assert_equal " $( sanitize_proxy_timeout ' ' ) " " " " sanitize_proxy_timeout accepts empty value"
6862assert_equal " $( sanitize_positive_integer 4096 MAXCONN) " " 4096" " sanitize_positive_integer accepts 4096"
6963assert_equal " $( sanitize_positive_integer 1 MAXCONN) " " 1" " sanitize_positive_integer accepts 1"
7064assert_equal " $( sanitize_haproxy_timeout 10s TIMEOUT_CONNECT) " " 10s" " sanitize_haproxy_timeout accepts 10s"
@@ -111,34 +105,6 @@ assert_fails "sanitize_gateway_domain rejects a newline" sanitize_gateway_domain
111105assert_fails " sanitize_gateway_domain rejects a space" sanitize_gateway_domain " gw example.com"
112106assert_fails " sanitize_domain rejects path traversal" sanitize_domain ../etc/passwd
113107assert_fails " sanitize_target_endpoint rejects malformed URL" sanitize_target_endpoint " http:///broken"
114- warning_output=" $( sanitize_client_max_body_size " 50mb" 2>&1 || true) "
115- if [[ " $warning_output " == " Warning: Ignoring invalid CLIENT_MAX_BODY_SIZE value: 50mb" ]]; then
116- echo " PASS: sanitize_client_max_body_size warns and returns empty"
117- else
118- echo " FAIL: sanitize_client_max_body_size warning unexpected"
119- printf ' %s\n' " $warning_output "
120- failures=$(( failures + 1 ))
121- fi
122-
123- # Test invalid timeout values
124- timeout_warning=" $( sanitize_proxy_timeout " 30ms" 2>&1 || true) "
125- if [[ " $timeout_warning " == " Warning: Ignoring invalid proxy timeout value: 30ms" ]]; then
126- echo " PASS: sanitize_proxy_timeout warns on invalid suffix (ms)"
127- else
128- echo " FAIL: sanitize_proxy_timeout warning unexpected"
129- printf ' %s\n' " $timeout_warning "
130- failures=$(( failures + 1 ))
131- fi
132-
133- timeout_warning=" $( sanitize_proxy_timeout " abc" 2>&1 || true) "
134- if [[ " $timeout_warning " == " Warning: Ignoring invalid proxy timeout value: abc" ]]; then
135- echo " PASS: sanitize_proxy_timeout warns on non-numeric value"
136- else
137- echo " FAIL: sanitize_proxy_timeout warning unexpected"
138- printf ' %s\n' " $timeout_warning "
139- failures=$(( failures + 1 ))
140- fi
141-
142108assert_fails " sanitize_dns_label rejects invalid characters" sanitize_dns_label " bad*label"
143109assert_fails " sanitize_positive_integer rejects zero" sanitize_positive_integer 0 MAXCONN
144110assert_fails " sanitize_positive_integer rejects non-numeric" sanitize_positive_integer abc MAXCONN
0 commit comments