diff --git a/README.md b/README.md index 9b02aa9..990905e 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,12 @@ npm install @pensar/ci ## Usage ```bash -# Run a security pentest +# Run a security pentest (full scan, all endpoints) pensar pentest --project +# Run a quick pentest (highest-risk endpoints only, ~15 mins) +pensar pentest --project --quick + # Check pentest status pensar status ``` @@ -24,7 +27,8 @@ pensar status | ------------------- | --------------------------------------------------------------------------- | | `-p, --project` | Project ID (or set `PENSAR_PROJECT_ID`) | | `-b, --branch` | Branch to pentest | -| `-l, --level` | Pentest level: `priority` or `full` | +| `-l, --level` | Pentest level: `priority` or `full` (default: `full`) | +| `--quick` | Shorthand for `--level priority`. Tests highest-risk endpoints only (~15 mins) | | `-e, --environment` | Target environment: `dev`, `staging`, or `production` | | `-c, --commit` | Commit SHA (auto-detected from CI env vars, or set `PENSAR_COMMIT_SHA`) | | `-s, --severity` | Minimum severity threshold to error on (or set `PENSAR_ERROR_SEVERITY_THRESHOLD`) | diff --git a/src/bin/index.ts b/src/bin/index.ts index bea8ed8..36b2880 100755 --- a/src/bin/index.ts +++ b/src/bin/index.ts @@ -18,6 +18,7 @@ program ) .option("-b, --branch ", "Branch to pentest") .option("-l, --level ", "Pentest level: priority or full", "full") + .option("--quick", "Run a quick pentest (highest-risk endpoints only, ~15 mins). Shorthand for --level priority") .option("--no-wait", "Don't wait for pentest to complete") .option("-e, --environment ", "Environment: dev, staging, or production") .option( @@ -44,11 +45,15 @@ program process.exit(1); } + const scanLevel: "priority" | "full" = options.quick + ? "priority" + : (options.level as "priority" | "full"); + const result = await CI.runScan({ projectId: options.project, repoId: options.repoId ? parseInt(options.repoId, 10) : undefined, branch: options.branch, - scanLevel: options.level as "priority" | "full", + scanLevel, wait: options.wait, environment: options.environment as Environment | undefined, errorSeverityThreshold: severityThreshold,