terraform.lang.security.eks-public-endpoint-enabled.eks-public-endpoint-enabled
Community Favorite
semgrep
Author
46,316
Download Count*
License
The vpc_config resource inside the eks cluster has not explicitly disabled public endpoint access
Run Locally
Run in CI
Defintion
rules:
- id: eks-public-endpoint-enabled
patterns:
- pattern: |
resource
- pattern-inside: |
resource "aws_eks_cluster" "..." {...}
- pattern-not-inside: |
resource "aws_eks_cluster" "..."{
...
vpc_config{
...
endpoint_public_access = false
...
}
...
}
languages:
- hcl
message: The vpc_config resource inside the eks cluster has not explicitly
disabled public endpoint access
severity: WARNING
metadata:
category: security
cwe:
- "CWE-200: Exposure of Sensitive Information to an Unauthorized Actor"
technology:
- terraform
- aws
owasp:
- A01:2021 - Broken Access Control
references:
- https://owasp.org/Top10/A01_2021-Broken_Access_Control
cwe2021-top25: true
subcategory:
- audit
likelihood: LOW
impact: LOW
confidence: LOW
license: Commons Clause License Condition v1.0[LGPL-2.1-only]
vulnerability_class:
- Mishandled Sensitive Information
Examples
eks-public-endpoint-enabled.tf
# ruleid: eks-public-endpoint-enabled
resource "aws_eks_cluster" "example" {
name = "example"
role_arn = aws_iam_role.example.arn
vpc_config {
subnet_ids = [aws_subnet.example1.id, aws_subnet.example2.id]
}
}
# ruleid: eks-public-endpoint-enabled
resource "aws_eks_cluster" "example" {
name = "example"
role_arn = aws_iam_role.example.arn
}
resource "aws_eks_cluster" "example" {
name = "example"
role_arn = aws_iam_role.example.arn
vpc_config {
endpoint_public_access = false
subnet_ids = [aws_subnet.example1.id, aws_subnet.example2.id]
}
}
Short Link: https://sg.run/Albg