Skip to content

Conversation

@cx-andre-pereira
Copy link
Contributor

@cx-andre-pereira cx-andre-pereira commented Oct 23, 2025

Reason for Proposed Changes

  • Currently there is no query to ensure that a "google_sql_database_instance" resource with a "SQLSERVER" based "database_version" has the 'contained database authentication' flag set to "off".

  • Quoting CIS_Google_Cloud_Platform_Foundation_Benchmark_v4.0.0 page 262: "When contained databases are enabled, database users with the ALTER ANY USER permission, such as members of the db_owner and db_accessadmin database roles, can grant access to databases and by doing so, grant access to the instance of SQL Server. This means that control over access to the server is no longer limited to members of the sysadmin and securityadmin fixed server role, and logins with the server level CONTROL SERVER and ALTER ANY LOGIN permission. It is recommended to set contained database authentication database flag for Cloud SQL on the SQL Server instance to off.

Proposed Changes

  • Implemented the missing query.
  • The query will flag for a specific instance : (after ensuring "database_version" is SQLSERVER based (possible values list))
    • Setting the "contained database authentication" flag to a value that is not "off" (default value is off)

Tenable reference

I submit this contribution under the Apache-2.0 license.

@github-actions github-actions bot added feature New feature query New query feature labels Oct 23, 2025
@github-actions
Copy link
Contributor

kics-logo

KICS version: v2.1.13

Category Results
CRITICAL CRITICAL 0
HIGH HIGH 0
MEDIUM MEDIUM 0
LOW LOW 0
INFO INFO 0
TRACE TRACE 0
TOTAL TOTAL 0
Metric Values
Files scanned placeholder 1
Files parsed placeholder 1
Files failed to scan placeholder 0
Total executed queries placeholder 47
Queries failed to execute placeholder 0
Execution time placeholder 0

@github-actions github-actions bot added the terraform Terraform query label Oct 23, 2025
@cx-andre-pereira cx-andre-pereira marked this pull request as ready for review October 23, 2025 10:46
@cx-andre-pereira cx-andre-pereira requested a review from a team as a code owner October 23, 2025 10:46
…16636_23_6.3.7_ensure_'contained_database_authentication'_flag_is_NOT_set_to_on
…cation'_flag_is_NOT_set_to_on' of https://github.com/Checkmarx/kics into AST-116636_23_6.3.7_ensure_'contained_database_authentication'_flag_is_NOT_set_to_on
Copy link
Contributor

@cx-artur-ribeiro cx-artur-ribeiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just quality of life changes.
AppSec will review these queries so it's not the most critical issue, but let me know what you think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature query New query feature terraform Terraform query

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants