From cceab35ec1a5201ededb44bb220b6c33e0728456 Mon Sep 17 00:00:00 2001 From: Mick Grove Date: Thu, 30 Apr 2026 10:56:35 -0700 Subject: [PATCH] copilot fixes --- src/direct_validate.rs | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/src/direct_validate.rs b/src/direct_validate.rs index 508edec..c3a177a 100644 --- a/src/direct_validate.rs +++ b/src/direct_validate.rs @@ -595,10 +595,17 @@ pub async fn run_direct_validation( } } - // Execute validation based on type + // Execute validation based on type. Errors from the HTTP / gRPC + // pathways (DNS failure, SSRF preflight, request build, request + // execution, timeout) used to short-circuit the whole `validate` + // command via `?`, which left stdout empty and made downstream + // tools (and integration tests) unable to distinguish "no rule" + // from "validation attempted, infrastructure failed". Match the + // pattern used by AWS / GCP / raw branches below: surface the + // error as a non-valid result with the error in `message`. let mut result = match validation { Validation::Http(http_validation) => { - execute_http_validation( + match execute_http_validation( http_validation, &globals, &client, @@ -607,17 +614,37 @@ pub async fn run_direct_validation( args.retries, global_args.allow_internal_ips, ) - .await? + .await + { + Ok(r) => r, + Err(e) => DirectValidationResult { + rule_id: String::new(), + rule_name: String::new(), + is_valid: false, + status_code: None, + message: format!("HTTP validation error: {}", e), + }, + } } Validation::Grpc(grpc_validation_cfg) => { - execute_grpc_validation( + match execute_grpc_validation( grpc_validation_cfg, &globals, &parser, timeout, global_args.allow_internal_ips, ) - .await? + .await + { + Ok(r) => r, + Err(e) => DirectValidationResult { + rule_id: String::new(), + rule_name: String::new(), + is_valid: false, + status_code: None, + message: format!("gRPC validation error: {}", e), + }, + } } Validation::AWS => {