agentleFS
mejbaurbaharmejbaurbahar/software-tester-skills/skills/42crunch-api-security-testing/SKILL.md

42crunch-api-security-testing

Skill1 starsChanged 53 days agoMITView on GitHub

Use when auditing, scanning, or remediating OpenAPI/Swagger API definitions for security vulnerabilities — 42Crunch audit scoring, OWASP API Security Top 10 compliance, BOLA/BFLA prevention, schema strictness, and shift-left API CI/CD testing.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every endpoint (except explicit public endpoints like login/register) must define a security requirement.

    line 45
  2. Very specific:

    Strings: Must specify maxLength and where applicable a restrictive pattern (regex) or format (e.g., uuid, email, uri).

    line 50
  3. Very specific:

    Numbers/Integers: Must specify minimum and maximum boundaries to prevent integer overflows or resource exhaustion.

    line 51
  4. Very specific:

    Arrays: Must specify maxItems and minItems to prevent unbounded payload attacks (DoS).

    line 52
  5. Very specific:

    Objects: Must specify additionalProperties: false to mitigate Mass Assignment vulnerabilities.

    line 53
  6. Very specific:

    When 42Crunch CLI (42c) or VS Code extension is installed:

    line 177
  7. Distinctive:

    When reviewing or authoring an API contract:

    line 189

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

42Crunch API Security Testing

Overview

42Crunch provides automated, contract-driven API security testing. It enforces security at the OpenAPI/Swagger definition layer and verifies live implementation conformance, enabling an automated Audit -> Scan -> Remediate -> Validate cycle directly within AI-assisted developer workflows.


The Continuous API Security Loop

      ┌───────────────┐
      │  1. AUDIT     │  Static contract analysis of OpenAPI / Swagger specs
      └───────┬───────┘
              ▼
      ┌───────────────┐
      │  2. SCAN      │  Dynamic conformance scanning of active endpoints
      └───────┬───────┘
              ▼
      ┌───────────────┐
      │ 3. REMEDIATE  │  Propose exact contract & code fixes (BOLA, schemas)
      └───────┬───────┘
              ▼
      ┌───────────────┐
      │ 4. VALIDATE   │  Re-audit to verify score meets threshold (>85/100)
      └───────────────┘

1. OpenAPI Security Audit Criteria (Scoring 0–100)

A high 42Crunch audit score requires comprehensive, strict contract definitions:

Authentication & Authorization

  • Every endpoint (except explicit public endpoints like login/register) must define a security requirement.
  • Global security definitions must declare granular scopes (e.g. read:users, write:orders).
  • Unauthenticated endpoints must explicitly set security: [] with documented rationale.

Strict Schema Definition & Input Constraints

  • Strings: Must specify maxLength and where applicable a restrictive pattern (regex) or format (e.g., uuid, email, uri).
  • Numbers/Integers: Must specify minimum and maximum boundaries to prevent integer overflows or resource exhaustion.
  • Arrays: Must specify maxItems and minItems to prevent unbounded payload attacks (DoS).
  • Objects: Must specify additionalProperties: false to mitigate Mass Assignment vulnerabilities.
  • Enums: Restrict input values to known permitted sets rather than arbitrary strings.

Response Contracts

  • Explicit definitions for all HTTP response codes:
    • 200 / 201 / 204 with strict output schemas.
    • 400 Bad Request with standardized validation error schema.
    • 401 Unauthorized & 403 Forbidden for auth failures.
    • 404 Not Found for resource lookups.
    • 429 Too Many Requests with rate limit headers.
    • 500 Internal Server Error with generic, non-leaking error responses (never stack traces).

2. OWASP API Security Top 10 (2023) Mapping

RiskName42Crunch Verification Rule
API1BOLA (Broken Object Level Authorization)Enforce path parameter format (e.g. uuid pattern), verify auth tokens on object IDs, assert tenant isolation.
API2Broken AuthenticationFlag weak schemes (e.g. Basic Auth over HTTP); require OAuth2/Bearer JWT with expiration; rate limit login endpoints.
API3Broken Object Property Level AuthPrevent Mass Assignment by enforcing additionalProperties: false on request bodies and filtering sensitive attributes (e.g. role, isAdmin) from response schemas.
API4Unrestricted Resource ConsumptionMandate maxLength, maxItems, pagination query parameters (limit with max boundary), and 429 rate limiting contracts.
API5BFLA (Broken Function Level Auth)Enforce strict role/scope requirements on administrative endpoints (e.g., /admin/* requires admin scope).
API6Unrestricted Sensitive Business FlowsIdentify high-frequency critical endpoints (e.g. checkout, coupon-redeem, password-reset) requiring CAPTCHA or velocity throttling.
API7Server-Side Request Forgery (SSRF)Restrict URL/webhook parameter schemas with strict regex patterns; disallow loopback/internal CIDR ranges.
API8Security MisconfigurationDisallow wildcard CORS (*), mandate HTTPS-only server URLs, remove detailed stack traces from 5xx schemas.
API9Improper Inventory ManagementFlag undocumented/deprecated API versions; enforce API version prefixes (/v1/, /v2/); remove debug endpoints.
API10Unsafe Consumption of APIsValidate responses from third-party integrations with strict schema filters before internal processing.

3. Remediation Patterns (Before vs. After)

Example 1: Preventing Mass Assignment & Unbounded Strings

❌ Vulnerable Spec (Audit Score: ~35/100)

paths:
  /users:
    post:
      summary: Create user
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                username:
                  type: string
                email:
                  type: string
                role:
                  type: string

✅ Remediated Spec (Audit Score: ~95/100)

paths:
  /users:
    post:
      summary: Create user
      security:
        - BearerAuth: ["users:create"]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - username
                - email
              properties:
                username:
                  type: string
                  minLength: 3
                  maxLength: 30
                  pattern: '^[a-zA-Z0-9_-]+$'
                email:
                  type: string
                  format: email
                  maxLength: 255
      responses:
        '201':
          description: User created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserResponse'
        '400':
          $ref: '#/components/responses/400BadRequest'
        '401':
          $ref: '#/components/responses/401Unauthorized'

4. Automation & CI/CD Shift-Left

GitHub Actions Integration

name: 42Crunch API Security Audit

on:
  push:
    paths:
      - '**/openapi.yaml'
      - '**/openapi.json'
  pull_request:

jobs:
  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: 42Crunch API Security Audit
        uses: 42Crunch/api-security-audit-action@v3
        with:
          api-token: ${{ secrets.SECURITY_API_TOKEN }}
          min-score: 85

CLI Quick Audit

When 42Crunch CLI (42c) or VS Code extension is installed:

# Run local contract audit
42c audit openapi.yaml --min-score 85

# Conformance scan against live test server
42c scan openapi.yaml --target http://localhost:8080

5. Review Checklist for Agents

When reviewing or authoring an API contract:

  1. Is security defined at root and per-endpoint?
  2. Does every string have maxLength and a pattern or format?
  3. Does every numeric value have minimum and maximum?
  4. Does every array have maxItems?
  5. Is additionalProperties: false set on all request payload schemas?
  6. Are all error status codes (400, 401, 403, 404, 429, 500) documented with schemas?
  7. Are internal/admin paths guarded by distinct role scopes?
  8. Has the audit score achieved ≥ 85/100?

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.