bicep
bicep copied to clipboard
Add linter rule to verify deploymentScripts users aren't passing secure parameters to insecure properties
Similar in concept to the protect-commandtoexecute-secrets rule - we should teach users to use secure properties. Otherwise they risk exposing secrets in a way that can be read back from the deploymentScripts resource by anyone with */read permissions.
Example of unsafe behavior:
@secure()
param foo string
resource asdf 'Microsoft.Resources/deploymentScripts@2020-10-01' = {
name: 'asdf'
location: resourceGroup().location
kind: 'AzurePowerShell'
properties: {
azPowerShellVersion: '3.0'
retentionInterval: 'PT4H'
// this should be flagged - the value of 'foo' can be accessed via a GET.
arguments: '-foo ${foo}'
scriptContent: loadTextContent('myScript.ps1')
}
}
Desired approach - use secure env vars:
@secure()
param foo string
resource asdf 'Microsoft.Resources/deploymentScripts@2020-10-01' = {
name: 'asdf'
location: resourceGroup().location
kind: 'AzurePowerShell'
properties: {
azPowerShellVersion: '3.0'
retentionInterval: 'PT4H'
scriptContent: loadTextContent('myScript.ps1')
environmentVariables: [
{ name: 'foo', secureValue: foo }
]
}
}
Adding feature note from #7185 - other resource types that have first-class secure handling Microsoft.ContainerInstance/containerGroups - in particular.