@@ -287,3 +287,77 @@ def test_one_autoscaling_file_with_secrets_gzip(self):
287
287
assert result [0 ].resource_id == launch_configuration_name
288
288
assert result [0 ].resource_arn == launch_configuration_arn
289
289
assert result [0 ].region == AWS_REGION_US_EAST_1
290
+
291
+ @mock_aws
292
+ def test_one_autoscaling_file_with_unicode_error (self ):
293
+ # Include launch_configurations to check
294
+ invalid_utf8_bytes = b"\xc0 \xaf "
295
+ launch_configuration_name = "tester"
296
+ autoscaling_client = client ("autoscaling" , region_name = AWS_REGION_US_EAST_1 )
297
+ autoscaling_client .create_launch_configuration (
298
+ LaunchConfigurationName = launch_configuration_name ,
299
+ ImageId = "ami-12c6146b" ,
300
+ InstanceType = "t1.micro" ,
301
+ KeyName = "the_keys" ,
302
+ SecurityGroups = ["default" , "default2" ],
303
+ UserData = invalid_utf8_bytes ,
304
+ )
305
+
306
+ from prowler .providers .aws .services .autoscaling .autoscaling_service import (
307
+ AutoScaling ,
308
+ )
309
+
310
+ current_audit_info = set_mocked_aws_audit_info ([AWS_REGION_US_EAST_1 ])
311
+
312
+ with mock .patch (
313
+ "prowler.providers.aws.lib.audit_info.audit_info.current_audit_info" ,
314
+ new = current_audit_info ,
315
+ ), mock .patch (
316
+ "prowler.providers.aws.services.autoscaling.autoscaling_find_secrets_ec2_launch_configuration.autoscaling_find_secrets_ec2_launch_configuration.autoscaling_client" ,
317
+ new = AutoScaling (current_audit_info ),
318
+ ):
319
+ from prowler .providers .aws .services .autoscaling .autoscaling_find_secrets_ec2_launch_configuration .autoscaling_find_secrets_ec2_launch_configuration import (
320
+ autoscaling_find_secrets_ec2_launch_configuration ,
321
+ )
322
+
323
+ check = autoscaling_find_secrets_ec2_launch_configuration ()
324
+ result = check .execute ()
325
+
326
+ assert len (result ) == 0
327
+
328
+ @mock_aws
329
+ def test_one_autoscaling_file_invalid_gzip_error (self ):
330
+ # Include launch_configurations to check
331
+ invalid_gzip_bytes = b"\x1f \x8b \xc0 \xaf "
332
+ launch_configuration_name = "tester"
333
+ autoscaling_client = client ("autoscaling" , region_name = AWS_REGION_US_EAST_1 )
334
+ autoscaling_client .create_launch_configuration (
335
+ LaunchConfigurationName = launch_configuration_name ,
336
+ ImageId = "ami-12c6146b" ,
337
+ InstanceType = "t1.micro" ,
338
+ KeyName = "the_keys" ,
339
+ SecurityGroups = ["default" , "default2" ],
340
+ UserData = invalid_gzip_bytes ,
341
+ )
342
+
343
+ from prowler .providers .aws .services .autoscaling .autoscaling_service import (
344
+ AutoScaling ,
345
+ )
346
+
347
+ current_audit_info = set_mocked_aws_audit_info ([AWS_REGION_US_EAST_1 ])
348
+
349
+ with mock .patch (
350
+ "prowler.providers.aws.lib.audit_info.audit_info.current_audit_info" ,
351
+ new = current_audit_info ,
352
+ ), mock .patch (
353
+ "prowler.providers.aws.services.autoscaling.autoscaling_find_secrets_ec2_launch_configuration.autoscaling_find_secrets_ec2_launch_configuration.autoscaling_client" ,
354
+ new = AutoScaling (current_audit_info ),
355
+ ):
356
+ from prowler .providers .aws .services .autoscaling .autoscaling_find_secrets_ec2_launch_configuration .autoscaling_find_secrets_ec2_launch_configuration import (
357
+ autoscaling_find_secrets_ec2_launch_configuration ,
358
+ )
359
+
360
+ check = autoscaling_find_secrets_ec2_launch_configuration ()
361
+ result = check .execute ()
362
+
363
+ assert len (result ) == 0
0 commit comments