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.
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
gcloud functions remove-iam-policy-binding <FUNCTION_NAME> --region=<REGION> --member=<allUsers|allAuthenticatedUsers> --role=roles/cloudfunctions.invoker
- In Google Cloud Console, go to Cloud Functions
- Select the function and open the Permissions tab
- Remove any binding with allUsers or allAuthenticatedUsers
- 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