cfn-nag 0.7.15 → 0.7.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/bin/cfn_nag_rules +2 -2
  3. data/bin/spcm_scan +1 -1
  4. data/lib/cfn-nag/cfn_nag.rb +3 -3
  5. data/lib/cfn-nag/cfn_nag_executor.rb +2 -2
  6. data/lib/cfn-nag/cli_options.rb +3 -3
  7. data/lib/cfn-nag/custom_rules/AlexaASKSkillAuthenticationConfigurationClientSecretRule.rb +1 -1
  8. data/lib/cfn-nag/custom_rules/AlexaASKSkillAuthenticationConfigurationRefreshTokenRule.rb +1 -1
  9. data/lib/cfn-nag/custom_rules/AmazonMQBrokerUsersPasswordRule.rb +1 -1
  10. data/lib/cfn-nag/custom_rules/AmplifyAppAccessTokenRule.rb +2 -2
  11. data/lib/cfn-nag/custom_rules/AmplifyAppBasicAuthConfigPasswordRule.rb +2 -2
  12. data/lib/cfn-nag/custom_rules/AmplifyAppOauthTokenRule.rb +2 -2
  13. data/lib/cfn-nag/custom_rules/AmplifyBranchBasicAuthConfigPasswordRule.rb +2 -2
  14. data/lib/cfn-nag/custom_rules/ApiGatewayAccessLoggingRule.rb +1 -1
  15. data/lib/cfn-nag/custom_rules/ApiGatewayCacheEncryptedRule.rb +1 -1
  16. data/lib/cfn-nag/custom_rules/ApiGatewayMethodAuthorizationTypeRule.rb +1 -1
  17. data/lib/cfn-nag/custom_rules/AppStreamDirectoryConfigServiceAccountCredentialsAccountPasswordRule.rb +3 -3
  18. data/lib/cfn-nag/custom_rules/CodePipelineWebhookAuthenticationConfigurationSecretTokenRule.rb +2 -2
  19. data/lib/cfn-nag/custom_rules/CognitoIdentityPoolAllowUnauthenticatedIdentitiesRule.rb +1 -1
  20. data/lib/cfn-nag/custom_rules/DMSEndpointMongoDbSettingsPasswordRule.rb +2 -2
  21. data/lib/cfn-nag/custom_rules/DMSEndpointPasswordRule.rb +2 -2
  22. data/lib/cfn-nag/custom_rules/DirectoryServiceMicrosoftADPasswordRule.rb +2 -2
  23. data/lib/cfn-nag/custom_rules/DirectoryServiceSimpleADPasswordRule.rb +2 -2
  24. data/lib/cfn-nag/custom_rules/DocDBDBClusterMasterUserPasswordRule.rb +2 -2
  25. data/lib/cfn-nag/custom_rules/EC2NetworkAclEntryProtocolRule.rb +3 -7
  26. data/lib/cfn-nag/custom_rules/EKSClusterEncryptionRule.rb +1 -3
  27. data/lib/cfn-nag/custom_rules/EMRClusterKerberosAttributesADDomainJoinPasswordRule.rb +2 -2
  28. data/lib/cfn-nag/custom_rules/EMRClusterKerberosAttributesCrossRealmTrustPrincipalPasswordRule.rb +3 -3
  29. data/lib/cfn-nag/custom_rules/EMRClusterKerberosAttributesKdcAdminPasswordRule.rb +2 -2
  30. data/lib/cfn-nag/custom_rules/ElastiCacheReplicationGroupAuthTokenRule.rb +2 -2
  31. data/lib/cfn-nag/custom_rules/IAMUserLoginProfilePasswordRule.rb +2 -2
  32. data/lib/cfn-nag/custom_rules/IamUserLoginProfilePasswordResetRule.rb +4 -6
  33. data/lib/cfn-nag/custom_rules/KMSKeyWildcardPrincipalRule.rb +1 -1
  34. data/lib/cfn-nag/custom_rules/KinesisFirehoseDeliveryStreamRedshiftDestinationConfigurationPasswordRule.rb +3 -3
  35. data/lib/cfn-nag/custom_rules/KinesisFirehoseDeliveryStreamSplunkDestinationConfigurationHECTokenRule.rb +3 -3
  36. data/lib/cfn-nag/custom_rules/KinesisStreamStreamEncryptionRule.rb +3 -5
  37. data/lib/cfn-nag/custom_rules/LambdaPermissionEventSourceTokenRule.rb +2 -2
  38. data/lib/cfn-nag/custom_rules/LambdaPermissionInvokeFunctionActionRule.rb +1 -1
  39. data/lib/cfn-nag/custom_rules/ManagedBlockchainMemberMemberFabricConfigurationAdminPasswordRule.rb +4 -7
  40. data/lib/cfn-nag/custom_rules/OpsWorksAppAppSourcePasswordRule.rb +2 -2
  41. data/lib/cfn-nag/custom_rules/OpsWorksAppSslConfigurationPrivateKeyRule.rb +2 -2
  42. data/lib/cfn-nag/custom_rules/OpsWorksStackCustomCookbooksSourcePasswordRule.rb +2 -2
  43. data/lib/cfn-nag/custom_rules/OpsWorksStackRdsDbInstancesDbPasswordRule.rb +2 -2
  44. data/lib/cfn-nag/custom_rules/PinpointAPNSChannelPrivateKeyRule.rb +2 -2
  45. data/lib/cfn-nag/custom_rules/PinpointAPNSChannelTokenKeyRule.rb +2 -2
  46. data/lib/cfn-nag/custom_rules/PinpointAPNSSandboxChannelPrivateKeyRule.rb +2 -2
  47. data/lib/cfn-nag/custom_rules/PinpointAPNSSandboxChannelTokenKeyRule.rb +2 -2
  48. data/lib/cfn-nag/custom_rules/PinpointAPNSVoipChannelPrivateKeyRule.rb +2 -2
  49. data/lib/cfn-nag/custom_rules/PinpointAPNSVoipChannelTokenKeyRule.rb +2 -2
  50. data/lib/cfn-nag/custom_rules/PinpointAPNSVoipSandboxChannelPrivateKeyRule.rb +2 -2
  51. data/lib/cfn-nag/custom_rules/PinpointAPNSVoipSandboxChannelTokenKeyRule.rb +2 -2
  52. data/lib/cfn-nag/custom_rules/RDSDBClusterMasterUserPasswordRule.rb +2 -2
  53. data/lib/cfn-nag/custom_rules/RDSDBInstanceMasterUserPasswordRule.rb +2 -2
  54. data/lib/cfn-nag/custom_rules/RDSDBInstanceMasterUsernameRule.rb +2 -2
  55. data/lib/cfn-nag/custom_rules/RedshiftClusterMasterUserPasswordRule.rb +2 -2
  56. data/lib/cfn-nag/custom_rules/ResourceWithExplicitNameRule.rb +1 -1
  57. data/lib/cfn-nag/custom_rules/SecretsManagerSecretKmsKeyIdRule.rb +1 -1
  58. data/lib/cfn-nag/custom_rules/SecurityGroupIngressOpenToWorldRule.rb +1 -1
  59. data/lib/cfn-nag/custom_rules/SecurityGroupIngressPortRangeRule.rb +1 -1
  60. data/lib/cfn-nag/custom_rules/SecurityGroupMissingEgressRule.rb +1 -1
  61. data/lib/cfn-nag/custom_rules/SecurityGroupRuleDescriptionRule.rb +2 -2
  62. data/lib/cfn-nag/iam_complexity_metric/spcm.rb +3 -3
  63. data/lib/cfn-nag/util/enforce_reference_parameter.rb +1 -1
  64. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21844ee26ff22655e7c4ca236ff4f27511c6c538450c5a67ee5981aa739c40ae
4
- data.tar.gz: 151d8518421441674483e09ecdec0454da73e973c58b8d3826f95417d9423917
3
+ metadata.gz: a9a486bbd59b0cd5de04ba5ad9a133e6ce20697320a22655bdfc99bd41849638
4
+ data.tar.gz: 1fb8c617610cd079026a094a2fdf6aa3d63e2de4c65fd9ae3f608b3256909875
5
5
  SHA512:
6
- metadata.gz: b09918a74b3c26e097b63d171bd3af8fe2ff83d72b6782c03fe56b23f99a5f10e43bd6b111ea1a8ae4381bb4e376d71efcc4d8484d5ddb32266096294a869e95
7
- data.tar.gz: 1f5558eb98f3455d2fd2a195ef887d51a6899f7a62bcd7515b048b0e451d783d99bb4cca84a6e8a584f0e66cdde05ca4573115f8c3e723aa2d8e10d3ff00a2f7
6
+ metadata.gz: f86d2ee1986cec5903811516b44e549c6c544b4ada13149433bcc8ff1a0b945528dd6d33e32ee877154aaec3d483991d37501595fae6e20cd92aecfa1efd4371
7
+ data.tar.gz: a702b10e0326c3903eaada403e27290544d094c6d696e68de9b87e2c2b4457462b3c106da5e535952dc83df9bf49851e230091e9fb6ee50a1c09515f58e9e9e9
data/bin/cfn_nag_rules CHANGED
@@ -27,12 +27,12 @@ end
27
27
 
28
28
  profile_definition = nil
29
29
  unless opts[:profile_path].nil?
30
- profile_definition = IO.read(opts[:profile_path])
30
+ profile_definition = File.read(opts[:profile_path])
31
31
  end
32
32
 
33
33
  rule_repository_definitions = []
34
34
  opts[:rule_repository]&.each do |rule_repository|
35
- rule_repository_definitions << IO.read(rule_repository)
35
+ rule_repository_definitions << File.read(rule_repository)
36
36
  end
37
37
 
38
38
  rule_dumper = CfnNagRuleDumper.new(profile_definition: profile_definition,
data/bin/spcm_scan CHANGED
@@ -41,7 +41,7 @@ end
41
41
 
42
42
  def read_conditionally(path)
43
43
  unless path.nil?
44
- IO.read(path)
44
+ File.read(path)
45
45
  end
46
46
  end
47
47
 
@@ -55,8 +55,8 @@ class CfnNag
55
55
  parameter_values_path: nil,
56
56
  condition_values_path: nil,
57
57
  template_pattern: DEFAULT_TEMPLATE_PATTERN)
58
- parameter_values_string = parameter_values_path.nil? ? nil : IO.read(parameter_values_path)
59
- condition_values_string = condition_values_path.nil? ? nil : IO.read(condition_values_path)
58
+ parameter_values_string = parameter_values_path.nil? ? nil : File.read(parameter_values_path)
59
+ condition_values_string = condition_values_path.nil? ? nil : File.read(condition_values_path)
60
60
 
61
61
  templates = TemplateDiscovery.new.discover_templates(input_json_path: input_path,
62
62
  template_pattern: template_pattern)
@@ -64,7 +64,7 @@ class CfnNag
64
64
  templates.each do |template|
65
65
  aggregate_results << {
66
66
  filename: template,
67
- file_results: audit(cloudformation_string: IO.read(template),
67
+ file_results: audit(cloudformation_string: File.read(template),
68
68
  parameter_values_string: parameter_values_string,
69
69
  condition_values_string: condition_values_string)
70
70
  }
@@ -98,13 +98,13 @@ class CfnNagExecutor
98
98
  @rule_arguments_string = read_conditionally(opts[:rule_arguments_path])
99
99
 
100
100
  opts[:rule_repository]&.each do |rule_repository|
101
- @rule_repository_definitions << IO.read(rule_repository)
101
+ @rule_repository_definitions << File.read(rule_repository)
102
102
  end
103
103
  end
104
104
 
105
105
  def read_conditionally(path)
106
106
  unless path.nil?
107
- IO.read(path)
107
+ File.read(path)
108
108
  end
109
109
  end
110
110
 
@@ -5,8 +5,8 @@ require 'optimist'
5
5
  # rubocop:disable Metrics/ClassLength
6
6
  class Options
7
7
  @custom_rule_exceptions_message = 'Isolate custom rule exceptions - just ' \
8
- 'emit the exception without stack trace ' \
9
- 'and keep chugging'
8
+ 'emit the exception without stack trace ' \
9
+ 'and keep chugging'
10
10
 
11
11
  @version = Gem::Specification.find_by_name('cfn-nag').version
12
12
 
@@ -25,7 +25,7 @@ class Options
25
25
  # rubocop:disable Metrics/MethodLength
26
26
  def self.file_options
27
27
  options_message = '[options] <cloudformation template path ...>|' \
28
- '<cloudformation template in STDIN>'
28
+ '<cloudformation template in STDIN>'
29
29
  custom_rule_exceptions_message = @custom_rule_exceptions_message
30
30
  version = @version
31
31
 
@@ -8,7 +8,7 @@ require_relative 'base'
8
8
  class AlexaASKSkillAuthenticationConfigurationClientSecretRule < BaseRule
9
9
  def rule_text
10
10
  'Alexa ASK Skill AuthenticationConfiguration ClientSecret must not be ' \
11
- 'a plaintext string or a Ref to a NoEcho Parameter with a Default value.'
11
+ 'a plaintext string or a Ref to a NoEcho Parameter with a Default value.'
12
12
  end
13
13
 
14
14
  def rule_type
@@ -8,7 +8,7 @@ require_relative 'base'
8
8
  class AlexaASKSkillAuthenticationConfigurationRefreshTokenRule < BaseRule
9
9
  def rule_text
10
10
  'Alexa ASK Skill AuthenticationConfiguration RefreshToken must not be ' \
11
- 'a plaintext string or a Ref to a NoEcho Parameter with a Default value.'
11
+ 'a plaintext string or a Ref to a NoEcho Parameter with a Default value.'
12
12
  end
13
13
 
14
14
  def rule_type
@@ -6,7 +6,7 @@ require_relative 'sub_property_with_list_password_base_rule'
6
6
  class AmazonMQBrokerUsersPasswordRule < SubPropertyWithListPasswordBaseRule
7
7
  def rule_text
8
8
  'AmazonMQ Broker Users Password must not be a plaintext string or a Ref to a Parameter with a Default value. ' \
9
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
10
10
  end
11
11
 
12
12
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class AmplifyAppAccessTokenRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'Amplify App AccessToken must not be a plaintext string ' \
9
- 'or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class AmplifyAppBasicAuthConfigPasswordRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'Amplify App BasicAuthConfig Password must not be a plaintext string ' \
9
- 'or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class AmplifyAppOauthTokenRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'Amplify App OauthToken must not be a plaintext string ' \
9
- 'or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class AmplifyBranchBasicAuthConfigPasswordRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'Amplify Branch BasicAuthConfig Password must not be a plaintext ' \
9
- 'string or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'string or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,7 +6,7 @@ require_relative 'base'
6
6
  class ApiGatewayAccessLoggingRule < BaseRule
7
7
  def rule_text
8
8
  'ApiGateway Deployment resource should have AccessLogSetting property configured when creating an ' \
9
- 'API Stage itself (through specifying the StageName and StageDescription properties).'
9
+ 'API Stage itself (through specifying the StageName and StageDescription properties).'
10
10
  end
11
11
 
12
12
  def rule_type
@@ -6,7 +6,7 @@ require_relative 'base'
6
6
  class ApiGatewayCacheEncryptedRule < BaseRule
7
7
  def rule_text
8
8
  'ApiGateway Deployment should have cache data encryption enabled when caching is enabled' \
9
- ' in StageDescription properties'
9
+ ' in StageDescription properties'
10
10
  end
11
11
 
12
12
  def rule_type
@@ -6,7 +6,7 @@ require_relative 'base'
6
6
  class ApiGatewayMethodAuthorizationTypeRule < BaseRule
7
7
  def rule_text
8
8
  "AWS::ApiGateway::Method should not have AuthorizationType set to 'NONE' unless it is of " \
9
- 'HttpMethod: OPTIONS.'
9
+ 'HttpMethod: OPTIONS.'
10
10
  end
11
11
 
12
12
  def rule_type
@@ -6,9 +6,9 @@ require_relative 'password_base_rule'
6
6
  class AppStreamDirectoryConfigServiceAccountCredentialsAccountPasswordRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'AppStream DirectoryConfig ServiceAccountCredentials AccountPassword ' \
9
- 'must not be a plaintext string or a Ref to a Parameter ' \
10
- 'with a Default value. ' \
11
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'must not be a plaintext string or a Ref to a Parameter ' \
10
+ 'with a Default value. ' \
11
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
12
12
  end
13
13
 
14
14
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class CodePipelineWebhookAuthenticationConfigurationSecretTokenRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'CodePipeline Webhook AuthenticationConfiguration SecretToken must not be ' \
9
- 'a plaintext string or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'a plaintext string or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -7,7 +7,7 @@ require_relative 'base'
7
7
  class CognitoIdentityPoolAllowUnauthenticatedIdentitiesRule < BaseRule
8
8
  def rule_text
9
9
  'AWS::Cognito::IdentityPool AllowUnauthenticatedIdentities property should be false ' \
10
- 'but CAN be true if proper restrictive IAM roles and permissions are established for unauthenticated users.'
10
+ 'but CAN be true if proper restrictive IAM roles and permissions are established for unauthenticated users.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class DMSEndpointMongoDbSettingsPasswordRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'DMS Endpoint MongoDbSettings Password must not be a plaintext string ' \
9
- 'or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class DMSEndpointPasswordRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'DMS Endpoint password must not be a plaintext string ' \
9
- 'or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -7,8 +7,8 @@ require_relative 'password_base_rule'
7
7
  class DirectoryServiceMicrosoftADPasswordRule < PasswordBaseRule
8
8
  def rule_text
9
9
  'Directory Service Microsoft AD password must not be a plaintext string ' \
10
- 'or a Ref to a Parameter with a Default value. ' \
11
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager/ssm-secure value.'
10
+ 'or a Ref to a Parameter with a Default value. ' \
11
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager/ssm-secure value.'
12
12
  end
13
13
 
14
14
  def rule_type
@@ -7,8 +7,8 @@ require_relative 'password_base_rule'
7
7
  class DirectoryServiceSimpleADPasswordRule < PasswordBaseRule
8
8
  def rule_text
9
9
  'DirectoryService SimpleAD password must not be a plaintext string ' \
10
- 'or a Ref to a Parameter with a Default value. ' \
11
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager/ssm-secure value.'
10
+ 'or a Ref to a Parameter with a Default value. ' \
11
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager/ssm-secure value.'
12
12
  end
13
13
 
14
14
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class DocDBDBClusterMasterUserPasswordRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'DocDB DB Cluster master user password must not be a plaintext string ' \
9
- 'or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,7 +6,7 @@ require_relative 'base'
6
6
  class EC2NetworkAclEntryProtocolRule < BaseRule
7
7
  def rule_text
8
8
  'To avoid opening all ports for Allow rules, EC2 NetworkACL Entry Protocol should be either 6 (for TCP), 17 ' \
9
- '(for UDP), 1 (for ICMP), or 58 (for ICMPv6, which must include an IPv6 CIDR block, ICMP type, and code).'
9
+ '(for UDP), 1 (for ICMP), or 58 (for ICMPv6, which must include an IPv6 CIDR block, ICMP type, and code).'
10
10
  end
11
11
 
12
12
  def rule_type
@@ -53,12 +53,8 @@ class EC2NetworkAclEntryProtocolRule < BaseRule
53
53
 
54
54
  def violating_network_acl_entries?(network_acl_entry)
55
55
  if rule_action_allow?(network_acl_entry)
56
- if tcp_udp_icmp_protocol?(network_acl_entry) ||
57
- icmpv6_protocol?(network_acl_entry)
58
- false
59
- else
60
- true
61
- end
56
+ !(tcp_udp_icmp_protocol?(network_acl_entry) ||
57
+ icmpv6_protocol?(network_acl_entry))
62
58
  end
63
59
  end
64
60
  end
@@ -18,9 +18,7 @@ class EKSClusterEncryptionRule < BaseRule
18
18
 
19
19
  def audit_impl(cfn_model)
20
20
  violating_clusters = cfn_model.resources_by_type('AWS::EKS::Cluster').select do |cluster|
21
- if cluster.encryptionConfig.nil?
22
- true
23
- elsif violating_configs?(cluster)
21
+ if cluster.encryptionConfig.nil? || violating_configs?(cluster)
24
22
  true
25
23
  else
26
24
  violating_providers?(cluster)
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class EMRClusterKerberosAttributesADDomainJoinPasswordRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'EMR Cluster KerberosAttributes AD Domain JoinPassword must not be a ' \
9
- 'plaintext string or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'plaintext string or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,9 +6,9 @@ require_relative 'password_base_rule'
6
6
  class EMRClusterKerberosAttributesCrossRealmTrustPrincipalPasswordRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'EMR Cluster KerberosAttributes CrossRealmTrustPrincipal Password must ' \
9
- 'not be a plaintext string or a Ref to a Parameter with a ' \
10
- 'Default value. ' \
11
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'not be a plaintext string or a Ref to a Parameter with a ' \
10
+ 'Default value. ' \
11
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
12
12
  end
13
13
 
14
14
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class EMRClusterKerberosAttributesKdcAdminPasswordRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'EMR Cluster KerberosAttributes KdcAdmin Password must not be a ' \
9
- 'plaintext string or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'plaintext string or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class ElastiCacheReplicationGroupAuthTokenRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'ElastiCache ReplicationGroup AuthToken must not be a plaintext string ' \
9
- 'or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager/ssm-secure value.'
9
+ 'or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager/ssm-secure value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class IAMUserLoginProfilePasswordRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'IAM User LoginProfile Password must not be a plaintext string or ' \
9
- 'a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -29,9 +29,7 @@ class IamUserLoginProfilePasswordResetRule < BaseRule
29
29
 
30
30
  def iam_user_password_reset_required_key?(login_profile)
31
31
  if login_profile.key? 'PasswordResetRequired'
32
- if login_profile['PasswordResetRequired'].nil?
33
- true
34
- elsif not_truthy?(login_profile['PasswordResetRequired'])
32
+ if login_profile['PasswordResetRequired'].nil? || not_truthy?(login_profile['PasswordResetRequired'])
35
33
  true
36
34
  end
37
35
  else
@@ -40,10 +38,10 @@ class IamUserLoginProfilePasswordResetRule < BaseRule
40
38
  end
41
39
 
42
40
  def violating_iam_users?(iam_user)
43
- if !iam_user.loginProfile.nil?
44
- iam_user_password_reset_required_key?(iam_user.loginProfile)
45
- else
41
+ if iam_user.loginProfile.nil?
46
42
  false
43
+ else
44
+ iam_user_password_reset_required_key?(iam_user.loginProfile)
47
45
  end
48
46
  end
49
47
  end
@@ -6,7 +6,7 @@ require_relative 'base'
6
6
  class KMSKeyWildcardPrincipalRule < BaseRule
7
7
  def rule_text
8
8
  'KMS key should not allow * principal ' \
9
- '(https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html)'
9
+ '(https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html)'
10
10
  end
11
11
 
12
12
  def rule_type
@@ -6,9 +6,9 @@ require_relative 'password_base_rule'
6
6
  class KinesisFirehoseDeliveryStreamRedshiftDestinationConfigurationPasswordRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'Kinesis Firehose DeliveryStream RedshiftDestinationConfiguration Password ' \
9
- 'must not be a plaintext string or a Ref to a Parameter with a ' \
10
- 'Default value. ' \
11
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager/ssm-secure value.'
9
+ 'must not be a plaintext string or a Ref to a Parameter with a ' \
10
+ 'Default value. ' \
11
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager/ssm-secure value.'
12
12
  end
13
13
 
14
14
  def rule_type
@@ -6,9 +6,9 @@ require_relative 'password_base_rule'
6
6
  class KinesisFirehoseDeliveryStreamSplunkDestinationConfigurationHECTokenRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'Kinesis Firehose DeliveryStream SplunkDestinationConfiguration HECToken ' \
9
- 'must not be a plaintext string or a Ref to a Parameter with a ' \
10
- 'Default value. ' \
11
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'must not be a plaintext string or a Ref to a Parameter with a ' \
10
+ 'Default value. ' \
11
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
12
12
  end
13
13
 
14
14
  def rule_type
@@ -27,11 +27,9 @@ class KinesisStreamStreamEncryptionRule < BaseRule
27
27
  private
28
28
 
29
29
  def violating_kinesis_streams?(kinesis_stream)
30
- if kinesis_stream.streamEncryption.nil?
31
- true
32
- elsif kinesis_stream.streamEncryption['EncryptionType'].nil?
33
- true
34
- elsif kinesis_stream.streamEncryption['KeyId'].nil?
30
+ if kinesis_stream.streamEncryption.nil? ||
31
+ kinesis_stream.streamEncryption['EncryptionType'].nil? ||
32
+ kinesis_stream.streamEncryption['KeyId'].nil?
35
33
  true
36
34
  else
37
35
  kinesis_stream.streamEncryption['EncryptionType'] == 'NONE'
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class LambdaPermissionEventSourceTokenRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'Lambda Permission EventSourceToken must not be a plaintext string ' \
9
- 'or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,7 +6,7 @@ require_relative 'base'
6
6
  class LambdaPermissionInvokeFunctionActionRule < BaseRule
7
7
  def rule_text
8
8
  'Lambda permission beside InvokeFunction might not be what you want? ' \
9
- 'Not sure!?'
9
+ 'Not sure!?'
10
10
  end
11
11
 
12
12
  def rule_type
@@ -8,7 +8,7 @@ require_relative 'base'
8
8
  class ManagedBlockchainMemberMemberFabricConfigurationAdminPasswordRule < BaseRule
9
9
  def rule_text
10
10
  'ManagedBlockchain Member MemberFabricConfiguration AdminPasswordRule must ' \
11
- 'not be a plaintext string or a Ref to a NoEcho Parameter with a Default value.'
11
+ 'not be a plaintext string or a Ref to a NoEcho Parameter with a Default value.'
12
12
  end
13
13
 
14
14
  def rule_type
@@ -42,14 +42,11 @@ class ManagedBlockchainMemberMemberFabricConfigurationAdminPasswordRule < BaseRu
42
42
  # 'MemberFabricConfiguration'
43
43
  # 'AdminPassword'
44
44
  def password_property_does_not_exist(member)
45
- if member.memberConfiguration['MemberFrameworkConfiguration'].nil?
46
- true
47
- elsif member.memberConfiguration['MemberFrameworkConfiguration']['MemberFabricConfiguration'].nil?
48
- true
49
- elsif member.memberConfiguration['MemberFrameworkConfiguration']['MemberFabricConfiguration']['AdminPassword'].nil?
45
+ if member.memberConfiguration['MemberFrameworkConfiguration'].nil? ||
46
+ member.memberConfiguration['MemberFrameworkConfiguration']['MemberFabricConfiguration'].nil?
50
47
  true
51
48
  else
52
- false
49
+ member.memberConfiguration['MemberFrameworkConfiguration']['MemberFabricConfiguration']['AdminPassword'].nil?
53
50
  end
54
51
  end
55
52
  end
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class OpsWorksAppAppSourcePasswordRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'OpsWorks App AppSource Password must not be a plaintext ' \
9
- 'string or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager/ssm-secure value.'
9
+ 'string or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager/ssm-secure value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class OpsWorksAppSslConfigurationPrivateKeyRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'OpsWorks App SslConfiguration PrivateKey must not be a plaintext ' \
9
- 'string or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'string or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class OpsWorksStackCustomCookbooksSourcePasswordRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'OpsWorks Stack CustomCookbooksSource Password must not be a plaintext ' \
9
- 'string or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager/ssm-secure value.'
9
+ 'string or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager/ssm-secure value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'sub_property_with_list_password_base_rule'
6
6
  class OpsWorksStackRdsDbInstancesDbPasswordRule < SubPropertyWithListPasswordBaseRule
7
7
  def rule_text
8
8
  'OpsWorks Stack RDS DbInstance DbPassword must not be a plaintext string '\
9
- 'or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager/ssm-secure value.'
9
+ 'or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager/ssm-secure value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class PinpointAPNSChannelPrivateKeyRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'Pinpoint APNSChannel PrivateKey must not be a plaintext string ' \
9
- 'or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class PinpointAPNSChannelTokenKeyRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'Pinpoint APNSChannel TokenKey must not be a plaintext string ' \
9
- 'or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class PinpointAPNSSandboxChannelPrivateKeyRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'Pinpoint APNSSandboxChannel PrivateKey must not be a plaintext string ' \
9
- 'or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class PinpointAPNSSandboxChannelTokenKeyRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'Pinpoint APNSSandboxChannel TokenKey must not be a plaintext string ' \
9
- 'or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class PinpointAPNSVoipChannelPrivateKeyRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'Pinpoint APNSVoipChannel PrivateKey must not be a plaintext string ' \
9
- 'or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class PinpointAPNSVoipChannelTokenKeyRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'Pinpoint APNSChannel TokenKey must not be a plaintext string ' \
9
- 'or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class PinpointAPNSVoipSandboxChannelPrivateKeyRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'Pinpoint APNSVoipSandboxChannel PrivateKey must not be a plaintext ' \
9
- 'string or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'string or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class PinpointAPNSVoipSandboxChannelTokenKeyRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'Pinpoint APNSVoipSandboxChannel TokenKey must not be a plaintext string ' \
9
- 'or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
9
+ 'or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class RDSDBClusterMasterUserPasswordRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'RDS DB Cluster master user password must not be a plaintext string ' \
9
- 'or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager/ssm-secure value.'
9
+ 'or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager/ssm-secure value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class RDSDBInstanceMasterUserPasswordRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'RDS instance master user password must not be a plaintext string ' \
9
- 'or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager/ssm-secure value.'
9
+ 'or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager/ssm-secure value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -7,8 +7,8 @@ require_relative 'password_base_rule'
7
7
  class RDSDBInstanceMasterUsernameRule < PasswordBaseRule
8
8
  def rule_text
9
9
  'RDS instance master username must not be a plaintext string ' \
10
- 'or a Ref to a Parameter with a Default value. ' \
11
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
10
+ 'or a Ref to a Parameter with a Default value. ' \
11
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager value.'
12
12
  end
13
13
 
14
14
  def rule_type
@@ -6,8 +6,8 @@ require_relative 'password_base_rule'
6
6
  class RedshiftClusterMasterUserPasswordRule < PasswordBaseRule
7
7
  def rule_text
8
8
  'Redshift Cluster master user password must not be a plaintext string ' \
9
- 'or a Ref to a Parameter with a Default value. ' \
10
- 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager/ssm-secure value.'
9
+ 'or a Ref to a Parameter with a Default value. ' \
10
+ 'Can be Ref to a NoEcho Parameter without a Default, or a dynamic reference to a secretsmanager/ssm-secure value.'
11
11
  end
12
12
 
13
13
  def rule_type
@@ -26,7 +26,7 @@ class ResourceWithExplicitNameRule < BaseRule
26
26
 
27
27
  def rule_text
28
28
  'Resource found with an explicit name, this disallows updates that ' \
29
- 'require replacement of this resource'
29
+ 'require replacement of this resource'
30
30
  end
31
31
 
32
32
  def rule_type
@@ -6,7 +6,7 @@ require_relative 'boolean_base_rule'
6
6
  class SecretsManagerSecretKmsKeyIdRule < BooleanBaseRule
7
7
  def rule_text
8
8
  'Secrets Manager Secret should explicitly specify KmsKeyId.' \
9
- ' Besides control of the key this will allow the secret to be shared cross-account'
9
+ ' Besides control of the key this will allow the secret to be shared cross-account'
10
10
  end
11
11
 
12
12
  def rule_type
@@ -9,7 +9,7 @@ class SecurityGroupIngressOpenToWorldRule < BaseRule
9
9
 
10
10
  def rule_text
11
11
  'Security Groups found with cidr open to world on ingress. This should ' \
12
- 'never be true on instance. Permissible on ELB'
12
+ 'never be true on instance. Permissible on ELB'
13
13
  end
14
14
 
15
15
  def rule_type
@@ -6,7 +6,7 @@ require_relative 'base'
6
6
  class SecurityGroupIngressPortRangeRule < BaseRule
7
7
  def rule_text
8
8
  'Security Groups found ingress with port range instead of just a single ' \
9
- 'port'
9
+ 'port'
10
10
  end
11
11
 
12
12
  def rule_type
@@ -6,7 +6,7 @@ require_relative 'base'
6
6
  class SecurityGroupMissingEgressRule < BaseRule
7
7
  def rule_text
8
8
  'Missing egress rule means all traffic is allowed outbound. Make this ' \
9
- 'explicit if it is desired configuration'
9
+ 'explicit if it is desired configuration'
10
10
  end
11
11
 
12
12
  def rule_type
@@ -8,8 +8,8 @@ require 'cfn-nag/util/blank'
8
8
  class SecurityGroupRuleDescriptionRule < BaseRule
9
9
  def rule_text
10
10
  'Security group rules without a description obscure their purpose and may '\
11
- 'lead to bad practices in ensuring they only allow traffic from the ports '\
12
- 'and sources/destinations required.'
11
+ 'lead to bad practices in ensuring they only allow traffic from the ports '\
12
+ 'and sources/destinations required.'
13
13
  end
14
14
 
15
15
  def rule_type
@@ -11,8 +11,8 @@ class SPCM
11
11
  parameter_values_path: nil,
12
12
  condition_values_path: nil,
13
13
  template_pattern: DEFAULT_TEMPLATE_PATTERN)
14
- parameter_values_string = parameter_values_path.nil? ? nil : IO.read(parameter_values_path)
15
- condition_values_string = condition_values_path.nil? ? nil : IO.read(condition_values_path)
14
+ parameter_values_string = parameter_values_path.nil? ? nil : File.read(parameter_values_path)
15
+ condition_values_string = condition_values_path.nil? ? nil : File.read(condition_values_path)
16
16
 
17
17
  templates = TemplateDiscovery.new.discover_templates(input_json_path: input_path,
18
18
  template_pattern: template_pattern)
@@ -21,7 +21,7 @@ class SPCM
21
21
  aggregate_results << {
22
22
  filename: template,
23
23
  file_results: metric(
24
- cloudformation_string: IO.read(template),
24
+ cloudformation_string: File.read(template),
25
25
  parameter_values_string: parameter_values_string,
26
26
  condition_values_string: condition_values_string
27
27
  )
@@ -29,5 +29,5 @@ end
29
29
  # is not present; otherwise returns true
30
30
  def no_echo_and_no_default_parameter_check(cfn_model, key_to_check)
31
31
  parameter = cfn_model.parameters[key_to_check['Ref']]
32
- truthy?(parameter.noEcho) && parameter.default.nil? ? false : true
32
+ !(truthy?(parameter.noEcho) && parameter.default.nil?)
33
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfn-nag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.15
4
+ version: 0.7.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Kascic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-23 00:00:00.000000000 Z
11
+ date: 2021-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake