Skip to content

LearnCloud

GCP organization policy and IAM review

Brief

Organization policy constraints are the guardrails every project inherits, such as no service account keys, no outside domains in IAM and no public IPs, and a project or folder that overrides one steps outside it. The review reads which constraints are set, where they are relaxed, who already got through before they existed, and who holds roles high enough to change them.

Track
Cloud
Stage
Escalation
Reviewed
On this page
  1. Check first
  2. GCP
  3. The defender sees
  4. Done when
  5. Not covered
  6. Tools
  7. Related research
  8. Where this page fits
  9. Reviewed

All commands

Situation
A read-only review identity at the organization with Organization Policy Viewer, Organization Viewer, Folder Viewer, Security Reviewer and Cloud Asset Viewer. Every command on this page is a read: we never set, reset or delete a policy, never change an IAM binding, and we review only the organization the scope letter names.
Goal
A guardrail map: each expected constraint marked set, missing or overridden, every folder and project that relaxes one, every existing grant the constraints would now block, and every principal with organization or folder-level power.
Outputs
Representative examples on placeholder hosts, trimmed to the lines that matter. Not captured from a public fixture yet.

Check first

  • The organization id and the client's folder layout, from their own records.
  • The guardrails the client believes it has, written down before we read anything.
  • Whether the organization was created from May 2024, when Google began enforcing some of these constraints on new organizations by default.
  • The client's Workspace or Cloud Identity customer id, which domain restricted sharing names.
  • Whether Data Access audit logs are on for Resource Manager and Cloud Asset, which decides whether our reads are recorded.

Steps

GCP

Which organization policy constraints are set at the top?

gcloud org-policies list --organization=123456789012 --format='value(name)'

Expected output

organizations/123456789012/policies/iam.disableServiceAccountKeyCreation
organizations/123456789012/policies/storage.uniformBucketLevelAccess   # <- two of the four; nothing restricts outside domains or public IPs

We look for four constraints first. iam.allowedPolicyMemberDomains (domain restricted sharing) stops IAM grants to accounts outside the client's domains. iam.disableServiceAccountKeyCreation stops long-lived keys. compute.vmExternalIpAccess limits which VMs get a public IP. storage.uniformBucketLevelAccess turns off per-object ACLs. Adding --show-unset lists every constraint with no policy, which is the list of what is missing. Newer managed constraints, such as iam.managed.disableServiceAccountKeyCreation, count as set too.

Negative result. All four set at the organization, with iam.allowedPolicyMemberDomains naming only the client's own customer ids, and storage.publicAccessPrevention enforced beside them.

Fix. Set the four at the organization node, test each in a sandbox folder first, and keep the policies in infrastructure code so a change is reviewed.

Which folders and projects override the organization?

for p in $(gcloud projects list --format='value(projectId)'); do
  gcloud org-policies list --project="$p" --format='value(name)'
done
gcloud org-policies describe iam.disableServiceAccountKeyCreation --project=legacy-batch-01

Expected output

projects/987654321098/policies/iam.disableServiceAccountKeyCreation
name: projects/987654321098/policies/iam.disableServiceAccountKeyCreation
spec:
  rules:
  - enforce: false   # <- this project turned key creation back on

A policy set lower in the hierarchy replaces the inherited one, so a project with enforce: false, reset: true or inheritFromParent: false sits outside the guardrail while the organization still shows it as set. We run the same loop with --folder for each folder. Projects billed to the client's billing account but created outside the organization escape every constraint, so we compare gcloud billing projects list for each billing account with the organization's project list.

Negative result. No project or folder relaxes a baseline constraint, or each exception has a named owner, a reason and an end date.

Fix. Remove overrides nobody can explain, move projects that need an exception into one folder with its own reviewed policy, and bring stray billed projects into the organization.

Which grants were already made before the guardrails?

for q in 'policy:allUsers' 'policy:allAuthenticatedUsers' 'policy:gmail.com'; do
  gcloud asset search-all-iam-policies --scope=organizations/123456789012 --query="$q" --format='value(resource)'
done

Expected output

//storage.googleapis.com/legacy-batch-exports
//cloudresourcemanager.googleapis.com/projects/legacy-batch-01   # <- a consumer Gmail account holds a role on a project

Domain restricted sharing blocks new grants; it does not remove the ones made before it was set. Cloud Asset searches every IAM policy in the organization at once, so this finds the public members and personal accounts that the constraint would refuse today but still lets in. We record the resource and role, not the person behind the account.

Negative result. No resource in the organization grants allUsers, allAuthenticatedUsers or an account outside the client's domains.

Fix. Remove the grants, then confirm with the same search, and alert on SetIamPolicy calls that add a member outside the client's domains.

Who holds roles at the organization and folder level?

gcloud organizations get-iam-policy 123456789012 \
  --flatten='bindings[].members' --format='table[no-heading](bindings.role, bindings.members)' \
  | grep -iE 'owner|admin|tokenCreator|serviceAccountUser'

Expected output

roles/resourcemanager.organizationAdmin  group:gcp-org-admins@example.com
roles/orgpolicy.policyAdmin              group:platform-eng@example.com
roles/owner                              user:contractor-07@example.com   # <- basic Owner at the top: owner of every project below
roles/iam.serviceAccountTokenCreator     serviceAccount:ci-deploy@build-prod.iam.gserviceaccount.com

A role granted at the organization applies to every folder and project below it. Organization Policy Administrator can relax every constraint on this page, and Token Creator at the top can act as any service account in any project. We run the same read on each folder with gcloud resource-manager folders get-iam-policy.

Negative result. Organization-level roles held by a few groups, no basic roles at the top, and no service account holding roles it could use to act as others everywhere.

Fix. Grant organization-level roles to small groups only, remove basic roles there, and move service account roles down to the projects that need them. The AWS Organizations review is the same exercise for SCPs.

The defender sees

Every change we did not make is in the Admin Activity audit log, always on and free: UpdatePolicy and CreatePolicy from orgpolicy.googleapis.com, and SetIamPolicy on the organization, folders and projects. Those should alert, and an override like the one above has a creation event with a name on it. Our reads are Data Access events, which are off by default for most services, so the client may find no trace of the review unless Data Access logs are on for Resource Manager and Cloud Asset. If the client cannot say who relaxed a constraint, that gap is a finding of its own.

Done when

The four baseline constraints are each marked set or missing at the organization, every project and folder policy that overrides one is listed, external and public IAM members are counted, and every organization-level role holder is recorded.

Not covered

Escalation inside one project (see the GCP project first hour), VPC Service Controls, custom constraints in depth and billing account permissions; the outputs shown are representative examples on a placeholder organization, not captured runs.