-
Notifications
You must be signed in to change notification settings - Fork 208
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
Adding custom rules and tests for issue #253 - AWS::IAM::User.LoginPr… #298
Conversation
|
||
class IamUserLoginProfilePasswordResetRule < BaseRule | ||
def rule_text | ||
"IAM User Login Profile should exist and have PasswordResetRequired property set to true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sure to use single quotes if you don't need interpolation.
|
||
def audit_impl(cfn_model) | ||
violating_iam_users = cfn_model.resources_by_type("AWS::IAM::User").select do |iam_user| | ||
iam_user.loginProfile["PasswordResetRequired"].nil? || iam_user.loginProfile["PasswordResetRequired"].to_s == "false" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sure to use the proper truthy? predicate here. cfn is "weakly typed" when it comes to boolean values
a few things:
- this code is going to fail when loginProfile isn't there. it's not a required field
- i'm not sure what the proper behavior is here.... i guess if there is a login profile, the password should be noecho and reset must be required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix up string interpolation/literal convention across the code (rubocop should catch this)
make sure the behavior is correct with a missing loginProfile
…eck for violating resources
@erickascic Also made some additional refactors here as well based on the MQbroker PR. |
Adding custom rules and tests for issue #253 - AWS::IAM::User.LoginProfile password property rules