Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the authenticated users URI as a Grantee URI to check #1

Merged
merged 2 commits into from
May 2, 2018

Conversation

mattlorimor
Copy link
Contributor

@mattlorimor mattlorimor commented Apr 23, 2018

The "Authenticated Users group" predefined group is also a group that can be in an ACL that grants effective public access to an S3 bucket:

Authenticated Users group – Represented by http://acs.amazonaws.com/groups/global/AuthenticatedUsers.
This group represents all AWS accounts. Access permission to this group allows any AWS account to access the resource. However, all requests must be signed (authenticated).
Warning
When you grant access to the Authenticated Users group any AWS authenticated user in the world can access your resource.

This PR adds the group and checks for it.

Public access at the bucket level could also be done via bucket policy, but that's a bit tricker than just knowing a couple predefined groups to check for on an ACL and is outside the scope of this PR.

@willh
Copy link
Owner

willh commented May 2, 2018

Hey there, thanks for contributing. That's a good catch, to check for misc public users!

index.js Outdated
@@ -22,7 +22,7 @@ exports.handler = (event, context) => {
// Grant[0] is always owner, so we only need to check further if we have more than 1 grant
if (grants.length > 1) {
for (const grant of grants) {
if (grant.Grantee.URI && (grant.Grantee.URI == allUsersUri || grant.Grantee.URI == authenticatedUsersUri) {
if (grant.Grantee.URI && (grant.Grantee.URI == allUsersUri || grant.Grantee.URI == authenticatedUsersUri)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol always the way

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just squash those two commits together and nobody will ever know.

@willh willh merged commit 4d92132 into willh:master May 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants