cfn-nag 0.7.2 → 0.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f180cde695c0a172b8ef42bdd38f58cc403adf10847a22f57af36dd0fb8ab743
4
- data.tar.gz: 48b315081d53ca804e8d6f2ba5d245dd117beb07a057c368ab7edeeadd5140ff
3
+ metadata.gz: ad2861d55fc444c4f16cba45a818e6d755124fe97f66ff2d3c9f138f2187b48b
4
+ data.tar.gz: c7af2ff8b96f46bb610303b546a1c8f62250c7e11af74f48bb1cabd7632e1d1d
5
5
  SHA512:
6
- metadata.gz: efc72eac3b1fbd17e420e19b7e1d61a55136083c00516490bdeee626cb39bf4e6a64cb75a1ac5b5ccc3321ba58774fe639855d919bcd439e0c88633d2728b12f
7
- data.tar.gz: bef1eeac336bc1c3a0c1c566a744f6eb7fdbe8dd9e15aeccd819caed044b7c37d66bbc4102e70522b79e71cd0fd1b6709bfa5362ff2c7e8c902ca2b79db49dcb
6
+ metadata.gz: f4e8d41c2622ca328127c8baef0f34bd921b98239eaca3653e871db500cfb9e35cf107ffe50151ae3972f0874f8227d6a17767b325f9e1e38a66335d69f935a0
7
+ data.tar.gz: b5be427253e61a463d0fefa7477e5f426176a37abd85ba955a18f42b61ffe12ef15bcf9c09f23197df0274ff4405c510f4ee4771b9ae55b01108128afe2eb9f3
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cfn-nag/violation'
4
+ require_relative 'base'
5
+
6
+ class ApiGatewayCacheEncryptedRule < BaseRule
7
+ def rule_text
8
+ 'ApiGateway Deployment should have cache data encryption enabled when caching is enabled' \
9
+ ' in StageDescription properties'
10
+ end
11
+
12
+ def rule_type
13
+ Violation::WARNING
14
+ end
15
+
16
+ def rule_id
17
+ 'W87'
18
+ end
19
+
20
+ def audit_impl(cfn_model)
21
+ violating_deployments = cfn_model.resources_by_type('AWS::ApiGateway::Deployment').select do |deployment|
22
+ violating_deployment?(deployment)
23
+ end
24
+
25
+ violating_deployments.map(&:logical_resource_id)
26
+ end
27
+
28
+ private
29
+
30
+ def violating_deployment?(deployment)
31
+ !deployment.stageDescription.nil? && truthy?(deployment.stageDescription['CachingEnabled']) \
32
+ && !truthy?(deployment.stageDescription['CacheDataEncrypted'])
33
+ end
34
+ end
@@ -28,11 +28,12 @@ class CloudfrontMinimumProtocolVersionRule < BaseRule
28
28
  private
29
29
 
30
30
  def tls_version?(viewer_certificate)
31
- cert_has_bad_tls_version?(viewer_certificate) || override_tls_config?(viewer_certificate)
31
+ cert_has_bad_tls_version?(viewer_certificate['MinimumProtocolVersion']) || override_tls_config?(viewer_certificate)
32
32
  end
33
33
 
34
- def cert_has_bad_tls_version?(viewer_certificate)
35
- viewer_certificate['MinimumProtocolVersion'].nil? || viewer_certificate['MinimumProtocolVersion'] != 'TLSv1.2_2018'
34
+ def cert_has_bad_tls_version?(min_protocol_version)
35
+ min_protocol_version.nil? ||
36
+ (min_protocol_version.is_a?(String) && !min_protocol_version.start_with?('TLSv1.2'))
36
37
  end
37
38
 
38
39
  def override_tls_config?(viewer_certificate)
@@ -6,7 +6,7 @@ require_relative 'base'
6
6
 
7
7
  class ECRRepositoryScanOnPushRule < BaseRule
8
8
  def rule_text
9
- 'ECR Repository should have scanOnPush enabled'
9
+ 'ECR Repository should have ScanOnPush enabled'
10
10
  end
11
11
 
12
12
  def rule_type
@@ -20,7 +20,7 @@ class ECRRepositoryScanOnPushRule < BaseRule
20
20
  def audit_impl(cfn_model)
21
21
  violating_ecr_registries = cfn_model.resources_by_type('AWS::ECR::Repository').select do |registry|
22
22
  registry.imageScanningConfiguration.nil? ||
23
- !truthy?(registry.imageScanningConfiguration['scanOnPush'].to_s)
23
+ !truthy?(registry.imageScanningConfiguration['ScanOnPush'].to_s)
24
24
  end
25
25
 
26
26
  violating_ecr_registries.map(&:logical_resource_id)
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cfn-nag/violation'
4
+ require_relative 'base'
5
+
6
+ class ElasticsearchDomainInsideVPCRule < BaseRule
7
+ def rule_text
8
+ 'ElasticsearchcDomain should be inside vpc, should specify VPCOptions'
9
+ end
10
+
11
+ def rule_type
12
+ Violation::WARNING
13
+ end
14
+
15
+ def rule_id
16
+ 'W90'
17
+ end
18
+
19
+ def audit_impl(cfn_model)
20
+ violating_domains = cfn_model.resources_by_type('AWS::Elasticsearch::Domain').select do |domain|
21
+ domain.vPCOptions.nil?
22
+ end
23
+
24
+ violating_domains.map(&:logical_resource_id)
25
+ end
26
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cfn-nag/violation'
4
+ require_relative 'base'
5
+
6
+ class LambdaFunctionInsideVPCRule < BaseRule
7
+ def rule_text
8
+ 'Lambda functions should be deployed inside a VPC'
9
+ end
10
+
11
+ def rule_type
12
+ Violation::WARNING
13
+ end
14
+
15
+ def rule_id
16
+ 'W89'
17
+ end
18
+
19
+ def audit_impl(cfn_model)
20
+ lambda_functions = cfn_model.resources_by_type('AWS::Lambda::Function')
21
+ violating_lambda_functions = lambda_functions.select do |lambda_function|
22
+ lambda_function.vpcConfig.nil?
23
+ end
24
+
25
+ violating_lambda_functions.map(&:logical_resource_id)
26
+ end
27
+ 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.2
4
+ version: 0.7.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Kascic
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-15 00:00:00.000000000 Z
11
+ date: 2021-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -165,7 +165,7 @@ dependencies:
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  description: Auditing tool for CloudFormation templates
168
- email:
168
+ email:
169
169
  executables:
170
170
  - cfn_nag
171
171
  - cfn_nag_rules
@@ -197,6 +197,7 @@ files:
197
197
  - lib/cfn-nag/custom_rules/AmplifyAppOauthTokenRule.rb
198
198
  - lib/cfn-nag/custom_rules/AmplifyBranchBasicAuthConfigPasswordRule.rb
199
199
  - lib/cfn-nag/custom_rules/ApiGatewayAccessLoggingRule.rb
200
+ - lib/cfn-nag/custom_rules/ApiGatewayCacheEncryptedRule.rb
200
201
  - lib/cfn-nag/custom_rules/ApiGatewayDeploymentUsagePlanRule.rb
201
202
  - lib/cfn-nag/custom_rules/ApiGatewayMethodAuthorizationTypeRule.rb
202
203
  - lib/cfn-nag/custom_rules/ApiGatewaySecurityPolicyRule.rb
@@ -246,6 +247,7 @@ files:
246
247
  - lib/cfn-nag/custom_rules/ElasticLoadBalancerV2ListenerProtocolRule.rb
247
248
  - lib/cfn-nag/custom_rules/ElasticLoadBalancerV2ListenerSslPolicyRule.rb
248
249
  - lib/cfn-nag/custom_rules/ElasticsearchDomainEncryptionAtRestOptionsRule.rb
250
+ - lib/cfn-nag/custom_rules/ElasticsearchDomainInsideVPCRule.rb
249
251
  - lib/cfn-nag/custom_rules/ElasticsearchDomainNodeToNodeEncryptionOptionsRule.rb
250
252
  - lib/cfn-nag/custom_rules/GameLiftFleetInboundPortRangeRule.rb
251
253
  - lib/cfn-nag/custom_rules/IAMUserLoginProfilePasswordRule.rb
@@ -280,6 +282,7 @@ files:
280
282
  - lib/cfn-nag/custom_rules/KinesisFirehoseDeliveryStreamSplunkDestinationConfigurationHECTokenRule.rb
281
283
  - lib/cfn-nag/custom_rules/KinesisStreamStreamEncryptionRule.rb
282
284
  - lib/cfn-nag/custom_rules/LambdaFunctionCloudWatchLogsRule.rb
285
+ - lib/cfn-nag/custom_rules/LambdaFunctionInsideVPCRule.rb
283
286
  - lib/cfn-nag/custom_rules/LambdaPermissionEventSourceTokenRule.rb
284
287
  - lib/cfn-nag/custom_rules/LambdaPermissionInvokeFunctionActionRule.rb
285
288
  - lib/cfn-nag/custom_rules/LambdaPermissionWildcardPrincipalRule.rb
@@ -389,7 +392,7 @@ homepage: https://github.com/stelligent/cfn_nag
389
392
  licenses:
390
393
  - MIT
391
394
  metadata: {}
392
- post_install_message:
395
+ post_install_message:
393
396
  rdoc_options: []
394
397
  require_paths:
395
398
  - lib
@@ -405,9 +408,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
405
408
  - !ruby/object:Gem::Version
406
409
  version: '0'
407
410
  requirements: []
408
- rubyforge_project:
409
- rubygems_version: 2.7.6
410
- signing_key:
411
+ rubygems_version: 3.1.2
412
+ signing_key:
411
413
  specification_version: 4
412
414
  summary: cfn-nag
413
415
  test_files: []