PRACTITIONER GUIDE | CLOUD SECURITY
Practitioner GuideUpdated 12 min read

GCP Organization Policies for Security Enforcement: How to Block Dangerous Configurations Across All Projects Without Breaking Developer Workflows

storage.publicAccessPrevention
is the single highest-impact GCP org policy constraint -- prevents all public GCS bucket exposure at the organization level
3
resource hierarchy levels where Organization Policies can be applied: organization, folder, and project
Enforced
boolean constraint state that blocks the restricted action -- contrast with 'Not Enforced' which provides no protection
30+
predefined organization policy constraints available in GCP covering compute, storage, networking, IAM, and data protection

SponsoredRetool

Retool's new app builder is where AI-generated code ships safely

Building apps with AI is easy. Getting them to production safely is another story.

Start building for free today

GCP Organization Policies are the enforcement layer below IAM. Where IAM controls who can act, Organization Policies control what can exist. A developer with Project Editor rights can create a GCS bucket with allUsers read access, disable audit logging, or assign a public IP to a VM unless an Organization Policy prevents it. This guide covers the most impactful constraints for a security baseline, how to apply them without disrupting existing workloads, and how to structure the resource hierarchy for multi-team environments.

How GCP Organization Policy Inheritance Works

Organization Policies follow the GCP resource hierarchy: Organization > Folder > Project. A policy applied at the organization level inherits down through all folders and projects unless explicitly overridden at a lower level. Inheritance can be modified in two ways:

Merge: Policies at lower levels are merged with inherited policies. Useful for list constraints where a child scope needs additional entries beyond the parent.

Replace: The child policy replaces the inherited policy entirely. Use this when a specific project needs different constraints (e.g., a security research sandbox that needs capabilities blocked at the org level).

For security enforcement, the recommended pattern is:

  • Apply non-negotiable controls at the organization level with no child-level overrides permitted
  • Structure folder hierarchy to separate production, non-production, and sandbox environments
  • Apply additional constraints at the production folder level
  • Allow sandbox projects to override select constraints for experimentation

The compute.restrictPublicIP constraint at the organization level will block public IP assignment for every VM in every project. If your non-production teams need public IPs for testing, apply this constraint only at the production folder, not the organization level.

The Seven Highest-Impact GCP Organization Policy Constraints

Start with these seven constraints for immediate security impact:

1. storage.publicAccessPrevention (Enforced) Prevents GCS buckets from being configured with allUsers or allAuthenticatedUsers access, regardless of bucket IAM settings. This is the single most impactful constraint for preventing accidental data exposure. Apply at organization level.

2. compute.skipDefaultNetworkCreation (Enforced) Prevents the creation of the default VPC network in new projects. The default VPC has pre-configured firewall rules that allow unrestricted SSH and RDP ingress. Blocking default VPC creation forces teams to create explicitly configured networks.

3. compute.restrictPublicIP (Denied for all) Blocks assignment of external IP addresses to VM instances. Apply at the production folder. Teams that need public endpoints should use load balancers with Cloud Armor, not direct VM public IPs.

4. iam.disableServiceAccountKeyCreation (Enforced) Prevents creation of user-managed service account keys. Service account keys are a significant credential leak risk. Workloads should use Workload Identity Federation or attached service accounts instead. Apply at organization level with a documented exception process for legacy integrations.

5. iam.disableWorkloadIdentityClusterCreation Not the constraint you want to block, but the opposite: enforce iam.workloadIdentityConfig on GKE clusters. Apply via a custom constraint if your organization uses GKE.

6. gcp.resourceLocations (in: [us-locations] or specific region list) Restricts resource creation to approved geographic regions. Critical for data residency compliance (GDPR, data sovereignty requirements). Apply at the organization level with folder-level overrides for teams with approved multi-region workloads.

7. compute.requireShieldedVm (Enforced) Requires all new VM instances to use Shielded VM features (Secure Boot, vTPM, Integrity Monitoring). Reduces firmware-level attack surface. Apply at the production folder level.

Free daily briefing

Briefings like this, every morning before 9am.

Threat intel, active CVEs, and campaign alerts, distilled for practitioners. 50,000+ subscribers. No noise.

Applying Constraints via gcloud Without Breaking Existing Resources

Organization Policy constraints apply to resource creation and modification actions. They do NOT retroactively affect existing resources. A bucket that already has allUsers access will not become private when you enable storage.publicAccessPrevention. However, any attempt to create a new bucket with public access or modify an existing bucket to add public access will be blocked.

To apply a constraint at the organization level:

# Get your organization ID
gcloud organizations list

# Enable storage.publicAccessPrevention at org level
gcloud resource-manager org-policies enable-enforce \
    storage.publicAccessPrevention \
    --organization=YOUR_ORG_ID

# Verify the policy is applied
gcloud resource-manager org-policies describe \
    storage.publicAccessPrevention \
    --organization=YOUR_ORG_ID

For list constraints (like gcp.resourceLocations), you must set allowed values:

gcloud resource-manager org-policies set-policy \
    --organization=YOUR_ORG_ID \
    /tmp/resource-locations-policy.yaml

Where the policy YAML contains:

constraint: constraints/gcp.resourceLocations
listPolicy:
  allowedValues:
    - in:us-locations
    - in:europe-locations

Before applying any new constraint, audit existing resources for non-compliance:

# Find all GCS buckets with public access before applying the constraint
gcloud asset search-all-resources \
    --scope=organizations/YOUR_ORG_ID \
    --asset-types=storage.googleapis.com/Bucket \
    --query="iamPolicy.bindings.members:allUsers" \
    --format="table(name, location)"

Address existing non-compliant resources before applying the Deny constraint, or they will persist in a non-compliant state that cannot be updated without fixing the configuration first.

Custom Organization Policy Constraints

GCP supports custom organization policy constraints that evaluate conditions on resource properties not covered by predefined constraints. Custom constraints are written in CEL (Common Expression Language) and can enforce fine-grained configuration requirements.

Example: Require all Cloud SQL instances to have automated backups enabled:

name: organizations/YOUR_ORG_ID/customConstraints/custom.sqlBackupEnabled
resourceTypes:
  - sqladmin.googleapis.com/Instance
methodTypes:
  - CREATE
  - UPDATE
condition: "resource.settings.backupConfiguration.enabled == true"
actionType: ALLOW
displayName: "Require Cloud SQL automated backup"
description: "All Cloud SQL instances must have automated backup enabled."

Create the custom constraint:

gcloud org-policies set-custom-constraint /tmp/sql-backup-constraint.yaml

Then create an organization policy that enforces it:

gcloud resource-manager org-policies set-policy \
    --organization=YOUR_ORG_ID \
    /tmp/sql-backup-policy.yaml

Custom constraints are available for Compute Engine, GKE, Cloud Run, Cloud SQL, Bigtable, and several other services. Check the custom constraint documentation for supported resource types before writing a constraint for an unsupported service.

Testing Organization Policies in a Sandbox Before Org-Wide Enforcement

Always test new organization policy constraints in a sandbox folder before applying them at the organization level. The pattern:

Step 1: Create a test folder and project

gcloud resource-manager folders create \
    --display-name="Policy Testing Sandbox" \
    --organization=YOUR_ORG_ID

gcloud projects create policy-test-project-$(date +%Y%m) \
    --folder=SANDBOX_FOLDER_ID

Step 2: Apply the constraint to the test folder only

gcloud resource-manager org-policies enable-enforce \
    storage.publicAccessPrevention \
    --folder=SANDBOX_FOLDER_ID

Step 3: Attempt to create a non-compliant resource and verify it is blocked

# Attempt to create a bucket with public access (should be blocked)
gsutil mb gs://test-public-bucket-$(date +%s)
gsutil iam ch allUsers:objectViewer gs://test-public-bucket-$(date +%s)
# Expected: AccessDeniedException due to org policy

Step 4: Verify compliant resource creation still works

# Create a bucket without public access (should succeed)
gsutil mb gs://test-private-bucket-$(date +%s)
# Expected: success

Step 5: Roll out to production folder, then organization After testing confirms the constraint blocks non-compliant actions without affecting compliant workflows, apply to the production folder, monitor for 2 weeks, then apply at the organization level.

For iam.disableServiceAccountKeyCreation, the testing phase is especially important. Teams may have CI/CD pipelines or legacy integrations that create service account keys programmatically. Identify and migrate these before enforcing the constraint organization-wide.

The bottom line

GCP Organization Policies are the guardrail layer that IAM cannot provide. Start with storage.publicAccessPrevention and iam.disableServiceAccountKeyCreation at the organization level, test in a sandbox folder first, audit existing non-compliant resources before applying constraints, and structure your folder hierarchy so that sandbox and non-production environments can have appropriate overrides without weakening production security.

Frequently asked questions

Can a project owner or organization admin override an Organization Policy constraint?

A project owner cannot override an Organization Policy constraint set at a higher level (folder or organization). Only identities with the Organization Policy Administrator role (roles/orgpolicy.policyAdmin) at the scope where the constraint was applied can modify or override it. This is the key security property: workload team members with project-level permissions cannot bypass organization-level guardrails.

What happens to existing resources that violate a newly applied Organization Policy?

Existing resources are not affected retroactively. A GCS bucket with allUsers access will remain public after `storage.publicAccessPrevention` is applied. The constraint only prevents new resources from being created in a non-compliant state and prevents existing resources from being modified to add a non-compliant configuration. To remediate existing violations, use Security Command Center findings or run a manual audit with gcloud asset commands, then fix each resource individually.

How does GCP Organization Policy compare to AWS SCPs?

Both services enforce configuration guardrails regardless of IAM/role permissions. Key differences: AWS SCPs operate on IAM actions (denying specific API calls), while GCP Organization Policies operate on resource configurations (blocking non-compliant resource states). AWS SCPs are applied at the OU level in AWS Organizations; GCP Organization Policies apply at org, folder, or project level. GCP's custom constraints offer more granular resource property evaluation via CEL, while AWS SCPs are primarily API action-based with condition keys.

How do I enforce Organization Policies on GKE workloads?

GKE-specific controls require a combination of Organization Policies and GKE-level admission controllers. Organization Policy constraints like `container.restrictNodesToApprovedNetworks` or custom constraints on cluster properties handle cluster configuration. Workload-level controls (no privileged containers, no hostPath volumes) require a GKE Policy Controller (based on Open Policy Agent Gatekeeper) deployed to the cluster. The Security Command Center GKE module can audit both cluster-level and workload-level configurations against CIS GKE benchmarks.

What GCP Organization Policy constraints should every organization enable on day one?

The highest-priority constraints for immediate enforcement are: constraints/iam.disableServiceAccountKeyCreation (prevent downloadable service account keys), constraints/compute.skipDefaultNetworkCreation (prevent automatic default VPC with overly permissive firewall rules), constraints/iam.allowedPolicyMemberDomains (restrict IAM bindings to your organization's identity domains only), and constraints/storage.uniformBucketLevelAccess (enforce uniform bucket-level access on all GCS buckets). These four constraints together block the most common misconfiguration paths that lead to publicly exposed data or credential theft, without disrupting most normal developer workflows.

How do I audit existing GCP resources for organization policy violations?

Use the GCP Asset Inventory API with policy analyzer: run gcloud asset analyze-org-policy --scope=organizations/ORG_ID --constraint=constraints/CONSTRAINT_NAME to see which resources are compliant or non-compliant with a specific constraint. For a broader compliance view, enable Policy Intelligence and review the Organization Policy page in the Google Cloud Console, which shows compliance status per constraint across all projects. For existing violations of new constraints you are about to enforce, the constraint's Analysis tab shows the impact before you enable enforcement. After enabling a constraint, use Cloud Asset Inventory with export to BigQuery to query resource configurations across all projects and identify any resources that were grandfathered in before the constraint was enforced.

Sources & references

  1. Google Cloud: Organization Policy overview
  2. Google Cloud: Predefined organization policy constraints
  3. Google Cloud: Best practices for using organization policies
  4. CIS Google Cloud Platform Foundation Benchmark

Free resources

25
Free download

Critical CVE Reference Card 2025–2026

25 actively exploited vulnerabilities with CVSS scores, exploit status, and patch availability. Print it, pin it, share it with your SOC team.

No spam. Unsubscribe anytime.

Free download

Ransomware Incident Response Playbook

Step-by-step 24-hour IR checklist covering detection, containment, eradication, and recovery. Built for SOC teams, IR leads, and CISOs.

No spam. Unsubscribe anytime.

Free newsletter

Get threat intel before your inbox does.

50,000+ security professionals read Decryption Digest for early warnings on zero-days, ransomware, and nation-state campaigns. Free, daily, no spam.

Unsubscribe anytime. We never sell your data.

Eric Bang
Author

Founder & Cybersecurity Evangelist, Decryption Digest

Cybersecurity professional with expertise in threat intelligence, vulnerability research, and enterprise security. Covers zero-days, ransomware, and nation-state operations for 50,000+ security professionals every morning.

Black Hat Giveaway

Win a $2,495 Black Hat pass.

Full-access to Black Hat USA 2026 in Las Vegas. Subscribe free to enter.

Joins Decryption Digest daily briefing. Unsubscribe anytime.

Giveaway: Black Hat USA 2026 Full-Access Pass ($2,495 value)

Details →
Daily Briefing

Subscribe to enter the giveaway

Every subscriber is automatically entered. You also get daily threat intel every morning: zero-days, ransomware, and nation-state campaigns. Free. No spam.

Already subscribed? You're already entered.

Giveaway

Win a $2,495 Black Hat USA 2026 pass.