guardrail-api audit --spec ./openapi.yaml --format sarif
Guardrail API API security auditing
- CLI, npm package & GitHub Action
- OpenAPI 2.0–3.1, SAST & DAST
- SARIF 2.1.0 ready
A command-line tool for backend developers and CI/CD pipelines. It combines OpenAPI contract linting against OWASP API Security flaws with live dynamic probes to prevent security leaks before deployment.
Run summary
guardrail-api audit --spec ./openapi.yaml --static-only
| Metric | Value | Detail |
|---|---|---|
| Startup time | <300ms | Instant startup on CI runners |
| Security standard | SARIF 2.1.0 | Integrates with GitHub Code Scanning |
| TypeScript & ESM | 100% | Strict typing with no heavy dependencies |
| Automated suite | Vitest | Tests for rules, reports and HTTP probes |
CLI preview
guardrail-api audit --spec ./openapi.yaml --target https://api.prod.local --fail-on high
Hybrid engine: linting and active probes
// Static contract inspection and active validation without flooding the network or corrupting data.
guardrail-api audit --spec ./openapi.yaml --target http://localhost:3000
- SAST
OpenAPI static analysis
OKSwagger Parser
Inspects OpenAPI 2.0 (Swagger), 3.0 and 3.1 contracts in JSON or YAML, dereferencing schemas ($ref) to detect unauthenticated endpoints, unvalidated input, insecure transport or secrets in examples, with every finding pinned to its line in the spec.
- DAST
Active dynamic probes
OKNative fetch · safe mode by default
Sends targeted requests to the live API (only GET, HEAD and OPTIONS by default) to verify rejection without credentials, BOLA with two identities, security headers (HSTS, CSP), permissive CORS, verbose errors and undocumented HTTP methods.
- CI/CD
Quality gate & SARIF
OKSARIF 2.1.0 + exit codes + baseline
--fail-on thresholds that return exit code 1 to block the pipeline, a baseline so only new findings break the build, exit code 2 when the scan cannot be trusted, and an official GitHub Action that uploads the SARIF report to Code Scanning.
3 stages completed
OWASP API Security Top 10 coverage
guardrail-api audit --spec ./openapi.yaml --fail-on high
Native SARIF 2.1.0 export
-
[CRITICAL] API1:2023 Broken Object Level Authorization (BOLA)
DY-005: with two identities (--auth-b), checks whether user B can read user A's objects (BOLA/IDOR).
Automated
-
[CRITICAL] API2:2023 Broken Authentication
ST-001, ST-003, ST-005 and DY-001: endpoints with no declared authentication, weak OAuth2 flows and secured routes that answer 2xx without credentials.
Automated
-
[MEDIUM] API7:2023 Server Side Request Forgery (SSRF)
ST-006: flags contract parameters that accept URLs (callback, webhook, redirect) and are exposed to SSRF or open redirects.
Automated
-
[HIGH] API8:2023 Security Misconfiguration
ST-004, ST-007, DY-002, DY-003, DY-004 and DY-007: plain HTTP, secrets in examples, missing HSTS/CSP headers, permissive CORS, 500 errors and leaked stack traces.
Automated
CLI stack
cat package.json | jq .dependencies
- TypeScript 5.7
- Language
- Strict typing in the analysis engine
- Node.js 20+ (ESM)
- Runtime
- High-performance native ECMAScript modules
- Commander.js
- CLI
- Terminal flag and argument handling
- Swagger Parser
- Parser
- OpenAPI contract resolution and validation
- fetch (Node.js)
- HTTP
- Non-destructive dynamic requests against endpoints
- Vitest
- Testing
- Unit and integration test suite
- SARIF 2.1.0
- Standard
- Official format for GitHub Security tabs
- cli-table3
- Terminal UI
- Clean, colorized console output