Class: Outliers::Resources::Aws::S3::Bucket
Instance Attribute Summary
#source
Instance Method Summary
collapse
#id, #initialize, key, #method_missing, verifications
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Outliers::Resource
Instance Method Details
38
39
40
|
# File 'lib/outliers/resources/aws/s3/bucket.rb', line 38
def configured_as_website?
!website_configuration.nil?
end
|
#empty? ⇒ Boolean
7
8
9
10
11
|
# File 'lib/outliers/resources/aws/s3/bucket.rb', line 7
def empty?
logger.debug "Bucket #{id} has #{count} objects."
count == 0
end
|
#no_public_objects? ⇒ Boolean
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/outliers/resources/aws/s3/bucket.rb', line 13
def no_public_objects?
passed = true
logger.info "Validating #{objects.count} objects in '#{id}' are private."
objects.each do |o|
logger.debug "Verifying '#{o.key}' is private."
o.acl.grants.select do |g|
grantee = Nokogiri::XML(g.grantee.to_s).children.children.children.to_s
if grantee == "http://acs.amazonaws.com/groups/global/AllUsers" || grantee == "http://acs.amazonaws.com/groups/global/AuthenticatedUsers"
logger.debug "Object '#{o.key}' in '#{id}' has public grant '#{grantee}'."
passed = false
end
end
end
logger.debug "Verification of '#{id}' #{passed ? 'passed' : 'failed'}."
passed
end
|
34
35
36
|
# File 'lib/outliers/resources/aws/s3/bucket.rb', line 34
def not_configured_as_website?
!configured_as_website?
end
|