Skip to content

Commit 9005d23

Browse files
authored
Exempt /liveness and /readiness from auth (#10)
Kubernetes liveness and readiness probes can't carry Bearer tokens or API keys, so authenticating them gates the router's own readiness on having a valid token, which is a chicken-and-egg problem when JWT verification is enabled: /readiness -> 401 -> probe fails -> pod NotReady -> service has no ready endpoints -> platform's find_router_url returns None -> the orchestrator bypasses the router entirely -> no per-run metrics The endpoints expose no sensitive data — just 'process is alive' and 'at least one worker is ready' — so it's safe to leave them open. User-facing /health and /health_generate keep auth.
1 parent 8c1addf commit 9005d23

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

src/server.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -189,21 +189,16 @@ async fn transparent_proxy_handler(State(state): State<Arc<AppState>>, req: Requ
189189
}
190190

191191
// Health check endpoints
192-
async fn liveness(State(state): State<Arc<AppState>>, req: Request) -> Response {
193-
let headers = req.headers().clone();
194-
if let Err(response) = authorize_request(&state, &headers).await {
195-
return response;
196-
}
197-
192+
//
193+
// /liveness and /readiness are intentionally unauthenticated so kube
194+
// probes (which can't carry Bearer tokens) keep working when JWT or
195+
// API-key auth is enabled. They expose no sensitive information — just
196+
// "the router process is alive" / "at least one worker is ready".
197+
async fn liveness(State(state): State<Arc<AppState>>, _req: Request) -> Response {
198198
state.router.liveness()
199199
}
200200

201-
async fn readiness(State(state): State<Arc<AppState>>, req: Request) -> Response {
202-
let headers = req.headers().clone();
203-
if let Err(response) = authorize_request(&state, &headers).await {
204-
return response;
205-
}
206-
201+
async fn readiness(State(state): State<Arc<AppState>>, _req: Request) -> Response {
207202
state.router.readiness()
208203
}
209204

0 commit comments

Comments
 (0)