Repository navigation
ARM misconfiguration: NSG rules, database firewall rules and blob containers are missed in common template shapes #11655
Replies: 4 comments
|
Hi @aneviaro ! Thanks for the report. All three cases reproduce on main, and the direction works for us. Some notes on the implementation. The three adapters collect child resources the same way, so it makes sense to do it in one place. This could be a method on When the parent name or the child name is an expression, we can't tell which parent the child belongs to. Every template built from Bicep has this problem, because Bicep writes child names as The Queues use the same lookup, which only sees nested resources, so they can move to the new method in the containers PR. For the PR order, the first PR can add the method and use it for containers. NSG rules and firewall rules can follow as separate PRs on top of it. |
|
I opened an issue for each case, so each PR can close its own issue: |
|
@nikpivkin Thanks for the review and the issues! PRs are up: #11662, #11663, #11664. |
Uh oh!
There was an error while loading. Please reload this page.
IDs
AVD-AZU-0007, AVD-AZU-0029, AVD-AZU-0047, AVD-AZU-0050
Description
The ARM adapters miss three common ways to declare child resources, so these checks never fire on them:
adaptSecurityGroupRulesreads only top-levelMicrosoft.Network/networkSecurityGroups/securityRulesresources, and attaches each of them to every NSG in the template. Rules in the NSG'sproperties.securityRules(the most common form) and rules declared as child resources are ignored.addFirewallRulereads onlyproperties.firewallRules, which isn't an ARM property ofMicrosoft.Sql/servers. Firewall rules are separate resources (Microsoft.Sql/servers/firewallRules, and the MySQL, MariaDB and PostgreSQL equivalents), declared as children or at the top level. The code has a TODO for it.containerServices/containers, which isn't an Azure type. Containers areMicrosoft.Storage/storageAccounts/blobServices/containers, nested underblobServicesor at the top level. Also,publicAccessis passed through as written (None/Blob/Container), but the check expectsoff/blob/container, so a private container (None) would fail AZU-0007 once containers are found.Proposed fix. I have fixes ready, one PR per adapter:
/. Since the parser doesn't evaluate expressions, a rule or parent whose name is an expression keeps today's behaviour.publicAccessto the provider values.With the three fixes, the template below also gets AZU-0007, 0029, 0047 and 0050, and AZU-0060 (container CMK), which reads containers too. A container with
publicAccess: Nonedoesn't fire.I'm happy to open the PRs if this direction works for you.
Reproduction Steps
Target
Filesystem
Scanner
Misconfiguration
Debug Output
Version
Checklist
-f jsonthat shows data sources and confirmed that the security advisory in data sources was correct (not applicable: misconfiguration, no advisory)All reactions