Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(query): security groups not used query with false positive if security group added in a list #7212

Open
srouaix opened this issue Jul 23, 2024 · 1 comment
Labels
aws PR related with AWS Cloud bug Something isn't working community Community contribution docker Docker query query New query feature terraform Terraform query

Comments

@srouaix
Copy link

srouaix commented Jul 23, 2024

When a security group id added in a list , kics detect unused security group.

example of code sample.zip

module "fake" {
  source = "modules/fake"
  security_group_id = [aws_security_group.main.id]
}

this workaround doesn't trigger "security groups not used"

locals {
   security_group_id = aws_security_group.main.id
 }

module "fake" {
  source = "modules/fake"
  security_group_id = [local.security_group_id]
}

Expected Behavior

No detection of security group Not Used

Actual Behavior

logs.txt

Security Group Not Used, Severity: INFO, Results: 1
Description: Security group must be used or not declared
Platform: Terraform
Learn more about this vulnerability: https://docs.kics.io/latest/queries/terraform-queries/aws/4849211b-ac39-479e-ae78-5694d506cb24

        [1]: ../../path/main.tf:1

                001: resource "aws_security_group" "main" {
                002:   name        = "test"
                003:   description = "test"

Steps to Reproduce the Problem

  1. docker run -t -v ./:/path checkmarx/kics scan -p /path

Specifications

(N/A if not applicable)

  • Version: 2.1.1
  • Platform: windows
  • Subsystem: WSL ubuntu
@srouaix srouaix added bug Something isn't working community Community contribution labels Jul 23, 2024
@github-actions github-actions bot added query New query feature docker Docker query terraform Terraform query aws PR related with AWS Cloud labels Jul 23, 2024
@cx-monicac
Copy link
Collaborator

cx-monicac commented Jul 25, 2024

Hi @srouaix
Thanks for your input!

We asked our internal AppSec team to provide you feedback on this.
We will keep you updated.
(APPSEC-2915)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws PR related with AWS Cloud bug Something isn't working community Community contribution docker Docker query query New query feature terraform Terraform query
Projects
None yet
Development

No branches or pull requests

2 participants