Repository navigation
AZU-0057: check claims "Queue, Table, or Blob" logging but only inspects queue_properties, and fires where the required config is impossible #11088
Closed
DmitrySandalov
started this conversation in
False Detection
Replies: 1 comment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
AZU-0057(azure-storage-storage-account-logging-enabled) describes itself as satisfied by logging on any storage service, but its implementation only reads queue Storage Analytics. As a result it cannot be satisfied on accounts where the queue service is unused or unreachable, and it flags accounts that are correctly logging blob operations via diagnostic settings.Claim vs implementation
Metadata in
checks/cloud/azure/storage/storage_account_logging_enabled.rego:recommended_action: "Enable logging for at least one storage service (Queue, Table, or Blob)"The whole rule body:
No blob or table path exists.
avd_docs/azure/storage/AZU-0057/Terraform.mdshows only aqueue_properties { logging { ... } }example, and the Terraform adapter reads only that block (adapt.go:231).Reproduction
trivy 0.70.0, checks bundle
sha256:1583562f8b90ed2a071b99f0e5ffff6b57e4ceb6ca3e4796577b4e6a339eb74c.queue_properties { logging { ... } }azurerm_storage_account_queue_propertieswithlogging(standalone resource)azurerm_monitor_diagnostic_settingon${id}/blobServices/defaultwithStorageRead/StorageWrite/StorageDeleteaccount_kind = "BlobStorage"(no queue service exists)account_kind = "BlockBlobStorage"The check also passes when logging is explicitly disabled
The adapter hardcodes
EnableLogging = iacTypes.Bool(true, loggingBlock.GetMetadata())(pkg/iac/adapters/terraform/azure/storage/adapt.go:236), so the presence of the block is treated as logging being enabled regardless of the values inside it. A configuration that collects nothing therefore satisfies a check titled "Storage account should have logging enabled", whilequeue_properties {}without the sub-block fails.Why the stated promise cannot be met today
pkg/iac/providers/azure/storage/storage.go,BlobPropertiesholds onlyDeleteRetentionPolicy, and there is noTablePropertiestype.azurerm_storage_accounthas noblob_properties.logging, and there is noazurerm_storage_account_blob_propertiesresource. See Ability to set and update Storage analytics logging settings hashicorp/terraform-provider-azurerm#3581 (open since 2019; Not detecting tokens properly in ENV in Docker images #5909 was closed as its duplicate).queue_propertiescan only be configured whenaccount_tieris set toStandardandaccount_kindis set to eitherStorageorStorageV2." So forBlobStorage/BlockBlobStoragethe check is unsatisfiable by construction.Relationship to AZU-0009
AZU-0009(azure-storage-queue-services-logging-enabled) covers the same signal but guards on actual queue usage:AZU-0057— added in #496 — has no such guard, so it fires on accounts with no queue service in use. As implemented the two overlap, withAZU-0057being the broader-firing of the pair.Impact
The check flags accounts that are correctly configured. An account that logs blob operations through
azurerm_monitor_diagnostic_settingon${id}/blobServices/default— the only way to log blob requests in Terraform, given hashicorp/terraform-provider-azurerm#3581 — is still reported. So is one usingazurerm_storage_account_queue_properties, the officially recommended replacement.That last point compounds: the inline
queue_propertiesblock is deprecated in the provider, carrying"this block has been deprecated and superseded by the azurerm_storage_account_queue_properties resource and will be removed in v5.0 of the AzureRM provider"(internal/services/storage/storage_account_resource.go:1367). The only configuration that satisfies AZU-0057 is therefore scheduled for removal, while the form that replaces it is not recognised.Possible resolutions
count(account.queues) > 0guard for parity withAZU-0009, and retitle to queue-specific wording; orAZU-0057in favour ofAZU-0009if the overlap is unintended.Environment
0.70.0sha256:1583562f8b90ed2a071b99f0e5ffff6b57e4ceb6ca3e4796577b4e6a339eb74cmisconfigtrivy configFiled as a Discussion per https://trivy.dev/docs/latest/community/contribute/issue/.
All reactions