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-core

v1.1.0

Published

Firewall rule risk analysis engine -- compliance checks, risk scoring, and custom rules

Readme

@cloudsecuritylt/fw-check-core

Firewall Rule Check engine by cloudsecurity.lt. Formerly published as @netbobr/core.

Firewall rule risk analysis engine. Analyzes network flows against 6 compliance frameworks (PCI-DSS, CIS Controls, NIST 800-53, NIS2, DORA, MITRE ATT&CK) and produces risk scores -- stateless analysis, zero dependencies. The only process-wide setting is the optional js-yaml loader for Kubernetes YAML (setYamlLoader, see below).

Install

npm install @cloudsecuritylt/fw-check-core

Usage

import { analyze } from '@cloudsecuritylt/fw-check-core';

const result = analyze(
  { src: '10.0.0.1', dst: '0.0.0.0/0', proto: 'TCP', port: '22' },
  { /* optional config */ }
);

console.log(result.riskScore);    // { score: 73, label: 'High', factors: [...] }
console.log(result.overallRisk);  // 'HIGH'
console.log(result.pciFindings);  // [{ ruleId, severity, finding, ... }]

API

analyze(flow, config?)

flow { src, dst, proto, port, appName? } -- the firewall rule to analyze.

config (all optional):

  • disabledRuleIds -- Set<string> of rule IDs to suppress
  • zoneInfo -- zone matrix lookup result (pre-computed)
  • zones -- raw zone config (zone-matrix JSON shape); analyze() will perform zone matching internally
  • customRules -- array of custom rule objects
  • weights -- { srcMax, dstMax, portMax, zoneMax } per-factor caps, each an integer 0-100. Defaults: 25/30/25/20. They need not sum to 100 (the score is clamped to 0-100). analyze() uses the values as given; check user input with validateRiskConfig first
  • thresholds -- [{ max, label }, ...]: exactly 4 tiers (Low, Medium, High, Critical), integer max values strictly ascending with the last one 100, and unique non-empty labels (see validateThresholds)
  • zoneAttributes -- { src: {...}, dst: {...} } zone attribute objects, or a map keyed by zone name ({ "<zone name>": {...} }) that is resolved against the flow's matched zones

Returns: { ok, overallRisk, riskScore, pciFindings, cisFindings, nistFindings, nis2Findings, doraFindings, mitreFindings, customFindings, advice, breakdownRows, verdictOverride, ... }

Cloud parsers

The same parsers the Firewall Rule Check browser app uses. They turn cloud firewall exports into flows for analyze(). Also available as the subpath @cloudsecuritylt/fw-check-core/cloud-parsers, which is the same module instance as the main entry.

Format ids: aws-sg, azure-nsg, gcp-fw, tf-plan, tf-hcl, k8s-netpol.

  • parseCloudConfig(content, format?): async. Returns { flows, warnings }. format is a format id; omit it or pass 'auto' to detect. Each flow is { src, dst, proto, port, appName, metadata }, and metadata carries source (the format id), groupName, ruleName, ruleId, description and direction. Each warning is { type, message, ... }. Rejects on input it cannot parse.
  • detectCloudFormat(content): returns a format id, or null.
  • setYamlLoader(loader): Kubernetes YAML needs js-yaml. By default it is loaded from a CDN (browser only). In Node, inject it before parsing YAML. loader is a function returning js-yaml or a promise of it (a module namespace with a default export also works). It is called once, on first use, and the result is cached. null restores the CDN default. The setting is process-wide.
import { parseCloudConfig, setYamlLoader } from '@cloudsecuritylt/fw-check-core';

setYamlLoader(() => import('js-yaml')); // npm install js-yaml (only needed for k8s-netpol)

const { flows, warnings } = await parseCloudConfig(yamlText, 'k8s-netpol');

If js-yaml cannot be loaded, the error has err.code === 'YAML_LOADER_UNAVAILABLE'.

Other exports

| Export | Purpose | |---|---| | parseIP(value), parsePort(value) | Input parsing and validation used by analyze() | | computeRiskScore(...) | The 0-100 risk score on its own | | buildFlowContext, evaluateCustomRules, FIELD_CATALOG | Custom-rule engine | | normalizeCustomRules(state) | Validate a saved custom-rule state. Returns { rules, nextId, warnings } | | DEFAULT_WEIGHTS, DEFAULT_THRESHOLDS | Default risk weights and the 4 score thresholds | | validateRiskConfig({ weights, thresholds }) | Returns { ok, errors, warnings, weights, thresholds }. Treat ok === false as a configuration error | | validateWeights(w), validateThresholds(t) | The two halves of validateRiskConfig | | validateZoneConfig(state) | Validate a zone config (zone-matrix JSON shape) without side effects. Returns { errors, warnings, zones, active } | | resolveZoneInfoFromConfig(state, src, dst) | Zone lookup for one flow against a zone config | | ATTRIBUTE_DEFS | Zone attribute definitions | | normalizeZoneAttributes(raw, { keyedBy, saveOrderNames, knownZones }) | Validate zone attributes. Returns { attributes, warnings } keyed by zone name. keyedBy is 'name', 'id' or 'auto' | | convertLegacyZoneAttributes(idKeyedMap, zoneNamesInSaveOrder) | Convert legacy id-keyed (z1, z2, ...) attributes to name-keyed | | ZONE_ATTRIBUTES_KEYED_BY | 'name': the key type of saved zone attributes | | ALL_RULES, ACTIVE_RULES, isDormantRule(ruleOrId) | Rule registry. ACTIVE_RULES excludes dormant (not evaluated) rules | | parseFlowCSV(text, { rowLimit }) | Parse a flow CSV (source, destination, protocol, port, optional purpose) | | readCSVRecords(text, delimiter, { skipComments }), isHeaderRecord(cells) | Lower-level CSV reading | | escapeCSVCell(value), neutralizeFormula(value) | CSV output escaping with spreadsheet-formula neutralization (OWASP CSV injection) | | RESULTS_CSV_COLUMNS | Column order of the Firewall Rule Check results CSV |

License

MIT