mukul975/anthropic-cybersecurity-skills/securing-serverless-functions
Claude Code and agent skill by mukul975/anthropic-cybersecurity-skills
- community
Checking that the SKILL.md file is still in the repository.
'Hardens serverless compute platforms (AWS Lambda, Azure Functions, Google
Install
npx vskill@latest install mukul975/anthropic-cybersecurity-skills/securing-serverless-functionsSKILL.md
The same SKILL.md was published earlier as mukul975/anthropic-cybersecurity-skills/securing-serverless-functions.
Securing Serverless Functions
When to Use
- When deploying Lambda functions or Azure Functions with access to sensitive data or cloud APIs
- When auditing existing serverless workloads for overly permissive IAM roles
- When integrating serverless functions into a DevSecOps pipeline with automated security scanning
- When hardcoded secrets or vulnerable dependencies are discovered in function code
- When establishing runtime monitoring for serverless workloads to detect injection or credential theft
Do not use for container-based compute security (see securing-kubernetes-on-cloud), for API Gateway configuration (see implementing-cloud-waf-rules), or for serverless architecture design decisions.
Prerequisites
- AWS Lambda, Azure Functions, or GCP Cloud Functions with deployment access
- CI/CD pipeline with dependency scanning tools (npm audit, Snyk, Dependabot)
- AWS Secrets Manager, Azure Key Vault, or HashiCorp Vault for secrets management
- CloudWatch, Application Insights, or Cloud Logging for function monitoring
Workflow
Step 1: Enforce Least Privilege IAM Roles
Assign each Lambda function a dedicated IAM role with permissions scoped to only the specific resources it accesses. Never share IAM roles across functions.
Step 2: Eliminate Hardcoded Secrets
Replace plaintext credentials in environment variables with references to secrets management services. Use Lambda extensions or SDK calls to retrieve secrets at runtime.
Step 3: Scan Dependencies for Vulnerabilities
Integrate automated dependency scanning into the CI/CD pipeline to catch vulnerable packages before deployment.
Step 4: Implement Input Validation
Validate and sanitize all event input data to prevent injection attacks including SQL injection, command injection, and NoSQL injection through Lambda event sources.
Step 5: Configure Function URL and API Gateway Authentication
Secure function invocation endpoints with proper authentication. Never expose Lambda function URLs without IAM or Cognito authentication.
Step 6: Enable Runtime Monitoring and Logging
Configure GuardDuty Lambda Network Activity Monitoring and CloudWatch structured logging to detect anomalous function behavior.
Key Concepts
| Term | Definition | |
|---|---|---|
| Cold Start | Initial function invocation that includes container provisioning, increasing latency and creating a window where cached secrets may not be available | |
| Event Injection | Attack where malicious input is embedded in Lambda event data from API Gateway, S3, SQS, or other event sources to exploit the function | |
| Execution Role | IAM role assumed by Lambda during execution, defining all cloud API permissions the function can use | |
| Function URL | Direct HTTPS endpoint for Lambda functions that can be configured with IAM or no authentication (NONE is insecure) | |
| Layer | Lambda deployment package containing shared code or dependencies that should be scanned for vulnerabilities independently | |
| Reserved Concurrency | Maximum number of concurrent executions for a function, useful for preventing resource exhaustion attacks | |
| Provisioned Concurrency | Pre-initialized function instances that reduce cold start latency and ensure secrets are cached |
Tools & Systems
- AWS Lambda Power Tuning: Open-source tool for optimizing Lambda memory and timeout settings to balance security with performance
- Snyk: SCA tool scanning Lambda dependencies for known vulnerabilities with automatic fix suggestions
- Semgrep: SAST tool with serverless-specific rules detecting injection vulnerabilities, hardcoded secrets, and insecure configurations
- GuardDuty Lambda Protection: AWS service monitoring Lambda network activity for connections to malicious endpoints
- AWS X-Ray: Distributed tracing service for detecting suspicious external connections and latency anomalies in Lambda invocations
Common Scenarios
Scenario: SQL Injection via API Gateway to Lambda to RDS
Context: A Lambda function receives user input from API Gateway and constructs SQL queries by string concatenation against an RDS PostgreSQL database. An attacker injects SQL payloads through the API.
Approach:
- Audit the Lambda function code for string concatenation in SQL queries
- Replace all string-formatted queries with parameterized queries using the database driver
- Implement input validation using JSON Schema before any database operation
- Add a WAF rule on API Gateway to block common SQL injection patterns
- Deploy Semgrep in the CI/CD pipeline with the
python.django.security.injection.sqlrule set - Enable GuardDuty Lambda protection to detect anomalous database connection patterns
Pitfalls: Relying solely on WAF rules without fixing the underlying code vulnerability allows attackers to bypass with encoding tricks. Using ORM methods incorrectly (raw queries) still allows injection.
Output Format
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/securing-serverless-functions/SKILL.md
Popularity
- Repository stars
- 32,697
- Repository forks
- 3,943
- 7-day trend score
- 52
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 30 Jun 2026, 5 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/mukul975/anthropic-cybersecurity-skills/securing-serverless-functions)