मुख्य सामग्री पर जाएँ
Skillpedia
सिक्योरिटी35k · #8375

securing-serverless-functions

यह क्या करती है

यह टूल आपके क्लाउड कोड फंक्शन (जैसे AWS Lambda, Azure Functions, Google Cloud Functions) को सुरक्षित करने में मदद करता है। यह सुनिश्चित करता है कि कोड के पास सिर्फ ज़रूरी permissions हों, वह कमज़ोर components की जाँच करता है, passwords को सुरक्षित तरीके से संभालता है और आने वाले डेटा की जाँच करता है।

कब इस्तेमाल करें

  • ✓संवेदनशील डेटा संभालने वाले फंक्शन deploy करते समय।
  • ✓यह जाँचते समय कि फंक्शन की एक्सेस ज़रूरत से ज़्यादा व्यापक तो नहीं है।
  • ✓सॉफ़्टवेयर डेवलपमेंट प्रक्रिया में अपने आप सुरक्षा जाँच जोड़ते समय।

Skill का लिंक

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/securing-serverless-functions/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/securing-serverless-functions/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मेरे Lambda फंक्शन को, जो customer data का एक्सेस करते हैं, कैसे सुरक्षित करूँ?”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

यह हर फंक्शन के लिए न्यूनतम permissions सेट करता है, ताकि वह ज़रूरत से ज़्यादा चीज़ों तक पहुँच न सके। यह कोड में पुराने या खतरनाक components की भी जाँच करता है, और सुनिश्चित करता है कि passwords और संवेदनशील जानकारी सीधे कोड में न लिखी हों, बल्कि सुरक्षित जगह पर रखी जाएँ।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

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.

# Create a least-privilege role for a specific Lambda function
aws iam create-role \
  --role-name order-processor-lambda-role \
  --assume-role-policy-document '{
    "Version": "2012-10-17",
    "Statement": [{
      "Effect": "Allow",
      "Principal": {"Service": "lambda.amazonaws.com"},
      "Action": "sts:AssumeRole"
    }]
  }'

# Attach a scoped policy (not AmazonDynamoDBFullAccess)
aws iam put-role-policy \
  --role-name order-processor-lambda-role \
  --policy-name order-processor-policy \
  --policy-document '{
    "Version": "2012-10-17",
    "Statement": [
      {
        "Effect": "Allow",
        "Action": ["dynamodb:PutItem", "dynamodb:GetItem"],
        "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/Orders"
      },
      {
        "Effect": "Allow",
        "Action": ["logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents"],
        "Resource": "arn:aws:logs:us-east-1:123456789012:log-group:/aws/lambda/order-processor:*"
      },
      {
        "Effect": "Allow",
        "Action": ["secretsmanager:GetSecretValue"],
        "Resource": "arn:aws:secretsmanager:us-east-1:123456789012:secret:order-api-key-*"
      }
    ]
  }'

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.

# INSECURE: Hardcoded credentials in environment variable
# DB_PASSWORD = os.environ['DB_PASSWORD']  # Stored as plaintext in Lambda config

# SECURE: Retrieve from AWS Secrets Manager with caching
import boto3
from botocore.exceptions import ClientError
import json

_secret_cache = {}

def get_secret(secret_name):
    if secret_name in _secret_cache:
        return _secret_cache[secret_name]

    client = boto3.client('secretsmanager')
    response = client.get_secret_value(SecretId=secret_name)
    secret = json.loads(response['SecretString'])
    _secret_cache[secret_name] = secret
    return secret

def lambda_handler(event, context):
    db_creds = get_secret('production/database/credentials')
    db_host = db_creds['host']
    db_password = db_creds['password']
    # Use credentials securely
# Enable encryption at rest for Lambda environment variables
aws lambda update-function-configuration \
  --function-name order-processor \
  --kms-key-arn arn:aws:kms:us-east-1:123456789012:key/key-id

Step 3: Scan Dependencies for Vulnerabilities

Integrate automated dependency scanning into the CI/CD pipeline to catch vulnerable packages before deployment.

# npm audit for Node.js Lambda functions
cd lambda-function/
npm audit --audit-level=high
npm audit fix

# Snyk scanning in CI/CD pipeline
snyk test --severity-threshold=high
snyk monitor --project-name=order-processor-lambda

# pip-audit for Python Lambda functions
pip-audit -r requirements.txt --desc on --fix

# Scan Lambda deployment package with Trivy
trivy fs --severity HIGH,CRITICAL ./lambda-package/
# GitHub Actions CI/CD security scanning
name: Lambda Security Scan
on: [push, pull_request]
jobs:
  security:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

…
अक्सर पूछे जाने वाले सवाल

'serverless functions' क्या होते हैं?

ये छोटे कोड के टुकड़े होते हैं जो ज़रूरत पड़ने पर क्लाउड में चलते हैं, और इसके लिए आपको सर्वर खुद मैनेज नहीं करने पड़ते। उदाहरण: AWS Lambda, Azure Functions और Google Cloud Functions।

'IAM' क्या है?

IAM का मतलब है Identity and Access Management। यह एक सिस्टम है जो तय करता है कि क्लाउड में कौन (या कौन सा प्रोग्राम) किन संसाधनों तक पहुँच सकता है, ताकि सिर्फ अधिकृत यूज़र या फंक्शन ही उन्हें इस्तेमाल करें।

'dependency vulnerabilities' क्या होती हैं?

ये उन सॉफ़्टवेयर libraries या components में मिलने वाली सुरक्षा खामियाँ हैं, जिन्हें आपका कोड इस्तेमाल करता है। अगर ये libraries पुरानी हों या उनमें खामी हो, तो आपका कोड हमलों के लिए खुला हो सकता है।

जानकारी

लेखक का मूल विवरण

Hardens serverless compute platforms (AWS Lambda, Azure Functions, Google Cloud Functions): least-privilege IAM roles, dependency vulnerability scanning, secrets management integration, input validation, function URL authentication, and runtime monitoring. Use when deploying serverless functions with sensitive access, auditing for overly permissive roles, or adding functions to a DevSecOps pipelin

repo: mukul975/Anthropic-Cybersecurity-Skills

लोकप्रियता

GitHub स्टार
35k
रैंकिंग में स्थान
#8375
लाइसेंस
Apache-2.0
अपडेट की गई
31/8/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills