-
Notifications
You must be signed in to change notification settings - Fork 597
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
[Enhancement] Validate Principal
in S3 Bucket Policy is "*" or Map with Key as AWS
#3531
Comments
In v1 of cfn-lint this will be reported as
this happens because you have it as a string but the only valid string is |
Hm, I don't believe the error was reported with v1. We are running v1.8.2 |
@shahamy any chance you are using a Sub for the Principal instead of a string as provided above? Using a sub removes the error message for me. We should provide one here but since we don't know the value for all the substitution parameters we don't validate it.
|
Yes you're right. I am using a To confirm, cfn-lint doesn't evaluate the string and just looks at the CFT at face value so can't tell it's type? |
Yea, its tricky for us. We are working to improve this but at this point you are correct. If we don't know the parameter values we can't evaluate the function but we try. For instance if it was We could try to go farther with These changes wouldn't solve all the possibilities but may allow us to catch this type of issue. |
I'm good if you want to close this as a won't fix |
Is this feature request related to a new rule or cfn-lint capabilities?
rules
Describe the feature you'd like to request
I would like to add a rule for validating the
Principal
value in Bucket Policy for S3 bucketsI had a repo where we have
This failed after a good 20 minutes trying to create the S3 Bucket Policy with
Invalid policy syntax
which was not a very descriptive issueDescribe the solution you'd like
The rule we could add could validate that
Principal
=="*"
OR
Principal
is typemap
and has keyAWS
The correct template what worked is:
Additional context
I believe Principal can only be those 2 options -- please confirm!
Note: I am not sure where the schema nor rules for S3 Bucket Policy are implemented but I'd be happy to try to contribute
Is this something that you'd be interested in working on?
Would this feature include a breaking change?
The text was updated successfully, but these errors were encountered: