npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cloudsecuritylt/fw-check

v2.0.0

Published

Firewall Rule Check CLI by cloudsecurity.lt: pipe-friendly firewall rule risk analysis for CI/CD

Readme

@cloudsecuritylt/fw-check

Firewall Rule Check CLI by cloudsecurity.lt. Formerly published as @netbobr/cli (command netbobr).

Pipe-friendly CLI for firewall rule risk analysis. Validates flows against 6 compliance frameworks (PCI-DSS, CIS Controls, NIST 800-53, NIS2, DORA, MITRE ATT&CK) plus Firewall Rule Check's built-in checks and your custom rules, produces risk scores, and returns exit codes designed for pipeline gating.

Install

npm install -g @cloudsecuritylt/fw-check

Or run directly with npx (zero install). In CI, pin the major version:

npx --yes @cloudsecuritylt/fw-check@2 analyze ...

Usage

Inline flags

fw-check analyze --src 10.0.0.0/8 --dst 203.0.113.5 --proto tcp --port 22 --app-name "Jump host SSH"

--src, --dst, --proto and --port are all required for inline analysis. --app-name sets the application name / business purpose. Without it, the documentation rules (for example PCI-NET-070) report the flow as undocumented. For ICMP, --port takes ICMP type numbers (0,8) or all.

File input

fw-check analyze firewall-rules.csv --fail-on high

CSV input is comma-separated with RFC 4180 quoting:

  • A leading UTF-8 BOM, blank lines and lines starting with # are skipped.

  • If the first row is a header, columns are matched by name in any order. Unknown columns are ignored. The accepted names are below; matching ignores case, and spaces and hyphens count as _.

    | Field | Accepted header names | |-------|-----------------------| | src | src, source, source_ip, src_ip, from | | dst | dst, destination, destination_ip, dst_ip, dest, to | | proto | proto, protocol | | port | port, ports, dst_port, destination_port | | appName | appName, app_name, app, application, application_business_purpose, business_purpose |

  • Without a header, the web app's column order applies: source, destination, protocol, port, and an optional purpose. The web app's CSV template works unchanged.

  • Put port lists in double quotes, e.g. "80,443". A row with more fields than the header is reported as an invalid flow instead of being shifted silently.

  • The CLI has no row limit (the web app imports at most 500 rows).

JSON input is a flow object or an array of them: {"src": "...", "dst": "...", "proto": "...", "port": "...", "appName": "..."}. Keys accept the same aliases, ports may be numbers, and other keys are echoed back in the output. A JSON syntax error is reported as such.

If the input is actually a cloud export or a Firewall Rule Check session, the error says so and names the flag to use (--cloud-format <format> or --config).

Stdin pipe

cat rules.json | fw-check analyze - --output json
terraform show -json tfplan | fw-check analyze - --cloud-format tf-plan --stdin-filename tfplan.json

--stdin-filename sets the file name reported for stdin input, which is the SARIF artifact location.

Cloud formats

Auto-detect or specify the cloud input format. The CLI runs the same parsers as the web app.

# Terraform plan JSON
terraform show -json tfplan | fw-check analyze - --cloud-format tf-plan --fail-on high

# Terraform HCL (.tf source); concatenate a module's files
fw-check analyze main.tf --cloud-format tf-hcl
cat *.tf | fw-check analyze - --cloud-format tf-hcl

# AWS Security Groups
fw-check analyze sgs.json --cloud-format aws-sg --output sarif --output-file results.sarif

# Kubernetes NetworkPolicy (YAML; uses the npm js-yaml package)
fw-check analyze netpol.yaml --cloud-format k8s-netpol

# Azure NSG / GCP firewall rules
fw-check analyze nsg.json --cloud-format azure-nsg
fw-check analyze gcp.json --cloud-format gcp-fw

# Auto-detect
fw-check analyze cloud-export.json --cloud-format auto

The supported formats are aws-sg, azure-nsg, gcp-fw, tf-plan, tf-hcl, k8s-netpol and auto. A bare --cloud-format means auto. Put the input file before a bare --cloud-format, otherwise the file name is read as the format.

  • Rules that cannot be fully resolved produce parser warnings. They are always part of the report and never dropped silently. Examples are security-group references, tags, variables, IPv6-only rules, and placeholders substituted with 0.0.0.0/0.
  • Each flow carries flow.metadata: source, groupName, ruleName, ruleId and direction (inbound/outbound).
  • An export with no analyzable rules has zero flows. It exits 0 and still reports its warnings.
  • With an explicit --cloud-format, zero flows from input that does not even look like that format is an error (exit 1). Examples: a Firewall Rule Check flows file passed as aws-sg, or a ConfigMap passed as k8s-netpol. A legitimately empty export of the right kind, such as a default-deny NetworkPolicy, still passes. The empty export must still be recognisable as that format. An empty list ([] from gcloud or az, or a kubectl List with no items) and a Terraform plan without planned_values cannot be identified, so they exit 1.

Output Formats

| Format | Flag | Use Case | |--------|------|----------| | JSON | --output json | Machine parsing, custom integrations | | Table | --output table | Human-readable terminal output | | CSV | --output csv | Spreadsheet import, data analysis | | SARIF | --output sarif | GitHub Code Scanning, VS Code | | PDF | --output pdf | Compliance reports |

  • Without --output, the format is table on an interactive terminal and json otherwise, including when --output-file is given.
  • --output-file <path> writes any format to a file instead of stdout. - means stdout. Without --output-file, PDF is written to fw-check-report.pdf. The CLI does not create missing directories; a write failure exits 1.
  • --quiet prints no report on stdout and no informational messages on stderr. Errors are still printed, and --output-file is still written.

One verdict everywhere

Every format, and the exit code, uses the same verdict for each flow:

| Verdict | When | |---------|------| | DENY | A custom rule forces DENY (verdictOverride), or the zone-matrix policy between the flow's zones is Deny | | REVIEW | At least one finding (framework, custom or built-in) is at or above --fail-on | | ALLOW | Otherwise |

overallRisk (the highest single factor) never gates. It appears in each flow's verdictReason. For example, internal RDP with no findings is ALLOW, and its reason says "Overall risk HIGH (port: RDP 3389/TCP): informational, it does not gate".

JSON shape

The top level is always the same object, whether or not there are warnings or invalid flows:

{
  "tool": { "name": "Firewall Rule Check", "version": "2.0.0" },
  "summary": {
    "flowsAnalyzed": 3, "invalidFlows": 0, "warnings": 0,
    "failOn": "medium", "gate": "FAILED", "exitCode": 2,
    "verdicts": { "ALLOW": 2, "REVIEW": 1, "DENY": 0 },
    "maxSeverity": "HIGH", "maxOverallRisk": "HIGH"
  },
  "results": [{
    "index": 1, "line": 10, "flow": { "src": "...", "dst": "...", "proto": "TCP", "port": "443" },
    "riskScore": 13, "riskLevel": "Low", "overallRisk": "MEDIUM",
    "verdict": "ALLOW", "verdictReason": "...", "maxSeverity": "LOW",
    "findings": [{ "ruleId": "BUILTIN-SRC-BROAD", "severity": "LOW", "framework": "Built-in",
                   "frameworkKey": "builtin", "finding": "...", "remediation": "" }],
    "advice": [{ "severity": "INFO", "text": "..." }],
    "zone": { "srcZone": "dmz", "dstZone": "db", "policy": "deny" },
    "cloudResource": { "source": "aws-sg", "groupName": "...", "ruleName": "...", "ruleId": "..." }
  }],
  "invalidFlows": [{ "index": 2, "line": 11, "flow": {}, "verdict": "INVALID", "errors": { "src": "..." } }],
  "warnings": [{ "type": "...", "message": "..." }]
}
  • line is the CSV source line, or null for JSON, cloud and inline input.
  • zone is null when no zone matrix is active. policy is null when one side is outside every zone.
  • cloudResource is null for non-cloud input.
  • advice lists informational notes without a rule ID, such as ICMP type notes and the same-subnet zone note. These never gate.
  • 1.x printed a bare array when there were no warnings. Read .results instead.

CSV columns

The header is always line 1. There is one row per finding per flow:

src,dst,proto,port,risk_score,risk_level,overall_risk,verdict,rule_id,severity,framework,finding,cloud_resource,row_type,app_name,src_zone,dst_zone,zone_policy,remediation,error

  • row_type is finding, clean (a flow without findings), invalid (verdict INVALID, reason in error), or warning (a parser warning: rule_id is PARSER-WARN, severity is WARNING, framework is the warning type).
  • zone_policy is ALLOW, REVIEW, DENY, NO MATCH, or empty when no zones are configured.
  • Cells that start with =, +, -, @, a tab or a line break are prefixed with ' so spreadsheets do not run them as formulas.

SARIF

SARIF 2.1.0 output follows GitHub code scanning's requirements:

  • Every result points at the analyzed file. artifactLocation.uri is relative to the working directory: run Firewall Rule Check from the repository root. A file outside it is written as a file:// URL. stdin is stdin, or the --stdin-filename value. Inline input is netbobr-inline.
  • The region's startLine is the CSV source line, or 1 for JSON and cloud input. The flow itself is a logicalLocation, and for cloud input the message names the resource ([flow | aws-sg: group / rule]).
  • partialFingerprints.primaryLocationLineHash identifies a finding by rule and flow, not by line, so alerts survive reordering.
  • Rules carry security-severity (CRITICAL 9.5, HIGH 8.0, MEDIUM 5.5, LOW 3.0, INFO 1.0) and a helpUri.
  • Levels: CRITICAL is error, HIGH is warning, everything else is note.
  • Extra rules: PARSER-WARN (note), NETBOBR-INVALID-FLOW (error; the run's executionSuccessful is then false) and NETBOBR-ZONE-DENY (error).

Exit Codes

Firewall Rule Check 2.x keeps tool errors and policy findings apart:

| Exit Code | Meaning | |-----------|---------| | 0 | Pass: the analysis completed, no flow has a finding at or above --fail-on, and no flow is DENY (or --fail-on none was used). Zero flows also pass, with a notice on stderr. | | 1 | Error: no trustworthy result. Causes: a bad flag, value or flag combination; missing, unreadable or unparseable input or config; an invalid config value; one or more invalid flows; a write failure; a crash. Node, npm/npx and commander 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. |

  • 1 takes precedence over 2, so invalid flows can never hide behind a tolerated policy failure.
  • In CI, 2 is the only non-zero code you may tolerate. Anything else, including signals (128 and above), means Firewall Rule Check did not finish.

--fail-on

--fail-on <level> takes info, low, medium, high, critical or none, case-insensitive. The default is medium. A flow trips the gate when any of its findings is at or above the level, or when its verdict is DENY (at every level except none).

fw-check analyze rules.csv --fail-on high       # fail on high or critical findings, or DENY
fw-check analyze rules.csv --fail-on critical   # fail only on critical findings, or DENY
fw-check analyze rules.csv --fail-on low        # fail on any LOW-or-higher finding
fw-check analyze rules.csv --fail-on info       # fail on any finding at all
fw-check analyze rules.csv --fail-on none       # report only: never exits 2 (errors still exit 1)

An invalid value (--fail-on severe) is an error (exit 1) that lists the allowed values.

Migrating from 1.x

1.x used graded codes: 1 MEDIUM, 2 HIGH, 3 CRITICAL, and every error was also 1.

| 1.x usage | 2.x equivalent | |-----------|----------------| | test $? -eq 3 (critical only) | --fail-on critical, then test $? -eq 2 | | test $? -ge 2 (high or critical) | --fail-on high (any non-zero fails) | | GitLab allow_failure: exit_codes: [1] | allow_failure: exit_codes: [2] (never tolerate 1) | | Jenkins rc == 1 → unstable | rc == 2 → unstable, any other non-zero → error | | continue-on-error / \|\| true to keep a SARIF file | not needed: --output-file writes the report before the exit code is set |

Other changes in 2.x:

  • Built-in findings (BUILTIN-*) are now reported and gate like framework findings.
  • --fail-on low now fails on LOW findings.
  • Unknown --frameworks names are now errors.
  • Invalid flows now exit 1.
  • The JSON top level is always an object.
  • Pin @cloudsecuritylt/fw-check@2 in pipelines.

Frameworks

--frameworks <list> evaluates only the listed frameworks. The keys are case-insensitive:

| Key | Framework | Aliases | |-----|-----------|---------| | pci | PCI-DSS | pci-dss | | cis | CIS Controls | cis-controls | | nist | NIST 800-53 | nist-800-53 | | nis2 | NIS2 | | | dora | DORA | | | mitre | MITRE ATT&CK | mitre-attack, attack | | builtin | Built-in checks (the registered BUILTIN-* rules) | built-in |

  • Custom rules always run.
  • An unknown or empty list is an error (exit 1).
  • Listing keys selects only those, so --frameworks pci also drops the built-in findings.

Configuration

--config <file> accepts a Firewall Rule Check session saved in the web app (Session Control > Save) or a hand-written flat config. All sections are optional:

| Key | Session / flat form | Notes | |-----|---------------------|-------| | zoneMatrix / zones | Session: zoneMatrix. Flat: zones as an array of {name, subnets}, or {zones, policies, sameZonePolicy, interZonePolicy} | Policy keys are "source→destination"; "source->destination" is accepted. A subnet defined in two zones is kept in the first and dropped with a warning. | | customRules | an array of rules, or the session's {rules, nextId} | Normalised like the web app: at most 25 rules; invalid rules are dropped with a warning. | | zoneAttributes | keyed by zone name (sessions version 5+, or zoneAttributesKeyedBy: "name"); legacy version 4 sessions key by z1, z2, … (converted by zone order, with a notice) | The legacy explicit {src: {...}, dst: {...}} shape still works. | | disabledRules | array of rule IDs | Unknown IDs give a warning. | | weights, thresholds | flat keys only | Weights: srcMax, dstMax, portMax, zoneMax, each an integer 0-100, scaled proportionally. Thresholds: exactly 4 tiers, integer max, ascending, last = 100. |

  • A session's riskWeights block is ignored with a warning. The web app ignores it too, so scores stay identical to the browser. Use flat weights/thresholds to override the defaults in the CLI.
  • An unreadable or invalid config (bad JSON, a non-object, invalid zones, weights or thresholds) is an error (exit 1). Recoverable problems are printed as warnings on stderr.
fw-check analyze rules.csv --config fw-check-session.json

CI/CD Integration

GitHub Actions

- name: Analyze firewall rules
  run: npx --yes @cloudsecuritylt/fw-check@2 analyze firewall-rules.csv --fail-on high --output sarif --output-file results.sarif
- name: Upload SARIF to Code Scanning
  if: ${{ !cancelled() && hashFiles('results.sarif') != '' }}
  uses: github/codeql-action/upload-sarif@v3
  with:
    sarif_file: results.sarif

The job fails on a policy failure (2) or an error (1). The SARIF file is written either way and uploaded by the second step.

Azure DevOps

- script: npx --yes @cloudsecuritylt/fw-check@2 analyze firewall-rules.csv --fail-on high
  displayName: 'Validate firewall rules'

GitLab CI

firewall-validation:
  image: node:20
  script:
    - npx --yes @cloudsecuritylt/fw-check@2 analyze firewall-rules.csv --fail-on high

See the full CI/CD documentation for detailed platform guides, including Jenkins, SARIF, PDF artifacts, report-only jobs and severity gating.

Flags Reference

| Flag | Description | |------|-------------| | [file] | Input file (CSV, JSON, or a cloud format with --cloud-format); - reads stdin | | --src <ip> | Source IP/CIDR for inline analysis | | --dst <ip> | Destination IP/CIDR for inline analysis | | --proto <protocol> | Protocol: TCP, UDP, ICMP or ANY | | --port <port> | Port, range or list (e.g. 443, 8000-9000, "80,443"); ICMP: type numbers or all | | --app-name <text> | Application name / business purpose of the inline flow (inline only) | | --output <format> | json, table, csv, sarif, pdf (default: table on a TTY, else json) | | --output-file <path> | Write the report to a file, for any format (- = stdout; PDF default fw-check-report.pdf) | | --config <path> | Firewall Rule Check session JSON or flat config | | --fail-on <level> | info, low, medium (default), high, critical, none | | --frameworks <list> | Comma-separated framework keys (see above); custom rules always run | | --cloud-format [format] | aws-sg, azure-nsg, gcp-fw, tf-plan, tf-hcl, k8s-netpol, auto (bare flag = auto) | | --stdin-filename <path> | File name reported for stdin input (SARIF artifact location) | | --quiet | No stdout report and no informational stderr; errors are still printed and --output-file is still written | | -V, --version | Print the CLI version |

License

MIT