From d637b960994119907b41c82d79f5a71c96dd419b Mon Sep 17 00:00:00 2001 From: Shaoyu Yang Date: Mon, 19 May 2025 16:31:23 +0800 Subject: [PATCH] [BugFix] [Vul] Add missing `usedforsecurity=False` in MD5 hashing to enable FIPS (#18319) Signed-off-by: cascade812 Signed-off-by: shaoyuyoung Co-authored-by: cascade --- .../model_loader/neuronx_distributed.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vllm/model_executor/model_loader/neuronx_distributed.py b/vllm/model_executor/model_loader/neuronx_distributed.py index 1c4f66061d1dd..fee8c10b6c2f0 100644 --- a/vllm/model_executor/model_loader/neuronx_distributed.py +++ b/vllm/model_executor/model_loader/neuronx_distributed.py @@ -143,8 +143,8 @@ class NeuronCausalLM(nn.Module): config = neuronx_model_cls.get_config_cls()( neuron_config, load_config=load_pretrained_config(model_name_or_path)) - hashed_config = hashlib.md5( - config.to_json_string().encode('utf-8')).hexdigest() + hashed_config = hashlib.md5(config.to_json_string().encode('utf-8'), + usedforsecurity=False).hexdigest() if os.getenv("NEURON_COMPILED_ARTIFACTS") is not None: compiled_model_path = os.getenv("NEURON_COMPILED_ARTIFACTS") elif os.path.exists(model_name_or_path): @@ -263,8 +263,8 @@ class NeuronMllamaForCausalLM(nn.Module): config = neuronx_model_cls.get_config_cls()( neuron_config, load_config=load_pretrained_config(model_name_or_path)) - hashed_config = hashlib.md5( - config.to_json_string().encode('utf-8')).hexdigest() + hashed_config = hashlib.md5(config.to_json_string().encode('utf-8'), + usedforsecurity=False).hexdigest() if os.getenv("NEURON_COMPILED_ARTIFACTS") is not None: compiled_model_path = os.getenv("NEURON_COMPILED_ARTIFACTS") elif os.path.exists(model_name_or_path): @@ -426,8 +426,8 @@ class NeuronSpeculationCausalLM(nn.Module): config.fused_spec_config = fused_spec_config self.config.neuron_config = neuron_config - hashed_config = hashlib.md5( - config.to_json_string().encode('utf-8')).hexdigest() + hashed_config = hashlib.md5(config.to_json_string().encode('utf-8'), + usedforsecurity=False).hexdigest() if os.getenv("NEURON_COMPILED_ARTIFACTS") is not None: compiled_model_path = os.getenv("NEURON_COMPILED_ARTIFACTS") elif os.path.exists(model_name_or_path):