Skip to content

Commit 5c949e7

Browse files
authored
Merge pull request #160 from Dstack-TEE/chore/ingress-dead-code
chore(ingress): remove unreachable code
2 parents 9c40797 + f16106b commit 5c949e7

3 files changed

Lines changed: 0 additions & 95 deletions

File tree

‎custom-domain/dstack-ingress/scripts/entrypoint.sh‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,4 @@ case "$CHALLENGE_TYPE" in
186186
tls-alpn-01)
187187
exec /scripts/tlsalpn.sh "$@"
188188
;;
189-
*)
190-
echo "Error: invalid CHALLENGE_TYPE '$CHALLENGE_TYPE' (expected dns-01 or tls-alpn-01)" >&2
191-
exit 1
192-
;;
193189
esac

‎custom-domain/dstack-ingress/scripts/functions.sh‎

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,6 @@ sanitize_target_endpoint() {
6969
fi
7070
}
7171

72-
sanitize_client_max_body_size() {
73-
local candidate="$1"
74-
if [ -z "$candidate" ]; then
75-
echo ""
76-
return 0
77-
fi
78-
if [[ "$candidate" =~ ^[0-9]+[kKmMgG]?$ ]]; then
79-
echo "$candidate"
80-
else
81-
echo "Warning: Ignoring invalid CLIENT_MAX_BODY_SIZE value: $candidate" >&2
82-
echo ""
83-
fi
84-
}
85-
8672
sanitize_dns_label() {
8773
local candidate="$1"
8874
if [ -z "$candidate" ]; then
@@ -173,49 +159,6 @@ sanitize_boolean() {
173159
esac
174160
}
175161

176-
sanitize_proxy_timeout() {
177-
local candidate="$1"
178-
if [ -z "$candidate" ]; then
179-
echo ""
180-
return 0
181-
fi
182-
if [[ "$candidate" =~ ^[0-9]+[smh]?$ ]]; then
183-
echo "$candidate"
184-
else
185-
echo "Warning: Ignoring invalid proxy timeout value: $candidate" >&2
186-
echo ""
187-
fi
188-
}
189-
190-
sanitize_proxy_buffer_size() {
191-
local candidate="$1"
192-
if [ -z "$candidate" ]; then
193-
echo ""
194-
return 0
195-
fi
196-
if [[ "$candidate" =~ ^[0-9]+[kKmM]?$ ]]; then
197-
echo "$candidate"
198-
else
199-
echo "Warning: Ignoring invalid proxy buffer size value: $candidate" >&2
200-
echo ""
201-
fi
202-
}
203-
204-
sanitize_proxy_buffers() {
205-
local candidate="$1"
206-
if [ -z "$candidate" ]; then
207-
echo ""
208-
return 0
209-
fi
210-
# Format: number size (e.g., "4 256k")
211-
if [[ "$candidate" =~ ^[0-9]+[[:space:]]+[0-9]+[kKmM]?$ ]]; then
212-
echo "$candidate"
213-
else
214-
echo "Warning: Ignoring invalid proxy buffers value: $candidate (expected format: 'number size', e.g., '4 256k')" >&2
215-
echo ""
216-
fi
217-
}
218-
219162
txt_record_name() {
220163
local domain="$1"
221164
if [[ "$domain" == \*.* ]]; then

‎custom-domain/dstack-ingress/scripts/tests/test_sanitizers.sh‎

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,8 @@ assert_equal "$(sanitize_target_endpoint grpc://svc:50051)" "grpc://svc:50051" "
5757
assert_equal "$(sanitize_target_endpoint app:80)" "app:80" "sanitize_target_endpoint accepts bare host:port"
5858
assert_equal "$(sanitize_target_endpoint app-main)" "app-main" "sanitize_target_endpoint accepts bare hostname"
5959
assert_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"
6160
assert_equal "$(sanitize_dns_label test_label)" "test_label" "sanitize_dns_label accepts lowercase"
6261
assert_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"
6862
assert_equal "$(sanitize_positive_integer 4096 MAXCONN)" "4096" "sanitize_positive_integer accepts 4096"
6963
assert_equal "$(sanitize_positive_integer 1 MAXCONN)" "1" "sanitize_positive_integer accepts 1"
7064
assert_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
111105
assert_fails "sanitize_gateway_domain rejects a space" sanitize_gateway_domain "gw example.com"
112106
assert_fails "sanitize_domain rejects path traversal" sanitize_domain ../etc/passwd
113107
assert_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-
142108
assert_fails "sanitize_dns_label rejects invalid characters" sanitize_dns_label "bad*label"
143109
assert_fails "sanitize_positive_integer rejects zero" sanitize_positive_integer 0 MAXCONN
144110
assert_fails "sanitize_positive_integer rejects non-numeric" sanitize_positive_integer abc MAXCONN

0 commit comments

Comments
 (0)