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
Update script that creates managed rule list used by Config #6823
Conversation
For the first pass, correct the code to allow for new label, "Resource Types" added to AWS docs repo on Feb 22, 2023. Also add the updated list of managed rules, which can then be used as a control file when updating the script that creates the list.
Just for the record, I noticed the following differences between the old list of markdown documents and the resource list in the AWS documentation (https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html):
|
Still need to parse the dl tag differently.
Codecov Report
@@ Coverage Diff @@
## master #6823 +/- ##
=======================================
Coverage 96.20% 96.20%
=======================================
Files 816 816
Lines 80042 80062 +20
=======================================
+ Hits 77004 77024 +20
Misses 3038 3038
Flags with carried forward coverage won't be shown. Click here to find out more. |
@bblommers This is delicate code in the sense that it can break if AWS changes the HTML for the documentation pages. I used the The HTML is more consistent than the markdown files. Previously I had to handle odd cases in the markdown text, but with the HTML there were no special checks needed. |
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.
Looks good to me - thank you for updating this @kbalk!
I'll see if I can make a weekly cron job out of this, so the rules are always up-to-date (+ we get a more timely reminder if it does break..)
Monthly or quarterly might be good enough. The list of managed rules was last updated a year ago and no one reported issues with it. I was looking at the config code and it doesn't do a lot with the managed rules at the moment because boto3 didn't do much either (and maybe still doesn't). If that should change, than keeping the list of managed rules up-to-date would be more important. Also, "Resource Types" was added to the managed rules info, but I don't know how that's being used by AWS. |
The script,
scripts/pull_down_aws_managed_rules.py
, used to download markdown files from an AWS repo. Those markdown files contained info on managed rules, similar to what appears on AWS official documentation, but in a format that's easier to parse. However, the repo containing markdown files was archived on June 15, 2023 as AWS doesn't want to maintain a separate list of the managed rules (read their explanation here).So
scripts/pull_down_aws_managed_rules.py
has been updated to pull the managed rule info from AWS documentation websites and the parsed results (moto/config/resources/aws_managed_rules.json
) has been updated to match that documentation. The updates in the last year for manged rules appear to include adding another label, "Resource Types", changes to regions and a few new services.