> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/iam/appsec-gcp-49.md).

# GCP IAM primitive roles are in use misconfiguration detected in code

## Rule Details

|                        |                                      |
| ---------------------- | ------------------------------------ |
| Cortex AppSec Rule ID  | APPSEC\_GCP\_49                      |
| Category - Subcategory | IAM - Overly Permissive              |
| Provider               | GCP                                  |
| Severity               | LOW                                  |
| Framework              | Terraform, Terraform Plan            |
| Mapped CSPM/KSPM Rule  | c33b4710-0874-4a42-a7bc-63884c67b859 |

## Impact

The IAM role is an identity with specific permissions. An IAM role is similar to an IAM user: it has a Google identity with permission policies that determine what the identity can and cannot do in Google Cloud. Certain IAM roles contain permissions that enable a user with the role to impersonate or manage service accounts in a GCP project through IAM inheritance from a higher resource, i.e., project binding.

We recommend you do not set IAM role bindings with known dangerous roles that enable impersonation at the project level. The following roles enable identities to impersonate all service account identities within a project if the identity is granted the role at the project, folder, or organization level.

The following list includes our current recommendations for dangerous roles, however, it is not exhaustive as permissions and roles change frequently.

*Primitive Roles*:

* roles/owner
* roles/editor

*Predefined Roles*:

* roles/iam.securityAdmin
* roles/iam.serviceAccountAdmin
* roles/iam.serviceAccountKeyAdmin
* roles/iam.serviceAccountUser
* roles/iam.serviceAccountTokenCreator
* roles/iam.workloadIdentityUser
* roles/dataproc.editor
* roles/dataproc.admin
* roles/dataflow\.developer
* roles/resourcemanager.folderAdmin
* roles/resourcemanager.folderIamAdmin
* roles/resourcemanager.projectIamAdmin
* roles/resourcemanager.organizationAdmin
* roles/cloudasset.viewer
* roles/cloudasset.owner

*Service Agent Roles*:

Service agent roles should not be used for any identities other than the Google managed service account they are associated with.

* roles/serverless.serviceAgent
* roles/dataproc.serviceAgent

## How to Fix

*Resource:* google\_project\_iam\_member google\_project\_iam\_binding

* *Arguments:* role \[source,go]

***

resource "google\_project\_iam\_member" "example" { project = "project/1234567"

* role = member = "user:<test@example-project.iam.gserviceaccount.com>" }

***

resource "google\_project\_iam\_binding" "example" { project = "project/1234567"

* role = members = \[ "user:<test@example-project.iam.gserviceaccount.com>", ] }

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/iam/appsec-gcp-49.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
