Repository: bridgecrewio/checkov

Issue:
OCI Security Group Control Problem
**Describe the issue**
AbsSecurtiGroupUnrestictedIngress  The function needs to control "destination_port_range" instead of "source_port_range"

[Codo Block](https://github.com/bridgecrewio/checkov/blob/b13dd31e10b84b7e4ce87d1d80c9d7d54b404742/checkov/terraform/checks/resource/oci/AbsSecurityGroupUnrestrictedIngress.py#L33-L36)

**Examples**

**Version (please complete the following information):**
 - Checkov Version 2.2.86



Discussion:

Resolving patch:
diff --git a/checkov/terraform/checks/resource/oci/AbsSecurityGroupUnrestrictedIngress.py b/checkov/terraform/checks/resource/oci/AbsSecurityGroupUnrestrictedIngress.py
--- a/checkov/terraform/checks/resource/oci/AbsSecurityGroupUnrestrictedIngress.py
+++ b/checkov/terraform/checks/resource/oci/AbsSecurityGroupUnrestrictedIngress.py
@@ -30,10 +30,10 @@ def scan_resource_conf(self, conf):
 
     def scan_protocol_conf(self, protocol_name):
         """ scan tcp_options configuration"""
-        if 'source_port_range' not in protocol_name[0]:
+        if 'destination_port_range' not in protocol_name[0]:
             return False
-        max_port = force_int(protocol_name[0]['source_port_range'][0]['max'][0])
-        min_port = force_int(protocol_name[0]['source_port_range'][0]['min'][0])
+        max_port = force_int(protocol_name[0]['destination_port_range'][0]['max'][0])
+        min_port = force_int(protocol_name[0]['destination_port_range'][0]['min'][0])
         if max_port and min_port and min_port <= self.port <= max_port:
             return False
         return True


Test patch:
diff --git a/tests/terraform/checks/resource/oci/example_SecurityGroupUnrestrictedIngress22/main.tf b/tests/terraform/checks/resource/oci/example_SecurityGroupUnrestrictedIngress22/main.tf
--- a/tests/terraform/checks/resource/oci/example_SecurityGroupUnrestrictedIngress22/main.tf
+++ b/tests/terraform/checks/resource/oci/example_SecurityGroupUnrestrictedIngress22/main.tf
@@ -6,7 +6,7 @@ resource "oci_core_network_security_group_security_rule" "pass" {
     source = "0.0.0.0/0"
 
     tcp_options {
-        source_port_range {
+        destination_port_range {
             max = 22
             min = 22
         }
@@ -28,7 +28,7 @@ resource "oci_core_network_security_group_security_rule" "pass2" {
     source_type = "CIDR_BLOCK"
 
     tcp_options {
-        source_port_range {
+        destination_port_range {
             max = 25
             min = 25
         }
@@ -43,7 +43,7 @@ resource "oci_core_network_security_group_security_rule" "pass3" {
     source_type = "CIDR_BLOCK"
 
     tcp_options {
-        source_port_range {
+        destination_port_range {
             max = 21
             min = 1
         }
@@ -59,7 +59,7 @@ resource "oci_core_network_security_group_security_rule" "fail" {
     source_type = "CIDR_BLOCK"
 
     tcp_options {
-        source_port_range {
+        destination_port_range {
             max = 22
             min = 22
         }
@@ -74,7 +74,7 @@ resource "oci_core_network_security_group_security_rule" "fail1" {
     source_type = "CIDR_BLOCK"
 
     tcp_options {
-        source_port_range {
+        destination_port_range {
             max = 25
             min = 21
         }
@@ -103,4 +103,4 @@ resource "oci_core_network_security_group_security_rule" "fail3" {
             min = 21
         }
     }
-}
\ No newline at end of file
+}