Replies: 1 comment 1 reply
-
|
hi @bve-wd - thanks for the report. This indeed looks like a bug to me. Please track #9467 I'm also curious to learn if you've run into any other issues with bicep/arm scanning? As you may have seen, the current Trivy implementation for azure IaC scanning isn't the most feature complete so I'm curious about your usage and if you have any suggestions on what you'd like to see get improved. |
Beta Was this translation helpful? Give feedback.
1 reply
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.
-
Description
When building a Bicep file that contains a module with
az bicep build -f main.bicep, then trivy does not detect issues for the generated Azure ARM template when runningtrivy config .The main difference I noticed when using modules is, that the
resourcesproperty is a dictionary instead of an array.Desired Behavior
Trivy should yield issues for Bicep modules
Actual Behavior
Trivy does not return any issues if modules are used in main.bicep. It seems that it does not even use the azure-arm scanner (or the scanner does not yield issues)
Reproduction Steps
Example main.bicep:
Example insecure.bicep:
az bicep build -f main.biceptrivy config .Result: No issues detected
main.json:
{ "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#", "languageVersion": "2.0", "contentVersion": "1.0.0.0", "metadata": { "_generator": { "name": "bicep", "version": "0.37.4.10188", "templateHash": "9375790898027716067" } }, "resources": { "myrg": { "type": "Microsoft.Resources/resourceGroups", "apiVersion": "2025-04-01", "name": "myrg", "location": "WestEurope" }, "insecure": { "type": "Microsoft.Resources/deployments", "apiVersion": "2022-09-01", "name": "[format('insecure-{0}', uniqueString('insecure', deployment().name))]", "resourceGroup": "myrg", "properties": { "expressionEvaluationOptions": { "scope": "inner" }, "mode": "Incremental", "template": { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "metadata": { "_generator": { "name": "bicep", "version": "0.37.4.10188", "templateHash": "1574586486505528430" } }, "resources": [ { "type": "Microsoft.Storage/storageAccounts", "apiVersion": "2022-09-01", "name": "[format('insecurestorage{0}', uniqueString(resourceGroup().id))]", "location": "[resourceGroup().location]", "sku": { "name": "Standard_LRS" }, "kind": "StorageV2", "properties": { "allowBlobPublicAccess": true, "minimumTlsVersion": "TLS1_0", "supportsHttpsTrafficOnly": false, "accessTier": "Hot" } } ] } }, "dependsOn": [ "myrg" ] } } }az bicep build -f insecure.biceptrivy config .Result: Issues detected
insecure.json:
{ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "metadata": { "_generator": { "name": "bicep", "version": "0.37.4.10188", "templateHash": "1574586486505528430" } }, "resources": [ { "type": "Microsoft.Storage/storageAccounts", "apiVersion": "2022-09-01", "name": "[format('insecurestorage{0}', uniqueString(resourceGroup().id))]", "location": "[resourceGroup().location]", "sku": { "name": "Standard_LRS" }, "kind": "StorageV2", "properties": { "allowBlobPublicAccess": true, "minimumTlsVersion": "TLS1_0", "supportsHttpsTrafficOnly": false, "accessTier": "Hot" } } ] }Target
Filesystem
Scanner
Misconfiguration
Output Format
None
Mode
Standalone
Debug Output
Operating System
Windows
Version
Checklist
trivy clean --allBeta Was this translation helpful? Give feedback.
All reactions