APIprompt onlyintermediate

API Security Hardening

This loop identifies and remediates insecure API patterns and vulnerabilities in Node.js projects by iteratively running npm audit and applying security fixes until the codebase passes security scanning.

← all loops
APIsecuritynpmauditvulnerabilitiesdependency-hardening

Goal

Remove insecure API patterns

How to Run

Automatically hardens API security by scanning dependencies, identifying vulnerabilities, and applying safe fixes.

  1. 01

    Initiate the Loop

    Start the loop in your preferred coding environment (Cursor, Claude Code, etc.)

  2. 02

    Automated Scanning & Fixing

    The agent will run 'npm audit', analyze vulnerabilities, and apply fixes using 'npm audit fix' or manual remediation

  3. 03

    Iterative Validation

    After each fix iteration, re-run 'npm audit' until no vulnerabilities remain

Workflow Steps

  1. 01

    Initial Security Assessment

    Run 'npm audit' to identify all existing vulnerabilities in project dependencies

  2. 02

    Vulnerabilities Analysis

    Parse audit results to categorize issues by severity and impact on API security

  3. 03

    Apply Automated Fixes

    Execute 'npm audit fix' for safe updates, then manually address remaining critical issues

  4. 04

    Codebase Verification

    Ensure all security patches maintain API functionality and don't introduce breaking changes

  5. 05

    Re-scan and Iterate

    Re-run 'npm audit' to validate fixes; repeat process if vulnerabilities persist

Kickoff Prompt

Start the "API Security Hardening" loop.

Goal: Remove insecure API patterns
Max iterations: 10
Between iterations run: npm audit
Exit when: Security scan passes


Start API Security Hardening loop. Begin by running 'npm audit' to identify vulnerabilities, then apply fixes using 'npm audit fix' and manual remediation. Continue iterating until the security scan passes with no vulnerabilities.

Self-pace this loop. After each iteration, run `npm audit` and evaluate the output, and only continue if the exit condition is not met (Security scan passes). Stop when the exit condition passes or 10 iterations are reached. Give a short status update each pass.

Guardrails

hardcoded
  • ·Only modify package.json and lock files when applying automated fixes
  • ·Never expose sensitive environment variables or credentials
  • ·Create backups before major dependency updates
  • ·Prioritize high-severity vulnerabilities first
  • ·Avoid breaking changes to API contracts without explicit approval

Flow Diagram

rendering…

Related loops — API