From c1bd75a1408defa752917c64df2ceb0445a4942a Mon Sep 17 00:00:00 2001 From: Jose Garcia Crosta Date: Thu, 14 Mar 2024 13:57:05 -0300 Subject: [PATCH] Allow unordered mapping --- detectors/unprotected-mapping-operation/src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/detectors/unprotected-mapping-operation/src/lib.rs b/detectors/unprotected-mapping-operation/src/lib.rs index cc717c6b..430c2c91 100644 --- a/detectors/unprotected-mapping-operation/src/lib.rs +++ b/detectors/unprotected-mapping-operation/src/lib.rs @@ -36,7 +36,7 @@ struct UnprotectedMappingOperationFinder<'tcx, 'tcx_ref> { unauthorized_span: Vec, } -const SOROBAN_MAP_WITH_ADDRESS: &str = "soroban_sdk::Map LateLintPass<'tcx> for UnprotectedMappingOperation { @@ -99,7 +99,11 @@ impl<'tcx> Visitor<'tcx> for UnprotectedMappingOperationFinder<'tcx, '_> { // Get the method expression type and check if it's a map with address let method_expr_type = self.get_node_type(method_expr.hir_id); - if method_expr_type.contains(SOROBAN_MAP_WITH_ADDRESS) { + println!("Method expression type: {}", method_expr_type); + + if method_expr_type.starts_with(SOROBAN_MAP) + && method_expr_type.contains(SOROBAN_ADDRESS) + { // Iterate through the method arguments and check if any of them is an address and not authed method_args.iter().for_each(|arg| { if_chain! {