agentleFS
michaelsvanbeekmichaelsvanbeek/personal-agent-skills/skills/security/SKILL.md

security

Skill1 starsChanged 8 months agoMITView on GitHub

Application security standards and hardening practices. Use when: reviewing code for vulnerabilities, implementing authentication, configuring CORS, adding input validation, managing secrets, scanning dependencies, setting CSP headers, reviewing IAM policies, auditing an existing application for OWASP top 10 vulnerabilities, or hardening an existing deployment. Covers OWASP top 10, secrets management, dependency auditing, and security headers.

  • Reads credentials

78 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use cost-reducer, trigger-dev and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • daianepepes-labSkill

    cost-reducer

    Analyze and reduce costs across cloud infrastructure, code, and services. Use when asked to cut costs, optimize spending, reduce bills, or improve cost efficiency.

    Also in 5 projects that use this

  • xfstudioSkill

    trigger-dev

    Trigger.dev expert for background jobs, AI workflows, and reliable async execution with excellent developer experience and TypeScript-first design. Use when: trigger.dev, trigger dev, background task, ai background job, long running task.

    Also in 4 projects that use this

  • ffsshhttiikkSkill

    scalability

    Core foundational concepts and principles for Scalability

    Also in 4 projects that use this

  • daianepepes-labSkill

    self-healing

    Detect, diagnose, and automatically fix recurring errors, memory issues, and system degradation. Use when a system has recurring failures, memory leaks, performance degradation, or needs automatic recovery mechanisms.

    Also in 5 projects that use this

  • xfstudioSkill

    customer-support

    Elite AI-powered customer support specialist mastering

    Also in 4 projects that use this

  • xiaobei930Skill

    backend

    Backend development patterns for services, error handling, logging, caching. Use when building backend services, APIs, or microservices.

    Also in 6 projects that use this

  • +1 more from daianepepes-lab

The file

Show its rules and text

We split this skill into the rules it gives an agent

27 rules. 0 are common, 20 are distinctive, and 7 are very specific to this project.

  • 0

    Common

    Most of the 56 edited versions we read keep these.

  • 20

    Distinctive

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Default to deny. Explicitly grant access, never implicitly allow.

    line 31
  2. Distinctive:

    Verify resource ownership: user A cannot access user B's resources even if they guess the ID.

    line 32
  3. Distinctive:

    Use middleware/decorators for authorization checks, not ad-hoc conditionals in route handlers.

    line 33
  4. Very specific:

    Never store passwords in plaintext.

    line 37
  5. Distinctive:

    Use TLS (HTTPS) for all communication.

    line 38
  6. Distinctive:

    Never commit secrets, tokens, or keys to version control.

    line 39
  7. Very specific:

    Use strong random generation (secrets module in Python, crypto.randomUUID() in JS) for tokens and IDs.

    line 40
  8. Distinctive:

    SQL injection: Use parameterized queries or ORM methods.

    line 44
  9. Distinctive:

    Command injection: Never pass user input to shell commands.

    line 46
  10. Distinctive:

    Template injection: Use auto-escaping template engines.

    line 47
  11. Distinctive:

    Use CAPTCHA or progressive delays after repeated failed attempts.

    line 52
  12. Distinctive:

    Remove default credentials and sample pages.

    line 58
  13. Distinctive:

    Keep error messages generic in production — never leak internal details.

    line 60
  14. Distinctive:

    Run dependency audits regularly:

    line 64
  15. Very specific:

    Use established libraries for auth (Passport.js, python-jose, authlib).

    line 74
  16. Distinctive:

    Use short-lived access tokens with refresh token rotation.

    line 77
  17. Distinctive:

    Verify signatures on JWTs.

    line 81
  18. Distinctive:

    Use checksums for file uploads and downloads.

    line 83
  19. Distinctive:

    Never log secrets, tokens, or PII (see logging-metrics skill).

    line 89
  20. Distinctive:

    Never let user input directly control the destination of a server-side request.

    line 95
  21. Distinctive:

    Start strict. Add exceptions only when a specific feature requires it.

    line 126
  22. Very specific:

    Never use unsafe-eval in script-src.

    line 127
  23. Very specific:

    Use separate secrets per environment (dev/staging/prod).

    line 140
  24. Very specific:

    Never use Access-Control-Allow-Origin: * in production.

    line 146
  25. Distinctive:

    Use schema validation (Pydantic, Zod, JSON Schema).

    line 165
  26. Very specific:

    Use conditions to scope permissions: aws:SourceArn, aws:RequestedRegion.

    line 177
  27. Distinctive:

    Use IAM roles, not long-lived access keys.

    line 178

“Common” is measured: kept by at least 6 in 10 of the 56 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Security Standards

When to Use

  • Reviewing code for security vulnerabilities
  • Implementing authentication or authorization
  • Configuring CORS, CSP, or security headers
  • Managing secrets and credentials
  • Auditing dependencies for known vulnerabilities
  • Auditing an existing application for OWASP top 10 vulnerabilities
  • Hardening an existing deployment (missing headers, overly permissive CORS, exposed secrets)
  • Designing IAM policies or access controls

OWASP Top 10 Checklist

Apply these checks to every service:

1. Broken Access Control

  • Enforce authorization on every endpoint, not just the UI.
  • Default to deny. Explicitly grant access, never implicitly allow.
  • Verify resource ownership: user A cannot access user B's resources even if they guess the ID.
  • Use middleware/decorators for authorization checks, not ad-hoc conditionals in route handlers.

2. Cryptographic Failures

  • Never store passwords in plaintext. Use bcrypt or argon2 with appropriate work factors.
  • Use TLS (HTTPS) for all communication. No exceptions.
  • Never commit secrets, tokens, or keys to version control.
  • Use strong random generation (secrets module in Python, crypto.randomUUID() in JS) for tokens and IDs.

3. Injection

  • SQL injection: Use parameterized queries or ORM methods. Never concatenate user input into SQL strings.
  • XSS: Sanitize and escape all user-provided content rendered in HTML. React's JSX escapes by default — never use dangerouslySetInnerHTML with untrusted data.
  • Command injection: Never pass user input to shell commands. Use subprocess with argument lists, not shell=True.
  • Template injection: Use auto-escaping template engines.

4. Insecure Design

  • Implement rate limiting on authentication endpoints.
  • Use CAPTCHA or progressive delays after repeated failed attempts.
  • Design multi-tenant systems with strict data isolation from the start.

5. Security Misconfiguration

  • Disable debug mode and stack traces in production.
  • Remove default credentials and sample pages.
  • Set security headers on all responses (see below).
  • Keep error messages generic in production — never leak internal details.

6. Vulnerable Components

  • Run dependency audits regularly:
    pip-audit              # Python
    npm audit              # Node.js
  • Pin dependency versions. Update dependencies on a regular cadence.
  • Subscribe to security advisories for critical dependencies.

7. Authentication Failures

  • Use established libraries for auth (Passport.js, python-jose, authlib). Never hand-roll JWT validation.
  • Enforce strong password policies or prefer OAuth2/OIDC.
  • Invalidate sessions on password change.
  • Use short-lived access tokens with refresh token rotation.

8. Data Integrity Failures

  • Verify signatures on JWTs. Never trust unverified tokens.
  • Validate webhook payloads using HMAC signatures.
  • Use checksums for file uploads and downloads.

9. Logging and Monitoring Failures

  • Log authentication attempts (success and failure).
  • Log authorization failures.
  • Never log secrets, tokens, or PII (see logging-metrics skill).
  • Alert on anomalous patterns (spike in 401s, unusual access patterns).

10. SSRF (Server-Side Request Forgery)

  • Validate and allowlist URLs before making server-side HTTP requests.
  • Never let user input directly control the destination of a server-side request.
  • Block requests to internal/private IP ranges (127.0.0.0/8, 10.0.0.0/8, 169.254.169.254).

Security Headers

Set these on all HTTP responses:

# FastAPI middleware example
@app.middleware("http")
async def security_headers(request, call_next):
    response = await call_next(request)
    response.headers["X-Content-Type-Options"] = "nosniff"
    response.headers["X-Frame-Options"] = "DENY"
    response.headers["X-XSS-Protection"] = "0"  # deprecated, but set to 0
    response.headers["Referrer-Policy"] = "strict-origin-when-cross-origin"
    response.headers["Permissions-Policy"] = "camera=(), microphone=(), geolocation=()"
    response.headers["Strict-Transport-Security"] = "max-age=31536000; includeSubDomains"
    return response

Content Security Policy (CSP)

Set a restrictive CSP and relax only as needed:

Content-Security-Policy: default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self' https://api.example.com; frame-ancestors 'none'
  • Start strict. Add exceptions only when a specific feature requires it.
  • Never use unsafe-eval in script-src.
  • Report violations: report-uri /csp-report or report-to directive.

Secrets Management

  • Never hardcode secrets in source code, config files, or environment variable defaults.
  • Store secrets in:
    • AWS SSM Parameter Store (SecureString) for Lambda/serverless
    • AWS Secrets Manager for rotation-capable secrets
    • .env files for local development only (listed in .gitignore)
  • Rotate secrets on a regular schedule. Design systems to handle rotation gracefully.
  • Use separate secrets per environment (dev/staging/prod). Never share prod secrets with dev.

CORS

  • Never use Access-Control-Allow-Origin: * in production.
  • Allowlist specific origins. Configure per environment.
  • Restrict methods and headers to what the API actually uses.
app.add_middleware(
    CORSMiddleware,
    allow_origins=settings.cors_origins,  # ["https://app.example.com"]
    allow_methods=["GET", "POST", "PUT", "DELETE"],
    allow_headers=["Authorization", "Content-Type"],
    allow_credentials=True,
)

Input Validation

  • Validate all external input at the system boundary: API request bodies, query params, headers, file uploads.
  • Use schema validation (Pydantic, Zod, JSON Schema). Reject anything that doesn't match the schema.
  • Validate and constrain: max lengths, allowed characters, numeric ranges, enum values.
  • Sanitize file names. Strip path components. Validate MIME types.
  • Reject unexpectedly large payloads early (set max_body_size).

IAM Best Practices (AWS)

  • Least privilege: Each Lambda/service gets only the permissions it needs.
  • Define per-function IAM statements: specific actions on specific resources.
  • Never use Effect: Allow, Action: *, Resource: *.
  • Use conditions to scope permissions: aws:SourceArn, aws:RequestedRegion.
  • Use IAM roles, not long-lived access keys.
  • Audit IAM policies regularly. Remove unused permissions.

For secrets storage, rotation, and lifecycle management, see the secrets-management skill. For dependency vulnerability auditing and supply chain security, see the dependency-management skill.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.