Skip to content

Policy conditions not enforced in resource policy?Β #17

@skuenzli

Description

@skuenzli

I'm testing IAMSpy and it looks like policy conditions in resource policy are / may not be enforced. What behavior is expected?

I've created a failing test case here:
skuenzli@3614947

But basically the test case uses:

  • allow-testing-s3.json GAAD which grants no permissions to role testing via Identity policies
  • a bucket policy that Allows s3:GetObject to principal * and narrows that with an aws:PrincipalArn condition

Statement:

{
          "Sid": "AllowNonExistentPrincipal",
          "Effect": "Allow",
          "Principal": "*",
          "Action": "s3:GetObject",
          "Resource": [
            "arn:aws:s3:::bucket",
            "arn:aws:s3:::bucket/*"
          ],
          "Condition": {
            "ArnEquals": {
              "aws:PrincipalArn": [
                "arn:aws:iam::111111111111:user/some-other-user"
              ]
            }
          }
        }

IAMSpy can_i reports the testing principal has the s3:GetObject permission to the bucket.

FWIW, I have tried both strict_conditions=True and False

Is this behavior expected?

AFAICT (from debug output in my private library integration), the condition is parsed from the statement in the resource policy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions