Unverified Commit d637b960 authored by Shaoyu Yang's avatar Shaoyu Yang Committed by GitHub
Browse files

[BugFix] [Vul] Add missing `usedforsecurity=False` in MD5 hashing to enable FIPS (#18319)


Signed-off-by: default avatarcascade812 <cascade812@outlook.com>
Signed-off-by: default avatarshaoyuyoung <shaoyuyoung@gmail.com>
Co-authored-by: default avatarcascade <cascade812@outlook.com>
parent 275c5dae
...@@ -143,8 +143,8 @@ class NeuronCausalLM(nn.Module): ...@@ -143,8 +143,8 @@ class NeuronCausalLM(nn.Module):
config = neuronx_model_cls.get_config_cls()( config = neuronx_model_cls.get_config_cls()(
neuron_config, neuron_config,
load_config=load_pretrained_config(model_name_or_path)) load_config=load_pretrained_config(model_name_or_path))
hashed_config = hashlib.md5( hashed_config = hashlib.md5(config.to_json_string().encode('utf-8'),
config.to_json_string().encode('utf-8')).hexdigest() usedforsecurity=False).hexdigest()
if os.getenv("NEURON_COMPILED_ARTIFACTS") is not None: if os.getenv("NEURON_COMPILED_ARTIFACTS") is not None:
compiled_model_path = os.getenv("NEURON_COMPILED_ARTIFACTS") compiled_model_path = os.getenv("NEURON_COMPILED_ARTIFACTS")
elif os.path.exists(model_name_or_path): elif os.path.exists(model_name_or_path):
...@@ -263,8 +263,8 @@ class NeuronMllamaForCausalLM(nn.Module): ...@@ -263,8 +263,8 @@ class NeuronMllamaForCausalLM(nn.Module):
config = neuronx_model_cls.get_config_cls()( config = neuronx_model_cls.get_config_cls()(
neuron_config, neuron_config,
load_config=load_pretrained_config(model_name_or_path)) load_config=load_pretrained_config(model_name_or_path))
hashed_config = hashlib.md5( hashed_config = hashlib.md5(config.to_json_string().encode('utf-8'),
config.to_json_string().encode('utf-8')).hexdigest() usedforsecurity=False).hexdigest()
if os.getenv("NEURON_COMPILED_ARTIFACTS") is not None: if os.getenv("NEURON_COMPILED_ARTIFACTS") is not None:
compiled_model_path = os.getenv("NEURON_COMPILED_ARTIFACTS") compiled_model_path = os.getenv("NEURON_COMPILED_ARTIFACTS")
elif os.path.exists(model_name_or_path): elif os.path.exists(model_name_or_path):
...@@ -426,8 +426,8 @@ class NeuronSpeculationCausalLM(nn.Module): ...@@ -426,8 +426,8 @@ class NeuronSpeculationCausalLM(nn.Module):
config.fused_spec_config = fused_spec_config config.fused_spec_config = fused_spec_config
self.config.neuron_config = neuron_config self.config.neuron_config = neuron_config
hashed_config = hashlib.md5( hashed_config = hashlib.md5(config.to_json_string().encode('utf-8'),
config.to_json_string().encode('utf-8')).hexdigest() usedforsecurity=False).hexdigest()
if os.getenv("NEURON_COMPILED_ARTIFACTS") is not None: if os.getenv("NEURON_COMPILED_ARTIFACTS") is not None:
compiled_model_path = os.getenv("NEURON_COMPILED_ARTIFACTS") compiled_model_path = os.getenv("NEURON_COMPILED_ARTIFACTS")
elif os.path.exists(model_name_or_path): elif os.path.exists(model_name_or_path):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment