GCP_HAS_ROLE
Summary
Description
Identification
gcloud CLI
# List all roles granted to a specific user at project level
PROJECT_ID="my-project"
USER_EMAIL="[email protected]"
gcloud projects get-iam-policy $PROJECT_ID --format=json | \
jq --arg user "user:$USER_EMAIL" '.bindings[] | select(.members[] | contains($user)) | .role'
# List all roles granted to a specific service account
SA_EMAIL="[email protected]"
gcloud projects get-iam-policy $PROJECT_ID --format=json | \
jq --arg sa "serviceAccount:$SA_EMAIL" '.bindings[] | select(.members[] | contains($sa)) | .role'
# List all direct bindings for a principal across org, folder, and project scope
ORG_ID=$(gcloud organizations list --format="value(name)" | head -1)
echo "=== Org level ===" && gcloud organizations get-iam-policy $ORG_ID --format=json | \
jq --arg user "user:$USER_EMAIL" '[.bindings[] | select(.members[] | contains($user)) | .role]'
echo "=== Project level ===" && gcloud projects get-iam-policy $PROJECT_ID --format=json | \
jq --arg user "user:$USER_EMAIL" '[.bindings[] | select(.members[] | contains($user)) | .role]'GCP Console
Exploitation
Mitigation
Detection
Log Type
Method
Key Fields
References
Last updated
Was this helpful?