Lesson 06 — Cloud Functions
Welcome
Section titled “Welcome”Modern cloud applications are increasingly built using serverless computing, allowing developers to deploy code without managing the underlying infrastructure.
Google Cloud Functions is Google’s Function-as-a-Service (FaaS) platform that executes code in response to events such as HTTP requests, Cloud Storage uploads, Pub/Sub messages, database changes, and scheduled jobs.
From a Cloud Penetration Tester’s perspective, Cloud Functions introduce a unique security model because responsibility shifts from securing operating systems to securing identities, permissions, APIs, event triggers, and application code.
This lesson introduces Google Cloud Functions from an enterprise security assessment perspective.
Learning Objectives
Section titled “Learning Objectives”After completing this lesson, you will be able to:
- Understand Google Cloud Functions architecture.
- Explain serverless computing.
- Review Cloud Function deployment models.
- Assess identity and access controls.
- Understand event triggers.
- Review runtime security.
- Identify common Cloud Function attack surfaces.
- Apply enterprise serverless security best practices.
Business Scenario
Section titled “Business Scenario”You are working as a Cloud Penetration Tester at CloudNova Technologies.
A customer has modernised several business applications using Google Cloud Functions.
The environment processes:
- Customer requests
- Payment processing
- Image uploads
- Automated notifications
- API integrations
- Scheduled administrative tasks
Management wants assurance that the serverless platform is securely configured before deploying additional production workloads.
Your responsibility is to review the Cloud Functions environment and identify security weaknesses that could increase business risk.
What are Google Cloud Functions?
Section titled “What are Google Cloud Functions?”Google Cloud Functions is a serverless execution environment that allows developers to run application code without provisioning or managing servers.
Functions automatically scale based on demand and integrate with many Google Cloud services.
Typical use cases include:
- REST APIs
- Event processing
- File processing
- Automation
- Data transformation
- Webhooks
- Background jobs
- Cloud orchestration
Cloud Functions Architecture
Section titled “Cloud Functions Architecture”A simplified deployment looks like:
User / Application
↓
HTTP Request or Event
↓
Cloud Function
↓
Service Account
↓
Google Cloud Services
↓
Logging & MonitoringThe Cloud Function executes code using the permissions assigned to its associated Service Account.
Event Triggers
Section titled “Event Triggers”Cloud Functions can be invoked by various event sources.
Common triggers include:
- HTTP Requests
- Cloud Storage events
- Pub/Sub messages
- Eventarc events
- Cloud Scheduler
- Firestore events
- Cloud Audit Logs
Understanding trigger configuration is essential during security assessments because exposed or misconfigured triggers may increase the application’s attack surface.
Service Accounts
Section titled “Service Accounts”Every Cloud Function executes using a Google Cloud Service Account.
The Service Account determines which cloud resources the function can access.
During enterprise assessments review:
- Assigned Service Account
- IAM roles
- API permissions
- Resource access
- Least privilege implementation
Overly privileged Service Accounts remain one of the most common serverless security findings.
Runtime Security
Section titled “Runtime Security”Cloud Functions execute within managed runtime environments.
Security reviews should evaluate:
- Runtime version
- Supported language
- Dependency management
- Environment variables
- Secret handling
- Temporary storage usage
- Logging configuration
Outdated runtimes or insecure dependencies may increase operational risk.
Secrets Management
Section titled “Secrets Management”Applications often require credentials to communicate with other services.
Enterprise environments should avoid embedding secrets directly within application code.
Review how functions access:
- API Keys
- Database credentials
- OAuth tokens
- Encryption keys
- Certificates
Where appropriate, verify that organisations use Google Secret Manager or other approved enterprise secret management solutions.
Network Connectivity
Section titled “Network Connectivity”Cloud Functions may communicate with:
- Cloud SQL
- Cloud Storage
- Google APIs
- Third-party APIs
- Internal services
- Kubernetes workloads
Review:
- Outbound connectivity
- Inbound access
- VPC Connectors
- Private networking
- API exposure
Proper network design helps reduce unnecessary exposure.
Logging & Monitoring
Section titled “Logging & Monitoring”Cloud Functions should integrate with enterprise monitoring solutions.
Review:
- Cloud Logging
- Cloud Monitoring
- Error Reporting
- Audit Logs
- Security Command Center
- SIEM integration
Verify that security-relevant events are collected and retained according to organisational requirements.
Common Cloud Function Security Risks
Section titled “Common Cloud Function Security Risks”During enterprise assessments, common observations include:
- Overly privileged Service Accounts
- Publicly accessible HTTP functions
- Excessive IAM permissions
- Insecure environment variable management
- Weak authentication mechanisms
- Missing logging
- Outdated runtime versions
- Unnecessary external API exposure
- Poor dependency management
These findings may increase operational and security risk if not properly managed.
Enterprise Serverless Security Best Practices
Section titled “Enterprise Serverless Security Best Practices”Well-managed Google Cloud Function environments typically:
- Apply the Principle of Least Privilege.
- Use dedicated Service Accounts.
- Protect sensitive information with Secret Manager.
- Restrict public access where not required.
- Keep runtimes and dependencies up to date.
- Enable comprehensive logging and monitoring.
- Review IAM permissions regularly.
- Follow secure software development practices.
Enterprise Skills You Will Develop
Section titled “Enterprise Skills You Will Develop”By completing this lesson you will learn how to:
- Review Cloud Function deployments.
- Assess Service Account security.
- Evaluate runtime configuration.
- Review event triggers.
- Assess serverless networking.
- Identify serverless security risks.
- Perform enterprise serverless security reviews.
Key Takeaways
Section titled “Key Takeaways”After completing this lesson you should understand:
- Google Cloud Functions architecture.
- Serverless computing.
- Event triggers.
- Service Accounts.
- Runtime security.
- Secret management.
- Logging and monitoring.
- Enterprise serverless security best practices.
Knowledge Check
Section titled “Knowledge Check”You should now be able to answer:
- What are Google Cloud Functions?
- What is serverless computing?
- How are Cloud Functions triggered?
- Why are Service Accounts critical to Cloud Function security?
- Why should secrets not be stored directly in application code?
- What are the most common enterprise Cloud Function security risks?
Next Lesson
Section titled “Next Lesson”➡️ Lesson 07 — Secret Manager
In the next lesson, you will learn how to assess Google Secret Manager, review secret lifecycle management, evaluate access controls, encryption, rotation strategies, and enterprise secret governance from a Cloud Penetration Tester’s perspective.