From 8b5c4bcd8af3a5e97a7b6c48a8791e37345e7c46 Mon Sep 17 00:00:00 2001 From: Drewry Pope Date: Tue, 27 Oct 2026 15:23:09 -0500 Subject: [PATCH] fix(id): reject an empty module_hash in world manifests (#1517) --- pkgs/id/src/world_manifest.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/id/src/world_manifest.rs b/pkgs/id/src/world_manifest.rs index 5cf26a2883..8b54f1cb0d 100644 --- a/pkgs/id/src/world_manifest.rs +++ b/pkgs/id/src/world_manifest.rs @@ -179,7 +179,9 @@ impl WorldManifest { "module_hash and module_source are mutually exclusive" ); if let Some(hash) = &self.module_hash { - let valid = hash.len() <= MAX_NAME_BYTES && hash.bytes().all(|b| b.is_ascii_hexdigit()); + let valid = !hash.is_empty() + && hash.len() <= MAX_NAME_BYTES + && hash.bytes().all(|b| b.is_ascii_hexdigit()); ensure!( valid, "module hash must be 1 to {MAX_NAME_BYTES} hex digits" @@ -580,6 +582,7 @@ wasm_fuel = 5_000_000 assert!(parse("ceiling = [\"*\"]").is_err()); assert!(parse("ceiling = [\"time.nwo\"]").is_err()); assert!(parse("module_hash = \"not-hex!\"").is_err()); + assert!(parse("module_hash = \"\"").is_err()); assert!(parse("module_hash = \"abc\"\nmodule_source = \"main.roc\"").is_err()); assert!(parse("schedules = { \"bad\nid\" = 1 }").is_err()); assert!(parse("schedules = { \"a\" = 0 }").is_err());