CI/CD Integration
CI/CD Integration
Integrate netbobr into your CI/CD pipeline to validate firewall rules automatically on every change. The CLI produces machine-readable output and exit codes that keep tool errors apart from policy failures.
npx --yes @netbobr/cli@2 analyze firewall-rules.csv --fail-on highPin the major version (@2) in pipelines, so a future major release cannot change your gate silently.
Exit Codes
| Exit Code | Meaning |
|---|---|
| 0 | Pass. The analysis completed, no flow has a finding at or above --fail-on, and no flow has a DENY verdict. Zero flows also pass, with a notice on stderr. |
| 1 | Error. There is no trustworthy result. Causes: a bad flag, value or flag combination; missing, unreadable or unparseable input or config; input that does not match an explicit --cloud-format; an invalid config value; one or more invalid flows; a failure to write the report; a crash. npm/npx and Node.js errors are also 1. |
| 2 | Policy failure. The analysis completed, and at least one flow has a finding at or above --fail-on or a DENY verdict (from a custom rule or a zone-matrix Deny policy). |
2 is the only non-zero code you may tolerate. Any other code means netbobr did not finish, including signals (128 and above) and 1. A recipe that lets exit code 1 pass would also pass a missing file, a typo in a flag, or a crash.
When a run has both invalid flows and policy failures, it exits 1. Invalid flows can never hide behind a tolerated 2.
Gating with --fail-on
--fail-on <level> sets the gate. The default is medium. A flow fails the gate when one of its findings (framework, custom or built-in) is at or above the level, or when its verdict is DENY.
| Value | Exits 2 when a flow has... |
|---|---|
critical | a CRITICAL finding, or a DENY verdict |
high | a HIGH or CRITICAL finding, or a DENY verdict |
medium (default) | a MEDIUM, HIGH or CRITICAL finding, or a DENY verdict |
low | a LOW or higher finding, or a DENY verdict |
info | any finding, or a DENY verdict |
none | never: report only. Errors still exit 1. |
- Values are case-insensitive. An invalid value is an error (exit 1).
- The overall risk level never gates. It is explained in each flow's
verdictReason. - Every output format shows the same per-flow verdict (
ALLOW,REVIEWorDENY) that drives the exit code.
Migrating from @netbobr/cli 1.x
1.x used graded exit codes: 1 MEDIUM, 2 HIGH, 3 CRITICAL, and every error was also 1. In 2.x:
| 1.x recipe | 2.x recipe |
|---|---|
test $? -eq 3 (critical only) | --fail-on critical, then test $? -eq 2 |
test $? -ge 2 (high or critical) | --fail-on high; any non-zero code fails |
GitLab allow_failure: exit_codes: [1] | allow_failure: exit_codes: [2] |
Jenkins rc == 1 → UNSTABLE | rc == 2 → UNSTABLE, any other non-zero code → FAILED |
continue-on-error / || true to keep the SARIF file | --output-file results.sarif (the file is written before the exit code is set) |
Other changes:
- Built-in findings (
BUILTIN-*) now gate. --fail-on lowfails on LOW findings.- Unknown
--frameworksnames are errors. - Invalid flows exit 1.
- The JSON output is always an object with
results,invalidFlows,warningsandsummary.
Output Formats for CI
| Format | Flag | Use Case |
|---|---|---|
| JSON | --output json | Machine parsing, custom integrations |
| SARIF | --output sarif | GitHub Code Scanning, GitLab SARIF reports, VS Code |
| CSV | --output csv | Spreadsheet import, data analysis |
| Table | --output table | Human-readable logs |
--output pdf | Compliance reports, change tickets |
- Use
--output-file <path>to write any format to a file instead of stdout. It removes the need for shell redirection and|| true. --quietsuppresses the stdout report and informational messages. Errors are always printed.- Parser warnings and invalid flows are included in every format.
Inputs and Configuration
- Flows: CSV or JSON. The web app's CSV template works unchanged.
- Cloud formats: pass
--cloud-format aws-sg,azure-nsg,gcp-fw,tf-plan,tf-hcl(Terraform source files) ork8s-netpol, or--cloud-format autoto detect the format. - Configuration:
--config netbobr-session.jsonapplies a session saved in the web app (Session Control > Save): zones and zone policies, custom rules, zone attributes and disabled rules.- A session's old
riskWeightsblock is ignored with a warning, as it is in the web app. - To override risk weights or thresholds in the CLI, add flat
weights/thresholdskeys (see Thresholds). - An invalid config is an error (exit 1).
- A session's old
- Inline:
--src,--dst,--proto,--port, plus--app-name "<purpose>". Without--app-name, the documentation rules report the flow as undocumented.
Platform Guides
Workflow examples with SARIF upload to Code Scanning and PDF artifact generation.
Pipeline YAML with severity gating and build artifact publishing.
Blocking and report-only jobs, SARIF reports and exit code handling.
Declarative pipeline stages with Warnings NG SARIF import and custom exit code handling.