Not sure, but "all of a sudden" (you know what I'm talking about) it's working in the policy simulator with:
- Policy 1: "allow specific S3 permissions on any bucket" (e.g. an editor role)
- Policy 2: "deny all S3 actions unless in a user's folder across buckets" (i.e. can only see their files)
Where 'Policy 2' is:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ExplicitlyDenyAnythingExceptOwnNamedFolder",
"Action": [
"s3:*"
],
"Effect": "Deny",
"NotResource": [
"arn:aws:s3:::mynamespace-property*/subfolder/${aws:username}/*"
]
}
]
}
As a sidenote, be aware that arn:aws:s3:::mynamespace-property*/${aws:username}/*
(no explicit subfolder) will match both with and without "intervening" subfolders:
arn:aws:s3:::mynamespace-property-suffix/subfolder/theuser/files..."
arn:aws:s3:::mynamespace-property-suffix/theuser/files..."