[CRITICAL] HTTP health check doesn't actually check HTTP response #16
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The HTTP health check in
process.rsonly performs a TCP connect -- it never sends an HTTP request or checks the response status. Theexpect_statusfield in the config is ignored.Impact
Any open TCP port passes the HTTP health check, regardless of whether it's actually serving HTTP or what status code it returns. A database port, SSH port, or any listening socket would be marked as "healthy" for an HTTP health check.
Files
crates/my_init_server/src/process.rs--check_healthfunction,HealthDef::HttpbranchSuggested Fix
Send an actual HTTP GET request to the configured path, parse the response status, and compare against
expect_status. Usereqwestor a minimal HTTP client.Confirmed by code inspection at crates/my_init_server/src/process.rs:739-778. The HealthDef::Http branch calls tokio::net::TcpStream::connect() and returns Healthy on any successful TCP connection regardless of the actual HTTP response. The code's own comments acknowledge this: "For simplicity, we just check if we can connect" and "Would need actual HTTP check here." The expect_status field is compared to 200 but the comparison is meaningless since no HTTP response is ever received.
Any open TCP port (SSH, database, etc.) passes the HTTP health check and marks the service as healthy.