gcp-orgpolicy-modify-sql-public-ip-guardrail
Remove sql.restrictPublicIp to allow Cloud SQL instances to get a public IP.
match
A conjunctive graph pattern. Variables (?x) bind node ids; every clause must hold.
where
node_type(?orgpolicy) ==
OrganizationPolicy
?orgpolicy.constraint == 'constraints/sql.restrictPublicIp'
?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 |
| conditions | guardrail_enforced iam_permission |
| state logic | ACTIVE for the CanModifyPolicy when set is unconditional and the constraint is enforced at ?scope. Downstream Cloud SQL public-IP exposure upgrade deferred to hierarchy-chains; realizing it further requires cloudsql.instances.update to actually enable the public IP. |
Narrative
{principal.name} can remove constraints/sql.restrictPublicIp at {scope.name}, re-enabling public IPs on Cloud SQL instances in {scope.name}.
Raw rule rules/derived/gcp/orgpolicy.yaml
id: gcp-orgpolicy-modify-sql-public-ip-guardrail
emits: CanModifyPolicy
description: Remove sql.restrictPublicIp to allow Cloud SQL instances to get a public IP.
match:
- - principal: null
- CanModifyPolicy
- orgpolicy: null
where:
- node_type(?orgpolicy) == OrganizationPolicy
- ?orgpolicy.constraint == 'constraints/sql.restrictPublicIp'
- ?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 # Cloud SQL public IP, BLOCKED by Cloud SQL 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 Cloud SQL public-IP exposure upgrade deferred to hierarchy-chains; realizing
it further requires cloudsql.instances.update to actually enable the public IP.
confidence: min(contributing_confidences)
derived_from:
- ?principal CanModifyPolicy ?orgpolicy
- guardrail-removal-upgrades-blocked (hierarchy-chains.yaml)
false_positive_note: Gates public-IP ENABLEMENT on Cloud SQL, not existing exposure. Fire only when
a Cloud SQL ExposedToInternet edge is BLOCKED by THIS policy.
narrative: '{principal.name} can remove constraints/sql.restrictPublicIp at {scope.name}, re-enabling
public IPs on Cloud SQL instances in {scope.name}.'