Skip to content

bug: rds/rds_databases_and_clusters_should_not_use_a_database_engine_default_port.sql db_instance_default port always has been zero #13771

@sabe6

Description

@sabe6

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

RDS.23 control.

db_instance_default_port value always seems to be zero. INFO: aws/aws-sdk-java#924
So I would like to switch its reference.

Expected Behavior

Patch it works:

diff --git a/plugins/source/aws/policies/queries/rds/rds_databases_and_clusters_should_not_use_a_database_engine_default_port.sql b/plugins/source/aws/policies/queries/rds/rds_databases_and_clusters_should_not_use_a_database_engine_default_port.sql
index 7d2e8117d..6d275611b 100644
--- a/plugins/source/aws/policies/queries/rds/rds_databases_and_clusters_should_not_use_a_database_engine_default_port.sql
+++ b/plugins/source/aws/policies/queries/rds/rds_databases_and_clusters_should_not_use_a_database_engine_default_port.sql
@@ -24,11 +24,11 @@ union
     case when
                  (
                              engine in ( 'aurora', 'aurora-mysql', 'mariadb', 'mysql' )
-                         and db_instance_port = 3306
+                         and (endpoint ->> 'Port')::integer = 3306
                      )
-                 or (engine like '%postgres%' and db_instance_port = 5432)
-                 or (engine like '%oracle%' and db_instance_port = 1521)
-                 or (engine like '%sqlserver%' and db_instance_port = 1433)
+                 or (engine like '%postgres%' and (endpoint ->> 'Port')::integer = 5432)
+                 or (engine like '%oracle%' and (endpoint ->> 'Port')::integer = 1521)
+                 or (engine like '%sqlserver%' and (endpoint ->> 'Port')::integer = 1433)
     then 'fail' else 'pass' end as status
     from aws_rds_instances
 )

CloudQuery (redacted) config

N/A

Steps To Reproduce

No response

CloudQuery (redacted) logs

N/A

CloudQuery version

main

Additional Context

No response

Pull request (optional)

  • I can submit a pull request

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions