-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved supporting code to libs, updated readme, added required gems
Signed-off-by: GitHub <[email protected]>
- Loading branch information
1 parent
7022e09
commit 4c4a764
Showing
4 changed files
with
50 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
def has_public_objects(myBucket) | ||
Inspec::Log.debug "Processing Bucket: #{myBucket}" | ||
myPublicKeys = [] | ||
s3 = Aws::S3::Resource.new() | ||
pool = Concurrent::FixedThreadPool.new(56) | ||
mutex = Mutex.new | ||
s3.bucket(myBucket).objects.each do |object| | ||
Inspec::Log.debug "Examining Key: #{object.key}" | ||
pool.post do | ||
grants = object.acl.grants | ||
if grants.map { |x| x.grantee.type }.any? { |x| x =~ %r{Group} } | ||
if grants.map { |x| x.grantee.uri }.any? { |x| x =~ %r{AllUsers|AuthenticatedUsers} } | ||
mutex.synchronize do | ||
myPublicKeys << object.key | ||
end | ||
end | ||
end | ||
end | ||
end | ||
pool.shutdown | ||
pool.wait_for_termination | ||
myPublicKeys | ||
end |