-
Notifications
You must be signed in to change notification settings - Fork 359
fix(query): add supports for Microsoft.Web/sites/config on Web App Not Using TLS Last Version for AzureResourceManager #7928
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
base: master
Are you sure you want to change the base?
Conversation
cx-artur-ribeiro
left a comment
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.
Hey Ricardo, nice changes overall, glad you noticed the missing positive test.
However, I've seen that for 2 cases that I've pointed out below, the 'search_line' is -1. Can you check why and fix it please?
assets/queries/azureResourceManager/sql_server_database_without_auditing/test/positive5.json
Show resolved
Hide resolved
assets/queries/azureResourceManager/sql_server_database_without_auditing/test/positive7.json
Show resolved
Hide resolved
cx-artur-ribeiro
left a comment
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.
Nice work refactoring the queries to take into consideration more cases Ricardo!








Reason for Proposed Changes
"Web App Not Using TLS Last Version"does not take into account the scenarios where a resource of typeMicrosoft.Web/sites/config, which is a 'child' resource fromMicrosoft.Web/sites, does not have the fieldminTlsVersiondefined or when it's defined to a version below 1.2.Proposed Changes
siteConfig.minTlsVersionwas not defined or when it was defined to a version that is not either1.2or1.3. The only changes in this policy are that it also searches for child resources and verifies if there are none. This is to prevent this policy from flagging the cases when the parent resource of typeMicrosoft.Web/sitesdoes not have the fieldminTlsVersiondefined, but the child resource of typeMicrosoft.Web/sites/configcan have or not any vulnerable configuration, which the second policy targets.Microsoft.Web/siteshas one or more child resources of typeMicrosoft.Web/sites/configand use an helper function calledcheck_tls_versionto handle all three scenarios:minTlsVersiondefined, and the parent resource has the field defined to a version that is not either1.2or1.3.minTlsVersiondefined.1.2or1.3.Web App Not Using TLS Last Version, I added the helper function web_site_resources that replaces the usage of walk() built-in function to find resources of typeMicrosoft.Web/sites.SQL Server Database Without Auditing, added the helper functionsql_database_resourcesthat also replaces the usage of the walk() built-in function. Also added the helper functionget_outer_children_resourcesthat replaces the usage of the walk function inside theget_outer_childrenfunction.I submit this contribution under the Apache-2.0 license.