Skip to content

Conversation

tjcorr
Copy link
Contributor

@tjcorr tjcorr commented Nov 1, 2022

This is a sample PR that shows adding in a vulnerable resource. Checkov should raise alerts and the bad resource will get highlighted here using GitHub Advanced Security (GHAS).

Comment on lines +31 to +47
resource "azurerm_network_security_group" "nsg-fail" {
name = "insecureNSG"
location = azurerm_resource_group.rg-aks.location
resource_group_name = azurerm_resource_group.rg-aks.name

security_rule {
name = "badrule"
priority = 100
direction = "Inbound"
access = "Allow"
protocol = "*"
source_port_range = "*"
destination_port_range = "*"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}

Check failure

Code scanning / checkov

Ensure that SSH access is restricted from the internet

Ensure that SSH access is restricted from the internet
Comment on lines +31 to +47
resource "azurerm_network_security_group" "nsg-fail" {
name = "insecureNSG"
location = azurerm_resource_group.rg-aks.location
resource_group_name = azurerm_resource_group.rg-aks.name

security_rule {
name = "badrule"
priority = 100
direction = "Inbound"
access = "Allow"
protocol = "*"
source_port_range = "*"
destination_port_range = "*"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}

Check failure

Code scanning / checkov

Ensure that RDP access is restricted from the internet

Ensure that RDP access is restricted from the internet
Comment on lines +31 to +47
resource "azurerm_network_security_group" "nsg-fail" {
name = "insecureNSG"
location = azurerm_resource_group.rg-aks.location
resource_group_name = azurerm_resource_group.rg-aks.name

security_rule {
name = "badrule"
priority = 100
direction = "Inbound"
access = "Allow"
protocol = "*"
source_port_range = "*"
destination_port_range = "*"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}

Check failure

Code scanning / checkov

Ensure that HTTP (port 80) access is restricted from the internet

Ensure that HTTP (port 80) access is restricted from the internet
@github-actions
Copy link

github-actions bot commented Nov 1, 2022

Terraform Plan Output

Click to expand
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # azurerm_network_security_group.nsg-fail will be created
  + resource "azurerm_network_security_group" "nsg-fail" {
      + id                  = (known after apply)
      + location            = "eastus"
      + name                = "insecureNSG"
      + resource_group_name = "rg-terraform-github-actions"
      + security_rule       = [
          + {
              + access                                     = "Allow"
              + description                                = ""
              + destination_address_prefix                 = "*"
              + destination_address_prefixes               = []
              + destination_application_security_group_ids = []
              + destination_port_range                     = "*"
              + destination_port_ranges                    = []
              + direction                                  = "Inbound"
              + name                                       = "badrule"
              + priority                                   = 100
              + protocol                                   = "*"
              + source_address_prefix                      = "*"
              + source_address_prefixes                    = []
              + source_application_security_group_ids      = []
              + source_port_range                          = "*"
              + source_port_ranges                         = []
            },
        ]
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants