Skip to content

feat(query): implemented 'ensure critical contacts is configured for organization' query for terraform/gcp#7841

Merged
cx-ricardo-jesus merged 9 commits into
masterfrom
AST-116615
Dec 3, 2025
Merged

feat(query): implemented 'ensure critical contacts is configured for organization' query for terraform/gcp#7841
cx-ricardo-jesus merged 9 commits into
masterfrom
AST-116615

Conversation

@cx-ricardo-jesus

Copy link
Copy Markdown
Contributor

Reason for Proposed Changes

  • Currently, no query for Terraform/GCP ensures that the essential contacts are configured for an organization.

Proposed Changes

  • On this query there is only one policy, that uses the contacts_not_configured_for_org helper function.
  • The helper function uses other two helper functions called is_at_organization_level and all_in_list and returns true if the field parent is defined in a certain way that indicates that the resource is on a organization level and if the field notification_category_subscriptions does not have the value ALL defined or all the following values defined: LEGAL, SECURITY, SUSPENSION and TECHNICAL. These are the value that have to be defined to ensure that the essential contacts are configured, according to the respective CIS Workbeck documentation.
  • The helper function check's if the field parent points to an organization using two different notations. The first one is RESOURCE_TYPE/RESOURCE_ID with the RESOURCE_TYPE that can be defined with the values projects, folders, or organizations, defined with the value organization, in order to stay in the scope of the query. This information was found on the following Google Cloud documentation.
  • After further research, I found other way of defining this field that is by, pointing to a data source of type google_organization using the name defined for the data source, which, in all the examples that I found on my research, with the following syntax: data.<DATA_SOURCE_TYPE>.<DATA_SOURCE_NAME>.(id|org|name|...).
  • On the metadata of the query, I think that the most suitable CWE is the one with the number 862 - Missing Authorization.

I submit this contribution under the Apache-2.0 license.

@cx-ricardo-jesus cx-ricardo-jesus requested a review from a team as a code owner November 10, 2025 22:13
@github-actions github-actions Bot added feature New feature query New query feature terraform Terraform query gcp PR related with GCP Cloud labels Nov 10, 2025
@github-actions

Copy link
Copy Markdown
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

@cx-eduardo-semanas

Copy link
Copy Markdown
Contributor

You should update the assets/similarityID_transition/terraform_gcp.yaml file with a new entry corresponding to this query with change: 2

@cx-eduardo-semanas cx-eduardo-semanas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@cx-eduardo-semanas cx-eduardo-semanas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@cx-ricardo-jesus cx-ricardo-jesus merged commit 08d60b3 into master Dec 3, 2025
28 checks passed
@cx-ricardo-jesus cx-ricardo-jesus deleted the AST-116615 branch December 3, 2025 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature gcp PR related with GCP Cloud query New query feature terraform Terraform query

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants