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

IAM policy optimizer is too eager may cause a security issue #957

Closed
eladb opened this issue Oct 18, 2018 · 1 comment · Fixed by #958
Closed

IAM policy optimizer is too eager may cause a security issue #957

eladb opened this issue Oct 18, 2018 · 1 comment · Fixed by #958
Labels
bug This issue is a bug.

Comments

@eladb
Copy link
Contributor

eladb commented Oct 18, 2018

The IAM policy optimization code (#916) has an issue that may cause unwanted extension of permissions.

Repro:

const doc = new iam.PolicyDocument();
doc.addStatement(new iam.PolicyStatement()
  .addResource('bucket1')
  .addActions('s3:read-only'));

doc.addStatement(new iam.PolicyStatement()
  .addResource('bucket2')
  .addActions('s3:*'));

Output:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "s3:*",
      "Resource": [
        "bucket1",
        "bucket2"
      ]
    }
  ]
}

Expected (obvsiouly, we didn't want full access to "bucket1"):

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "s3:read-only",
      "Resource": "bucket1"
    },
    {
      "Effect": "Allow",
      "Action": "s3:*",
      "Resource": "bucket2"
    }
  ]
}
@eladb eladb added bug This issue is a bug. 👮‍♂️ security-issue labels Oct 18, 2018
@eladb
Copy link
Contributor Author

eladb commented Oct 18, 2018

I am going to revert #916 for now and we should discuss what's the right way to introduce changes in this layer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant