From 5370c28bc6db7b5947f659477c94c2df3c3733f4 Mon Sep 17 00:00:00 2001 From: Lifei Zhou Date: Sat, 15 Nov 2025 07:33:09 +1100 Subject: [PATCH 1/2] scan recipe for security when saving recipe --- crates/goose-server/src/routes/recipe.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/goose-server/src/routes/recipe.rs b/crates/goose-server/src/routes/recipe.rs index 45e74c5db509..34b2617a2772 100644 --- a/crates/goose-server/src/routes/recipe.rs +++ b/crates/goose-server/src/routes/recipe.rs @@ -350,6 +350,13 @@ async fn save_recipe( ) -> Result, ErrorResponse> { let Json(raw_json) = payload.map_err(json_rejection_to_error_response)?; let request = deserialize_save_recipe_request(raw_json)?; + let has_security_warnings = request.recipe.check_for_security_warnings(); + if has_security_warnings { + return Err(ErrorResponse { + message: "This recipe contains hidden characters that will be ignored for your safety, as they could be used for malicious purposes.".to_string(), + status: StatusCode::BAD_REQUEST, + }); + } ensure_recipe_valid(&request.recipe)?; let file_path = match request.id.as_ref() { From 506476c2517003ee6bd4fddd6d5f4041fdb9072b Mon Sep 17 00:00:00 2001 From: Lifei Zhou Date: Mon, 17 Nov 2025 10:46:08 +1100 Subject: [PATCH 2/2] update the message --- crates/goose-server/src/routes/recipe.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/goose-server/src/routes/recipe.rs b/crates/goose-server/src/routes/recipe.rs index 34b2617a2772..1f840e8cf8ae 100644 --- a/crates/goose-server/src/routes/recipe.rs +++ b/crates/goose-server/src/routes/recipe.rs @@ -353,7 +353,7 @@ async fn save_recipe( let has_security_warnings = request.recipe.check_for_security_warnings(); if has_security_warnings { return Err(ErrorResponse { - message: "This recipe contains hidden characters that will be ignored for your safety, as they could be used for malicious purposes.".to_string(), + message: "This recipe contains hidden characters that could be malicious. Please remove them before trying to save.".to_string(), status: StatusCode::BAD_REQUEST, }); }