Check provider logo

Cloud Function is not publicly invocable

cloudfunction_function_not_publicly_accessible

Severityhigh
by Prowler

Cloud Functions deny invocation to allUsers and allAuthenticatedUsers, so only explicitly authorized identities or services can trigger them.

The evaluation reviews each function's IAM policy bindings to confirm no public principals are granted invoker access.

Risk

Publicly invocable Cloud Functions expose business logic to the internet and let any caller trigger execution. This enables unauthorized data access when the function returns sensitive output, code execution in shared environments, and denial-of-wallet attacks driven by uncontrolled invocation costs.

Run this check with Prowler CLI

prowler gcp --checks cloudfunction_function_not_publicly_accessible

Recommendation

Apply least privilege to Cloud Function invocation: grant roles/cloudfunctions.invoker only to specific service accounts or groups.

For externally exposed functions, front them with API Gateway or Cloud Endpoints that enforce authentication and rate limiting.

Remediation

CLI

gcloud functions remove-iam-policy-binding <FUNCTION_NAME> --region=<REGION> --member=<allUsers|allAuthenticatedUsers> --role=roles/cloudfunctions.invoker

Terraform
Other
  1. In Google Cloud Console, go to Cloud Functions
  2. Select the function and open the Permissions tab
  3. Remove any binding with allUsers or allAuthenticatedUsers
  4. Grant invocation rights only to specific service accounts or user groups

Source Code

Resource Type

cloudfunctions.googleapis.com/Function

References

Related To

  • cloudfunction_function_inside_vpc
  • secretmanager_secret_not_publicly_accessible
  • cloudstorage_bucket_public_access