Google Cloud Run Function — Overview
Qualys Container Security supports scanning of Google Cloud Functions and Cloud Run services. You deploy the Qualys Cloud Operator and supporting resources using Terraform, which discovers and scans workloads across one or more Google Cloud Platform (GCP) projects.
Deployment Architecture
The deployment uses a two-project model.
- The Service Project hosts the Qualys Cloud Operator, Pub/Sub topics, Firestore, and audit log processing.
- Each Target Project contains a Cloud Logging sink and the IAM permissions required for scanning.
One Service Project can scan multiple Target Projects.
Prerequisites
GCP Requirements
You must have a designated Service Project and one or more Target Projects. The following resources are created in the Service Project during deployment.
- Cloud Run services
- Pub/Sub topics
- Cloud Logging sinks
- Service Accounts
- IAM role bindings
- Firestore
Enable the following APIs in the Service Project:
run.googleapis.compubsub.googleapis.comfirestore.googleapis.comlogging.googleapis.comcloudfunctions.googleapis.comcloudresourcemanager.googleapis.com
Enable the following APIs in each Target Project:
logging.googleapis.comcloudfunctions.googleapis.comrun.googleapis.comartifactregistry.googleapis.comcloudresourcemanager.googleapis.com
Qualys Requirements
You must have:
- Qualys Client ID
- Qualys Client Secret
- Qualys Gateway URL corresponding to your Qualys Platform POD
Required Software
Install the following tools before deployment:
- Terraform (minimum version — TBD)
- Google Cloud CLI (
gcloud) - Access to deploy Terraform resources in the Service and Target Projects
Permissions Required
The deployment requires permissions for both resource deployment and runtime scanning.
Deployment Permissions
The deploying principal must have permissions to:
- Create Cloud Run services
- Create Pub/Sub topics
- Create Cloud Logging sinks
- Create and manage Service Accounts
- Assign IAM permissions
- Access Firestore
Runtime Permissions
The deployment uses the default Compute Engine Service Account:
<PROJECT_NUMBER>[email protected]
The following permissions are assigned automatically during deployment.
Custom Role
qualysCloudFunctionScanner — This role provides access to Cloud Functions metadata, Cloud Run services, and function source-code artifacts required for scanning.
Additional Roles
roles/cloudfunctions.viewerroles/run.viewerroles/artifactregistry.reader
Within the Service Project:
roles/datastore.userroles/pubsub.publisher
User-Level Roles and Permissions
| Role | Purpose |
roles/run.admin |
Deploy and update the qualys-cloud-operator service and its invoker binding; create, update, and delete test Cloud Run services. |
roles/cloudfunctions.developer |
Create, update, and delete test Cloud Functions (gen1/gen2). |
roles/cloudbuild.builds.editor |
Build function source code; view failed builds. |
roles/iam.serviceAccountUser |
Run Cloud Run and functions as the default Compute service account. |
roles/iam.serviceAccountAdmin |
Terraform creates and deletes the Pub/Sub pusher service account. |
roles/iam.roleAdmin |
Terraform creates the custom role qualysCloudFunctionScanner. |
roles/resourcemanager.projectIamAdmin |
Terraform grants roles to the runtime service account. |
roles/pubsub.admin |
Topic, dead-letter topic, subscription and topic permissions; onboarding events; inspecting the dead-letter topic. |
roles/logging.configWriter |
Terraform creates the logging sink. |
roles/logging.viewer |
Operator logs, audit logs, and Cloud Build logs; authorization verification checks. |
roles/artifactregistry.writer |
Pull the operator image tags; push test images. |
roles/datastore.user |
Firestore access for gcp-function-scan-jobs. |
roles/serviceusage.serviceUsageAdmin |
Enable the prerequisite APIs. |
roles/browser |
Project and ancestry lookups. |
roles/monitoring.viewer (optional) |
Check operator memory and CPU usage. |
roles/secretmanager.admin (optional) |
Only if testing the qualys_secret_name credentials option. |
Organization-Based Onboarding Permissions
If organization-based onboarding is used, grant the following permission:
roles/resourcemanager.folderViewer
Use the following command to grant the permission:
gcloud organizations add-iam-policy-binding <ORG_ID> --member="serviceAccount:<SERVICE_PROJECT_NUMBER>[email protected]" --role="roles/resourcemanager.folderViewer"
This permission enables the operator to validate project ownership when projects are organized under folders.