"vscode:/vscode.git/clone" did not exist on "43e77e59abcaf0764aa6851fcc2bc9b86d4afdba"
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):
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):
......
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