Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <project-id>

# Run a quick pentest (highest-risk endpoints only, ~15 mins)
pensar pentest --project <project-id> --quick

# Check pentest status
pensar status <scan-id>
```
Expand All @@ -24,7 +27,8 @@ pensar status <scan-id>
| ------------------- | --------------------------------------------------------------------------- |
| `-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`) |
Expand Down
7 changes: 6 additions & 1 deletion src/bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ program
)
.option("-b, --branch <branch>", "Branch to pentest")
.option("-l, --level <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 <env>", "Environment: dev, staging, or production")
.option(
Expand All @@ -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,
Expand Down