Skip to main content
The pensar benchmark command runs automated security benchmarks across different branches of a repository, comparing vulnerability counts and security posture between code versions.

Synopsis

Description

Benchmark mode performs automated pentests on specified branches of a repository, allowing you to:
  • Compare security posture across branches
  • Track vulnerability trends over development cycles
  • Validate that security fixes reduce vulnerabilities
  • Test multiple code versions efficiently
Benchmark mode requires local access to a git repository with the source code.

Arguments

string
required
Path to the git repository to benchmark.
Must be a valid git repository with at least one branch.
string[]
Specific branches to benchmark (optional).
If not specified, uses --all-branches behavior or defaults to current branch.

Options

boolean
Test all branches in the repository.
Useful for comprehensive security audits across entire codebase history.
number
Limit the number of branches to test.
Tests only the first N branches (by git branch listing order).
number
Skip the first N branches.
Useful for paginating through large branch lists.
string
default:"claude-sonnet-4-5"
AI model to use for benchmarking.
Higher-capability models may find more vulnerabilities but cost more.

Examples

Basic Branch Comparison

Compare security posture between two branches:

Test All Branches (Limited)

Benchmark the 3 most recent branches:

Feature Branch Validation

Test if a security fix reduces vulnerabilities:

CI/CD Integration

Run benchmark in continuous integration:
.github/workflows/benchmark.yml

How It Works

1

Repository Preparation

Pensar clones or accesses the specified repository and validates it’s a git repo.
2

Branch Iteration

For each specified branch:
  1. Checks out the branch
  2. Runs whitebox pentest on the codebase
  3. Stores findings separately per branch
3

Results Comparison

After all branches are tested, generates a comparison report showing:
  • Vulnerability counts per severity
  • New vulnerabilities introduced
  • Vulnerabilities fixed
  • Trend analysis
4

Report Generation

Creates markdown and JSON reports in:

Use Cases

Track security improvements across development:
Monitor if new features introduce vulnerabilities.

Limitations

Benchmark mode needs full source code access. It cannot run on blackbox targets without source.
Each branch takes 5-15 minutes to test depending on codebase size. Benchmarking 10 branches may take 1-2 hours.
Tests the code as it exists on each branch at the time of testing. Does not account for runtime environment differences.
AI-based testing may find different vulnerabilities on repeated runs of the same branch. Use consistent models for comparability.

Troubleshooting

Ensure the path points to a valid git repository:
Initialize git if needed:
Verify branch exists:
Fetch remote branches if needed:
Use --limit to reduce branches:
Or test specific branches only:

Next Steps

Whitebox Testing

Learn more about source code security analysis

CI/CD Integration

Automate benchmarks in your pipeline

Pentest Command

Run standard pentests instead of benchmarks

API Reference

Use the benchmark API programmatically