bridgecrewio / checkov

Prevent cloud misconfigurations and find vulnerabilities during build-time in infrastructure as code, container images and open source packages with Checkov by Bridgecrew.
https://www.checkov.io/
Apache License 2.0
7.1k stars 1.12k forks source link

Bicep Parsing Error #5320

Closed svwie closed 9 months ago

svwie commented 1 year ago

Describe the issue Based on the Microsoft Azure Resource Module Repository, we encounter an issue with parsing errors. Affecting this module.

Example Value There are three lines commented out in the code snippet below. Each of these lines is causing the parsing error. This is part of the Bicep module mentioned above.

resource namespace 'Microsoft.Relay/namespaces@2021-11-01' existing = {
  name: split(hybridConnectionResourceId, '/')[8]
  scope: resourceGroup(split(hybridConnectionResourceId, '/')[2], split(hybridConnectionResourceId, '/')[4])

  resource hybridConnection 'hybridConnections@2021-11-01' existing = {
    name: split(hybridConnectionResourceId, '/')[10]

    resource authorizationRule 'authorizationRules@2021-11-01' existing = {
      name: sendKeyName
    }
  }
}

resource hybridConnectionRelay 'Microsoft.Web/sites/hybridConnectionNamespaces/relays@2022-09-01' = if(empty(slotName)) {
  name: '${appName}/${namespace.name}/${namespace::hybridConnection.name}'
  properties: {
    serviceBusNamespace: namespace.name
    serviceBusSuffix: split(substring(namespace.properties.serviceBusEndpoint, indexOf(namespace.properties.serviceBusEndpoint, '.servicebus')), ':')[0]
    relayName: namespace::hybridConnection.name
    relayArmUri: namespace::hybridConnection.id
    //hostname: split(json(namespace::hybridConnection.properties.userMetadata)[0].value, ':')[0]
    //port: int(split(json(namespace::hybridConnection.properties.userMetadata)[0].value, ':')[1])
    sendKeyName: namespace::hybridConnection::authorizationRule.name
    //sendKeyValue: namespace::hybridConnection::authorizationRule.listKeys().primaryKey
  }
}
stale[bot] commented 9 months ago

Thanks for contributing to Checkov! We've automatically marked this issue as stale to keep our issues list tidy, because it has not had any activity for 6 months. It will be closed in 14 days if no further activity occurs. Commenting on this issue will remove the stale tag. If you want to talk through the issue or help us understand the priority and context, feel free to add a comment or join us in the Checkov slack channel at codifiedsecurity.slack.com Thanks!

stale[bot] commented 9 months ago

Closing issue due to inactivity. If you feel this is in error, please re-open, or reach out to the community via slack: codifiedsecurity.slack.com Thanks!