open-standards/wai/http-conformance/falsify/grants-module-unchecked.patch

15 lines
826 B
Diff

# must fail: grants_file_other_module
# a grants file for another module read (keys::read_grants_file)
diff --git a/wai/wai-rs/src/http_binding/keys.rs b/wai/wai-rs/src/http_binding/keys.rs
index ad1572bc..1466070b 100644
--- a/wai/wai-rs/src/http_binding/keys.rs
+++ b/wai/wai-rs/src/http_binding/keys.rs
@@ -213,7 +213,7 @@ pub fn read_grants_file(module: &[u8; 32], bytes: &[u8]) -> Result<Vec<String>,
if m["kind"].as_str() != Some(GRANTS_KIND) {
return Err(bad("kind is not wai-module-grants"));
}
- if m["module"].as_str().and_then(super::unhex32) != Some(*module) {
+ if m["module"].as_str().and_then(super::unhex32).is_none() {
return Err(bad("module is not the digest the file is fetched for"));
}
let grants = m["grants"].as_array().ok_or(bad("grants is not an array"))?;