terraform.azure.security.azure-datafactory-uses-git-repository.azure-datafactory-uses-git-repository

profile photo of semgrepsemgrep
Author
unknown
Download Count*

Ensure that Azure Data Factory uses Git repository for source control

Run Locally

Run in CI

Defintion

rules:
  - id: azure-datafactory-uses-git-repository
    message: Ensure that Azure Data Factory uses Git repository for source control
    patterns:
      - pattern: resource
      - pattern-not-inside: |
          resource "azurerm_data_factory" "..." {
          ...
          github_configuration {
            ...
          }
          ...
          }
      - pattern-not-inside: |
          resource "azurerm_data_factory" "..." {
          ...
          vsts_configuration {
            ...
          }
          ...
          }
      - pattern-inside: |
          resource "azurerm_data_factory" "..." {
          ...
          }
    metadata:
      owasp:
        - A05:2017 - Broken Access Control
        - A01:2021 - Broken Access Control
      cwe:
        - "CWE-284: Improper Access Control"
      category: security
      technology:
        - terraform
        - azure
      references:
        - https://owasp.org/Top10/A01_2021-Broken_Access_Control
      subcategory:
        - audit
      likelihood: LOW
      impact: LOW
      confidence: LOW
      license: Commons Clause License Condition v1.0[LGPL-2.1-only]
      vulnerability_class:
        - Improper Authorization
    languages:
      - hcl
    severity: WARNING

Examples

azure-datafactory-uses-git-repository.tf

# pass
resource "azurerm_data_factory" "github" {
  location            = azurerm_resource_group.example.location
  name                = "example"
  resource_group_name = azurerm_resource_group.example.name

  github_configuration {
    account_name    = "bridgecrewio"
    branch_name     = "master"
    git_url         = "https://github.com"
    repository_name = "checkov"
    root_folder     = "/"
  }
}

# pass
resource "azurerm_data_factory" "vsts" {
  location            = azurerm_resource_group.example.location
  name                = "example"
  resource_group_name = azurerm_resource_group.example.name

  vsts_configuration {
    account_name    = "bridgecrewio"
    branch_name     = "master"
    project_name    = "chechov"
    repository_name = "checkov"
    root_folder     = "/"
    tenant_id       = "123456789"
  }
}

# fail
# ruleid: azure-datafactory-uses-git-repository
resource "azurerm_data_factory" "fail" {
  location            = azurerm_resource_group.example.location
  name                = "example"
  resource_group_name = azurerm_resource_group.example.name
}