gcp-orgpolicy-modify-public-bucket-guardrail

Remove storage.publicAccessPrevention to allow making Cloud Storage buckets public.

derived gcp emits CanModifyPolicy

match

A conjunctive graph pattern. Variables (?x) bind node ids; every clause must hold.

{'principal': None} CanModifyPolicy {'orgpolicy': None}

where

node_type(?orgpolicy) == OrganizationPolicy ?orgpolicy.constraint == 'constraints/storage.publicAccessPrevention' ?orgpolicy is ENFORCED at/inherited-to ?scope (boolean enforce==true) ?principal has EFFECTIVE orgpolicy.policy.set at ?scope

emit

source typeIdentity
target type*
source?principal
target?orgpolicy
permissionsorgpolicy.policy.set
conditionsguardrail_enforced iam_permission
state logicACTIVE for the CanModifyPolicy when set is unconditional and the constraint is enforced at ?scope. Downstream ExposedToInternet(bucket) upgrade deferred to hierarchy-chains; realizing it further requires storage.buckets.setIamPolicy to actually add allUsers/allAuthenticatedUsers.

Narrative

{principal.name} can remove constraints/storage.publicAccessPrevention at {scope.name}, re-enabling public Cloud Storage buckets in {scope.name}.

Raw rule rules/derived/gcp/orgpolicy.yaml

id: gcp-orgpolicy-modify-public-bucket-guardrail
emits: CanModifyPolicy
description: Remove storage.publicAccessPrevention to allow making Cloud Storage buckets public.
match:
- - principal: null
  - CanModifyPolicy
  - orgpolicy: null
where:
- node_type(?orgpolicy) == OrganizationPolicy
- ?orgpolicy.constraint == 'constraints/storage.publicAccessPrevention'
- ?orgpolicy is ENFORCED at/inherited-to ?scope (boolean enforce==true)
- ?principal has EFFECTIVE orgpolicy.policy.set at ?scope
emit:
  source_type: Identity
  target_type: '*'
  source: ?principal
  target: ?orgpolicy
  permissions:
  - orgpolicy.policy.set
  gates:
  - 'ExposedToInternet(Storage)  # public bucket via allUsers/allAuthenticatedUsers, BLOCKED by GCS research
    while enforced'
  conditions:
  - guardrail_enforced
  - iam_permission
  state_logic: ACTIVE for the CanModifyPolicy when set is unconditional and the constraint is enforced
    at ?scope. Downstream ExposedToInternet(bucket) upgrade deferred to hierarchy-chains; realizing it
    further requires storage.buckets.setIamPolicy to actually add allUsers/allAuthenticatedUsers.
  confidence: min(contributing_confidences)
  derived_from:
  - ?principal CanModifyPolicy ?orgpolicy
  - guardrail-removal-upgrades-blocked (hierarchy-chains.yaml)
  false_positive_note: "publicAccessPrevention only prevents MAKING data public; it grants nothing. Fire\
    \ only when an ExposedToInternet(Storage) edge is BLOCKED by THIS policy. Note publicAccessPrevention\
    \ can also be enforced at the bucket level itself (not only via org policy) \u2014 that bucket-level\
    \ setting is out of scope here; this rule targets the org-policy-enforced case."
  narrative: '{principal.name} can remove constraints/storage.publicAccessPrevention at {scope.name},
    re-enabling public Cloud Storage buckets in {scope.name}.'
move · open · esc close