junmystery/agent-guidance-rust/serverless-faas-security-cheat-sheet
Claude Code and agent skill by junmystery/agent-guidance-rust
- community
Checking that the SKILL.md file is still in the repository.
Install
npx vskill@latest install junmystery/agent-guidance-rust/serverless-faas-security-cheat-sheetSKILL.md
The same SKILL.md was published earlier as junmystery/agent-guidance-rust/serverless-faas-security-cheat-sheet.
Serverless / FaaS Security Cheat Sheet
Introduction
Serverless computing (Functions as a Service — FaaS) platforms such as AWS Lambda, Azure Functions, and Google Cloud Functions simplify application development and scaling. However, the execution model (short-lived, event-driven functions running in managed environments) introduces unique security risks compared to traditional architectures.
This cheat sheet provides best practices to secure serverless applications and minimize attack surfaces.
Key Risks
- Over-permissioned functions (broad IAM roles,
*policies). - Unvalidated event inputs (API Gateway, S3, Pub/Sub, IoT).
- Cold start data leakage (persistent state, side-channel timing).
- Function chaining abuse (compromised function invoking others).
- Shared environment risks (multi-tenant leakage,
/tmpreuse). - Hardcoded secrets in code or platform config.
- Excessive network access.
Best Practices
1. Principle of Least Privilege
- Assign minimal IAM permissions to each function.
- Use role-per-function (avoid shared high-privilege roles).
- Scope database/API keys to the smallest set of actions needed.
Bad IAM Policy (too broad):
Good IAM Policy (scoped):
2. Environment Isolation
- Disable default network access unless required (e.g. outbound internet access).
- Place functions in private subnets with controlled egress.
- Isolate sensitive functions (e.g. payment, auth) from general-purpose ones.
- Separate production vs. staging environments with strict boundaries.
AWS Lambda VPC Config (restrictive):
3. Secure Function Invocation
- Enforce authentication and authorization on all triggers (API Gateway, Pub/Sub, S3, IoT).
- Validate function-to-function calls with signed tokens or workload identities.
- Apply rate limiting and throttling to mitigate DoS and abuse.
API Gateway Authorizer Example (JWT validation):
4. Event Data Validation
- Treat all event payloads as untrusted input.
- Apply strong input validation & sanitization (length, type, format).
- Protect against common injection attacks (SQLi, XSS, JSON injection, deserialization).
- Strip unnecessary fields and metadata before processing.
Example: Python input validation for Lambda
5. Cold Start & Execution Context Security
- Do not assume function runtime context is clean between invocations.
- Avoid storing secrets or temporary sensitive data in global/static variables.
- Protect against side-channel leaks (timing differences, leftover files in /tmp).
- For sensitive workloads, enforce single-use execution environments if the platform supports it.
Bad:
Good:
6. Secrets Management
See the Secrets Management Cheat Sheet for secret lifecycle controls.
- Fetch secrets at runtime from a vault or caching extension — not from platform-level function configuration (e.g. Lambda Environment Variables).
- Use ephemeral credentials (STS, workload identity federation).
- Rotate secrets automatically.
AWS Lambda Secret Fetch (Python via Parameters and Secrets Extension):
Note: Ensure that the AWS Lambda Parameters and Secrets Extension is added and enabled for your function (for example, as a Lambda layer). Otherwise, http://localhost:2773 will not be available and requests to it will fail.
7. Monitoring & Logging
- Use centralized logging (CloudWatch, Azure Monitor, GCP Logging).
- Mask secrets and PII.
Example: Redacting fields
8. Supply Chain Security
- Scan dependencies (
npm audit,pip-audit,safety). - Use minimal deployment packages.
- Sign deployment packages and verify signatures against an approved publisher before deployment. A checksum alone does not authenticate the publisher.
For AWS Lambda, use code signing configurations with allowed signing profiles and UntrustedArtifactOnDeployment set to Enforce; the default Warn setting allows deployments that fail expiry, publisher, or revocation checks. Layers added to functions with code signing enabled must also be signed by an allowed profile.
Do’s and Don’ts
Do:
- Enforce least privilege per function.
- Validate all event inputs.
- Fetch secrets from vaults, not platform config.
- Restrict network egress.
- Monitor invocations and logs.
Don’t:
- Hardcode secrets in code or configs.
- Assume clean runtime between invocations.
- Give
*IAM permissions. - Leave sensitive data in
/tmpor globals. - Trust event sources blindly.
References
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/serverless-faas-security-cheat-sheet/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
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/junmystery/agent-guidance-rust/serverless-faas-security-cheat-sheet)