Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
246d1bf
fix(query): fn for EFS volume with disabled transit encryption--cloud…
cx-andre-pereira Jul 22, 2025
02b9ea3
Merge branch 'master' into AST-40736--FN_EFS_Volume_With_Disabled_Tra…
cx-andre-pereira Jul 24, 2025
6c72e3d
Merge branch 'master' of https://github.com/Checkmarx/kics into AST-4…
cx-andre-pereira Jul 25, 2025
67d326e
fix yml to yaml
cx-andre-pereira Jul 25, 2025
bc12abb
terraform equivilant query rename + extra case for cloudformation
cx-andre-pereira Jul 31, 2025
5c1cda4
Merge branch 'master' of https://github.com/Checkmarx/kics into AST-4…
cx-andre-pereira Jul 31, 2025
5cb149e
duplicate flag fix
cx-andre-pereira Jul 31, 2025
31fa0a3
test folder cleanup
cx-andre-pereira Aug 1, 2025
68bb9d7
Merge branch 'master' into AST-40736--FN_EFS_Volume_With_Disabled_Tra…
cx-andre-pereira Aug 1, 2025
c65a003
metadata update and e2e results update
cx-andre-pereira Aug 1, 2025
de5c2e9
Merge branch 'AST-40736--FN_EFS_Volume_With_Disabled_Transit_Encrypti…
cx-andre-pereira Aug 1, 2025
8201589
e2e fix 2 (scan paths)
cx-andre-pereira Aug 1, 2025
7f251c7
query prototype 1
cx-andre-pereira Aug 4, 2025
9a14c8e
at rest implementation new tests and logic fix
cx-andre-pereira Aug 5, 2025
74da8c2
Merge branch 'master' into AST-40736--FN_EFS_Volume_With_Disabled_Tra…
cx-andre-pereira Aug 5, 2025
353d4d2
smaller test files , descriptionUrl and inclusion of EC2:Instance
cx-andre-pereira Aug 5, 2025
9113e42
Merge branch 'AST-40736--FN_EFS_Volume_With_Disabled_Transit_Encrypti…
cx-andre-pereira Aug 5, 2025
26fa057
Merge branch 'master' of https://github.com/Checkmarx/kics into AST-4…
cx-andre-pereira Aug 6, 2025
6e9f38e
Merge branch 'master' of https://github.com/Checkmarx/kics into AST-4…
cx-andre-pereira Aug 8, 2025
e275bd6
restores ecs cluster not encrypted at rest to current master implemen…
cx-andre-pereira Aug 8, 2025
9e4f152
conflits favoring master
cx-andre-pereira Aug 13, 2025
a3e67e2
Merge branch 'master' into AST-40736--FN_EFS_Volume_With_Disabled_Tra…
cx-andre-pereira Aug 14, 2025
4e13440
Merge branch 'master' into AST-40736--FN_EFS_Volume_With_Disabled_Tra…
cx-andre-pereira Aug 19, 2025
b1874a3
removed test
cx-andre-pereira Aug 19, 2025
7b6126e
smaller tests and new case handling
cx-andre-pereira Aug 19, 2025
0086f25
e2e tests fix1
cx-andre-pereira Aug 19, 2025
5d98f6d
Merge branch 'master' into AST-40736--FN_EFS_Volume_With_Disabled_Tra…
cx-andre-pereira Aug 19, 2025
18095c1
Merge branch 'master' into AST-40736--FN_EFS_Volume_With_Disabled_Tra…
cx-artur-ribeiro Aug 19, 2025
118eecc
Merge branch 'master' into AST-40736--FN_EFS_Volume_With_Disabled_Tra…
cx-andre-pereira Aug 19, 2025
18e5306
Merge branch 'master' of https://github.com/Checkmarx/kics into AST-4…
cx-andre-pereira Aug 20, 2025
f12594e
rollback of ecs cluster not encrypte at rest and e2e tests associated
cx-andre-pereira Aug 20, 2025
9bc4d72
Merge branch 'master' into AST-40736--FN_EFS_Volume_With_Disabled_Tra…
cx-andre-pereira Aug 20, 2025
0d153c8
fixed positive tests and missing newline e2e 32
cx-andre-pereira Aug 20, 2025
c21db6e
Merge branch 'master' into AST-40736--FN_EFS_Volume_With_Disabled_Tra…
cx-andre-pereira Aug 20, 2025
60e3f45
Merge branch 'master' of https://github.com/Checkmarx/kics into AST-4…
cx-andre-pereira Aug 20, 2025
90ba036
e2e fix
cx-andre-pereira Aug 20, 2025
25b28cd
master merge
cx-andre-pereira Aug 21, 2025
1946477
e2e fix
cx-andre-pereira Aug 21, 2025
6bf0805
Merge branch 'master' into AST-40736--FN_EFS_Volume_With_Disabled_Tra…
cx-andre-pereira Aug 22, 2025
f8c34f9
Merge branch 'master' into AST-40736--FN_EFS_Volume_With_Disabled_Tra…
cx-artur-ribeiro Aug 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package Cx
import data.generic.common as common_lib
import data.generic.cloudformation as cf_lib

CxPolicy[result] {
CxPolicy[result] {
resource := input.document[i].Resources
elem := resource[key]
elem.Type == "AWS::ECS::Service"
Expand All @@ -12,16 +12,16 @@ CxPolicy[result] {
taskDefinition := resource[taskdefinitionkey]

count(taskDefinition.Properties.ContainerDefinitions) > 0
res := is_transit_encryption_disabled(taskDefinition, taskdefinitionkey)
taskDefinition.Properties.Volumes[j].EFSVolumeConfiguration.TransitEncryption == "DISABLED"

result := {
"documentId": input.document[i].id,
"resourceType": elem.Type,
"resourceName": cf_lib.get_resource_name(resource, key),
"searchKey": res["sk"],
"issueType": res["issueT"],
"keyExpectedValue": res["kev"],
"keyActualValue": res["kav"],
"resourceName": cf_lib.get_resource_name(resource, key),
"searchKey": sprintf("Resources.%s.Properties.Volumes", [taskdefinitionkey]),
"issueType": "IncorrectValue",
"keyExpectedValue": sprintf("Resources.%s.Properties.Volumes[%d].EFSVolumeConfiguration.TransitEncryption should be enabled", [taskdefinitionkey, j]),
"keyActualValue": sprintf("Resources.%s.Properties.Volumes[%d].EFSVolumeConfiguration.TransitEncryption is disabled", [taskdefinitionkey, j]),
}
}

Expand All @@ -44,48 +44,9 @@ CxPolicy[result] {
}
}

is_transit_encryption_disabled(taskDefinition, taskdefinitionkey) = res {
volume := taskDefinition.Properties.Volumes[j]
common_lib.valid_key(volume.EFSVolumeConfiguration, "TransitEncryption")
volume.EFSVolumeConfiguration.TransitEncryption == "DISABLED"
res := {
"sk": sprintf("Resources.%s.Properties.Volumes[%d].EFSVolumeConfiguration.TransitEncryption", [taskdefinitionkey, j]),
"issueT": "IncorrectValue",
"kev": sprintf("Resources.%s.Properties.Volumes[%d].EFSVolumeConfiguration.TransitEncryption should be enabled", [taskdefinitionkey, j]),
"kav": sprintf("Resources.%s.Properties.Volumes[%d].EFSVolumeConfiguration.TransitEncryption is disabled", [taskdefinitionkey, j]),
}
} else = res {
volume := taskDefinition.Properties.Volumes[j]
efsVolumeConfiguration := volume.EFSVolumeConfiguration
not common_lib.valid_key(efsVolumeConfiguration, "TransitEncryption")
res := {
"sk": sprintf("Resources.%s.Properties.Volumes[%d].EFSVolumeConfiguration", [taskdefinitionkey, j]),
"issueT": "MissingAttribute",
"kev": sprintf("Resources.%s.Properties.Volumes[%d].EFSVolumeConfiguration.TransitEncryption should be defined", [taskdefinitionkey, j]),
"kav": sprintf("Resources.%s.Properties.Volumes[%d].EFSVolumeConfiguration.TransitEncryption is not defined (set to DISABLED by default)", [taskdefinitionkey, j]),
}
} else = res {
volume := taskDefinition.Properties.Volumes[j]
not common_lib.valid_key(volume, "EFSVolumeConfiguration")
res := {
"sk": sprintf("Resources.%s.Properties.Volumes[%d]", [taskdefinitionkey, j]),
"issueT": "MissingAttribute",
"kev": sprintf("Resources.%s.Properties.Volumes[%d].EFSVolumeConfiguration should be defined", [taskdefinitionkey, j]),
"kav": sprintf("Resources.%s.Properties.Volumes[%d].EFSVolumeConfiguration is not defined", [taskdefinitionkey, j]),
}
} else = res {
not common_lib.valid_key(taskDefinition.Properties, "Volumes")
res := {
"sk": sprintf("Resources.%s.Properties", [taskdefinitionkey]),
"issueT": "MissingAttribute",
"kev": sprintf("Resources.%s.Properties.Volumes should be defined", [taskdefinitionkey]),
"kav": sprintf("Resources.%s.Properties.Volumes is not defined", [taskdefinitionkey]),
}
}

getTaskDefinitionName(resource) := name {
name := resource.Properties.TaskDefinition
not common_lib.valid_key(name, "Ref")
} else := name {
name := resource.Properties.TaskDefinition.Ref
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,33 @@ Resources:
TaskDefinition: !Ref taskdefinition
ServiceName: !Ref ServiceName
Role: !Ref Role
elb:
Type: AWS::ElasticLoadBalancing::LoadBalancer
Properties:
LoadBalancerName: !Ref LoadBalancerName
Listeners:
- InstancePort: !Ref AppHostPort
LoadBalancerPort: '80'
Protocol: HTTP
Subnets:
- !Ref Subnet1
DependsOn: GatewayAttachment
VPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 10.0.0.0/24
Subnet1:
Type: AWS::EC2::Subnet
Properties:
VpcId: !Ref VPC
CidrBlock: 10.0.0.0/25
InternetGateway:
Type: AWS::EC2::InternetGateway
GatewayAttachment:
Type: AWS::EC2::VPCGatewayAttachment
Properties:
InternetGatewayId: !Ref InternetGateway
VpcId: !Ref VPC
Role:
Type: AWS::IAM::Role
Properties:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

{
"AWSTemplateFormatVersion": "2010-09-09T00:00:00Z",
"Description": "Creating ECS service",
Expand Down Expand Up @@ -28,6 +29,16 @@
}
},
"Resources": {
"InternetGateway": {
"Type": "AWS::EC2::InternetGateway"
},
"GatewayAttachment": {
"Type": "AWS::EC2::VPCGatewayAttachment",
"Properties": {
"InternetGatewayId": "InternetGateway",
"VpcId": "VPC"
}
},
"Role": {
"Type": "AWS::IAM::Role",
"Properties": {
Expand Down Expand Up @@ -68,12 +79,61 @@
"LoadBalancerName": "elb"
}
],
"PlacementStrategies": [
{
"Type": "binpack",
"Field": "memory"
},
{
"Type": "spread",
"Field": "host"
}
],
"PlacementConstraints": [
{
"Type": "memberOf",
"Expression": "attribute:ecs.availability-zone != us-east-1d"
},
{
"Type": "distinctInstance"
}
],
"ServiceName": "ServiceName",
"Cluster": "cluster",
"DesiredCount": 0,
"HealthCheckGracePeriodSeconds": "HealthCheckGracePeriodSeconds"
}
},
"elb": {
"Type": "AWS::ElasticLoadBalancing::LoadBalancer",
"Properties": {
"Subnets": [
"Subnet1"
],
"LoadBalancerName": "LoadBalancerName",
"Listeners": [
{
"LoadBalancerPort": "80",
"Protocol": "HTTP",
"InstancePort": "AppHostPort"
}
]
},
"DependsOn": "GatewayAttachment"
},
"VPC": {
"Type": "AWS::EC2::VPC",
"Properties": {
"CidrBlock": "10.0.0.0/24"
}
},
"Subnet1": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"CidrBlock": "10.0.0.0/25",
"VpcId": "VPC"
}
},
"taskdefinition": {
"Type": "AWS::ECS::TaskDefinition",
"Properties": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Resources:
TaskDef54694570:
Type: AWS::ECS::TaskDefinition
Properties:
ContainerDefinitions:
- Environment:
- Name: DEPLOYMENT_TIMESTAMP
Value: "2024-08-20T00:41:57.620Z"
Essential: true
HealthCheck:
Command:
- CMD-SHELL
- curl -f http://localhost:3000/health || exit
Interval: 30
Retries: 3
StartPeriod: 30
Timeout: 5
Image:
Fn::Join:
- ""
- - 123456789012.dkr.ecr.us-west-2.
- Ref: AWS::URLSuffix
- /example-nms:latest
ExecutionRoleArn:
Fn::GetAtt:
- TaskDefExecutionRoleB4775C97
- Arn
RequiresCompatibilities:
- EC2
Tags:
- Key: classification
Value: internal
- Key: component
Value: example-nms
- Key: env
Value: development
- Key: owner
Value: example@owner.com
- Key: product
Value: internal_tools
TaskRoleArn:
Fn::GetAtt:
- EcsTaskRole8DFA0181
- Arn
ExampleNameMatchService0992A2E7:
Type: AWS::ECS::Service
Properties:
Cluster: example-ecs
SchedulingStrategy: REPLICA
Tags:
- Key: classification
Value: internal
- Key: component
Value: example-nms
- Key: env
Value: development
- Key: owner
Value: example@owner.com
- Key: product
Value: internal_tools
TaskDefinition:
Ref: TaskDef54694570

This file was deleted.

Loading
Loading