@@ -83,13 +83,13 @@ def test_retrieve_revert_ldap_valid(tmp_config_files):
8383 unsecured_key = ldap .get_nested_key (['password' ])
8484 ldap .store ()
8585 with open (ldap_config_file ) as f :
86- data = yaml .load (f )
86+ data = yaml .safe_load (f )
8787 assert ldap .parse_secure_key (data ['password' ])
8888 retrieved_key_dict = ldap .retrieve ()
8989 assert retrieved_key_dict ['password' ] == unsecured_key
9090 ldap .revert ()
9191 with open (ldap_config_file ) as f :
92- data = yaml .load (f )
92+ data = yaml .safe_load (f )
9393 assert data ['password' ] == unsecured_key
9494
9595
@@ -112,13 +112,13 @@ def test_retrieve_revert_umapi_valid(private_key, modify_umapi_config):
112112 unsecured_api_key = umapi .get_nested_key (['enterprise' , 'client_id' ])
113113 umapi .store ()
114114 with open (umapi_config_file , 'r' ) as f :
115- data = yaml .load (f )
115+ data = yaml .safe_load (f )
116116 assert umapi .parse_secure_key (data ['enterprise' ]['client_id' ])
117117 retrieved_key_dict = umapi .retrieve ()
118118 assert retrieved_key_dict ['enterprise:client_id' ] == unsecured_api_key
119119 umapi .revert ()
120120 with open (umapi_config_file ) as f :
121- data = yaml .load (f )
121+ data = yaml .safe_load (f )
122122 assert data ['enterprise' ]['client_id' ] == unsecured_api_key
123123
124124
@@ -127,28 +127,28 @@ def test_credman_retrieve_revert_valid(tmp_config_files, private_key, modify_uma
127127 umapi_config_file = modify_umapi_config (['enterprise' , 'priv_key_path' ], private_key )
128128 credman = CredentialManager (root_config_file , auto = True )
129129 with open (ldap_config_file ) as f :
130- data = yaml .load (f )
130+ data = yaml .safe_load (f )
131131 plaintext_ldap_password = data ['password' ]
132132 with open (umapi_config_file ) as f :
133- data = yaml .load (f )
133+ data = yaml .safe_load (f )
134134 plaintext_umapi_api_key = data ['enterprise' ]['client_id' ]
135135 credman .store ()
136136 retrieved_creds = credman .retrieve ()
137137 assert retrieved_creds [ldap_config_file ]['password' ] == plaintext_ldap_password
138138 assert retrieved_creds [umapi_config_file ]['enterprise:client_id' ] == plaintext_umapi_api_key
139139 # make sure the config files are still in secure format
140140 with open (ldap_config_file ) as f :
141- data = yaml .load (f )
141+ data = yaml .safe_load (f )
142142 assert data ['password' ] != plaintext_ldap_password
143143 with open (umapi_config_file ) as f :
144- data = yaml .load (f )
144+ data = yaml .safe_load (f )
145145 assert data ['enterprise' ]['client_id' ] != plaintext_umapi_api_key
146146 credman .revert ()
147147 with open (ldap_config_file ) as f :
148- data = yaml .load (f )
148+ data = yaml .safe_load (f )
149149 assert data ['password' ] == plaintext_ldap_password
150150 with open (umapi_config_file ) as f :
151- data = yaml .load (f )
151+ data = yaml .safe_load (f )
152152 assert data ['enterprise' ]['client_id' ] == plaintext_umapi_api_key
153153
154154
@@ -208,7 +208,7 @@ def test_config_store(tmp_config_files):
208208 assert not ldap .parse_secure_key (ldap .get_nested_key (key .key_path ))
209209 ldap .store ()
210210 with open (ldap_config_file ) as f :
211- data = yaml .load (f )
211+ data = yaml .safe_load (f )
212212 assert ldap .parse_secure_key (data ['password' ])
213213
214214
@@ -254,13 +254,13 @@ def test_credman_encrypt_decrypt_key_data(tmp_config_files, private_key, modify_
254254 umapi_config_file = modify_umapi_config (['enterprise' , 'priv_key_data' ], key_data )
255255 credman = CredentialManager (root_config_file , auto = True )
256256 with open (umapi_config_file ) as f :
257- umapi_dict = yaml .load (f )
257+ umapi_dict = yaml .safe_load (f )
258258 assert encryption .is_encryptable (umapi_dict ['enterprise' ]['priv_key_data' ])
259259 credman .store ()
260260 with open (umapi_config_file ) as f :
261- umapi_dict = yaml .load (f )
261+ umapi_dict = yaml .safe_load (f )
262262 assert not encryption .is_encryptable (umapi_dict ['enterprise' ]['priv_key_data' ])
263263 credman .revert ()
264264 with open (umapi_config_file ) as f :
265- umapi_dict = yaml .load (f )
265+ umapi_dict = yaml .safe_load (f )
266266 assert encryption .is_encryptable (umapi_dict ['enterprise' ]['priv_key_data' ])
0 commit comments