Repository navigation
fix(arm): find blob containers and map their public access values - #11662
Conversation
3a5eb3c to
b517ac3
Compare
nikpivkin
left a comment
There was a problem hiding this comment.
With this change AVD-AZU-0009 fires for every ARM storage account that has queues in any form, because the adapter always sets EnableLogging to false. In ARM, queue logging is configured by a separate diagnostic settings resource, which the adapter does not read. EnableLogging could be created with types.BoolUnresolvable instead, and I'll update the check in trivy-checks to skip unresolvable values.
The description also says containers are returned in file order, but nested containers come first and top-level ones after them, so the order differs from the file when a top-level container is declared before its account.
|
Fixed in ae7151d: |
Description
The storage adapter looked for the child type
containerServices/containers, which isn't an Azure type, so it never found blob containers and AVD-AZU-0007 never fired.This PR adds
Deployment.GetChildResourcesandDeployment.GetOrphanResources, as suggested in #11655, and uses them for containers and queues:GetChildResources(parent, childType)takes a full type or one relative to the parent (blobServices/containers). It walks the nested resources at any depth and builds the full type of each one from its parents, so short (containersunderblobServices), multi-segment (blobServices/containersnameddefault/<container>directly in the account) and full types all match. It also returns the top-level resources whose name starts with the parent name and/, and the children nested in them, such as containers nested in a top-levelblobServicesnamedsa/default. Types match case-insensitively.GetOrphanResourcesreturns those top-level children, and the adapter puts them in a storage account with unmanaged metadata, as the Terraform adapter does. Checks on containers still report them, and checks on accounts skip that account.publicAccess(None,Blob,Container, any case) maps to the provider values (off,blob,container). A missing value defaults tooff. Before, the adapter passedNonethrough and also used it as the default, which AVD-AZU-0007 treats as public.queueServices/queues) use the same lookup, so top-level queues are found too. A queue is named by the last segment of its name,topforsa/default/top, the same as a nested queue and the Terraform adapter.EnableLogging) is now unresolvable instead offalse. ARM configures it in a separate diagnostic settings resource, which the adapter doesn't read, so withfalseAVD-AZU-0009 would fire for every account with queues. AVD-AZU-0009 skips unresolvable values after fix(azu-0009): skip unresolvable queue logging trivy-checks#671.Nested containers come first, then top-level ones in file order.
Before and after, scanning the template from #11655 (
trivy config --skip-check-update .):The AZU-0057 change is expected: on main it fired for every ARM storage account, even one with logging configured, because the adapter set
EnableLoggingtofalseand never reads the diagnostic settings resource where ARM configures logging. With the field unresolvable, AZU-0057 skips it.A private container (
"publicAccess": "None") doesn't fire AZU-0007.#11567 reads the blob soft delete policy from a nested
blobServicesresource and leaves the top-level form out.GetChildResources(account, "blobServices")would cover both, either there or in a follow-up.Related issues
Related PRs
NSG rules and database firewall rules follow in the PRs above, on top of this one.
Checklist
🤖 Generated with Claude Code