cfn-nag 0.5.7 → 0.5.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ae234544b790a090d593ea456cb8a876a1442d22963ed34d01ab2fbab39eba7
4
- data.tar.gz: 272abf096df313f4e1a4ad78f607883662fff33a2b1eaa04cc67472521364c26
3
+ metadata.gz: 46ca3c01306210417a6b799110a493830eaa246303b43273967c45c33a53dd3c
4
+ data.tar.gz: d4673a00221c5af2df0d9455612970c8d6e26cabfccca2de4239e8e1bed784ea
5
5
  SHA512:
6
- metadata.gz: 521129144be6dca8c60c3ee85272414ebadda272e9ad91786b0d67a01cdf1fe2f77404e960752f51b4a2a688c427356fd7f8930e6ba4ca7a44253fafe3d7ad7c
7
- data.tar.gz: b302e4ad017764ab0ff94d37f73fd0e616aeee3a31b27dac931074f25840cf4e4983a5991f9aea631ce42960dd86678d15e0df6ebc114fbfe5e8be6f4f8bc227
6
+ metadata.gz: 75a097a2e7fc8dfa1df6a908eb0bcca07121aa7a84076f7c8a47229662ad11fedfe40e413a45c315ccc587f9bd1f0b4ce5eede6c00d294d6102611cb0688e72a
7
+ data.tar.gz: b455ffd05c9940b0a3c429fb3207e0964db01b759cb913778b1c96b6086deea0e50c8dc3c5829f869907269ed04e02109a5cdac0adc14378d5ae9c4d4e098f01
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cfn-nag/violation'
4
+ require 'cfn-nag/util/truthy'
5
+ require_relative 'base'
6
+
7
+ class CognitoIdentityPoolAllowUnauthenticatedIdentitiesRule < BaseRule
8
+ def rule_text
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.'
11
+ end
12
+
13
+ def rule_type
14
+ Violation::WARNING
15
+ end
16
+
17
+ def rule_id
18
+ 'W57'
19
+ end
20
+
21
+ def audit_impl(cfn_model)
22
+ violating_identity_pools = cfn_model.resources_by_type('AWS::Cognito::IdentityPool').select do |identity_pool|
23
+ violating_identity_pool?(identity_pool)
24
+ end
25
+
26
+ violating_identity_pools.map(&:logical_resource_id)
27
+ end
28
+
29
+ private
30
+
31
+ def violations?(property_value)
32
+ truthy?(property_value)
33
+ end
34
+
35
+ def violating_identity_pool?(identity_pool)
36
+ violations?(identity_pool.allowUnauthenticatedIdentities)
37
+ end
38
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cfn-nag/violation'
4
+ require 'cfn-nag/util/truthy'
5
+ require_relative 'base'
6
+
7
+ class CognitoUserPoolMfaConfigurationOnorOptionalRule < BaseRule
8
+ def rule_text
9
+ "AWS Cognito UserPool should have MfaConfiguration set to 'ON' (MUST be wrapped in quotes) or at least 'OPTIONAL'"
10
+ end
11
+
12
+ def rule_type
13
+ Violation::FAILING_VIOLATION
14
+ end
15
+
16
+ def rule_id
17
+ 'F78'
18
+ end
19
+
20
+ def audit_impl(cfn_model)
21
+ violating_userpools = cfn_model.resources_by_type('AWS::Cognito::UserPool').select do |userpool|
22
+ violating_userpool?(userpool)
23
+ end
24
+
25
+ violating_userpools.map(&:logical_resource_id)
26
+ end
27
+
28
+ private
29
+
30
+ def violating_userpool?(user_pool)
31
+ user_pool.mfaConfiguration.to_s.casecmp('off').zero?
32
+ end
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.5.7
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Kascic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-14 00:00:00.000000000 Z
11
+ date: 2020-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -188,6 +188,8 @@ files:
188
188
  - lib/cfn-nag/custom_rules/CloudFrontDistributionAccessLoggingRule.rb
189
189
  - lib/cfn-nag/custom_rules/CodeBuildEncryptionKeyRule.rb
190
190
  - lib/cfn-nag/custom_rules/CodePipelineWebhookAuthenticationConfigurationSecretTokenRule.rb
191
+ - lib/cfn-nag/custom_rules/CognitoIdentityPoolAllowUnauthenticatedIdentitiesRule.rb
192
+ - lib/cfn-nag/custom_rules/CognitoUserPoolMfaConfigurationOnorOptionalRule.rb
191
193
  - lib/cfn-nag/custom_rules/DMSEndpointMongoDbSettingsPasswordRule.rb
192
194
  - lib/cfn-nag/custom_rules/DMSEndpointPasswordRule.rb
193
195
  - lib/cfn-nag/custom_rules/DirectoryServiceMicrosoftADPasswordRule.rb