Skip to content

Conversation

@cx-andre-pereira
Copy link
Contributor

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

Reason for Proposed Changes

  • Currently there are no queries addressing the Terraform/gcp "google_logging_metric" and "google_monitoring_alert_policy" resources's "filter" fields. This query is meant to ensure those resources's filters properly check for roles/Owner assignments.

  • Quoting CIS_Google_Cloud_Platform_Foundation_Benchmark_v4.0.0 page 81: "Project ownership has the highest level of privileges on a project. To avoid misuse of project resources, the project ownership assignment/change actions mentioned above should be monitored and alerted to concerned recipients. • Sending project ownership invites • Acceptance/Rejection of project ownership invite by user • Adding role\Owner to a user/service-account • Removing a user/Service account from role\Owner"

  • Additionally page 82 states the specific filter that should be present :

(protoPayload.serviceName="cloudresourcemanager.googleapis.com")
AND (ProjectOwnership OR projectOwnerInvitee)
OR (protoPayload.serviceData.policyDelta.bindingDeltas.action="REMOVE"
AND protoPayload.serviceData.policyDelta.bindingDeltas.role="roles/owner")
OR (protoPayload.serviceData.policyDelta.bindingDeltas.action="ADD"
AND protoPayload.serviceData.policyDelta.bindingDeltas.role="roles/owner")

Proposed Changes

  • Developed an initial implementation for a query that ensures "roles/Owner assignments" are accounted for by a given filter.

  • Based on the audit described by the CIS entry the query will flag if :

    • There is at least one"google_logging_metric" resource in the project and none contain the correct filter
    • There is at least one "google_monitoring_alert_policy" resource in the project and none contain the filter/reference a logging metric that contains the correct filter
    • There is at least one "google_monitoring_alert_policy" resource that contains the filter but none of them declare "notification_channels".

Note: there are currently issues with the search values, i could not get them to point to the "filter" field for either of the target resources in the scan results.

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 31, 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 terraform Terraform query gcp PR related with GCP Cloud azure PR related with Azure Cloud labels Oct 31, 2025
…re_log_metric_filter_and_alerts_exist_for_project_ownership_assignments/changes
@cx-andre-pereira cx-andre-pereira marked this pull request as ready for review October 31, 2025 12:37
@cx-andre-pereira cx-andre-pereira requested a review from a team as a code owner October 31, 2025 12:37
@github-actions github-actions bot removed the azure PR related with Azure Cloud label Oct 31, 2025
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.

1 participant