Updated Jul 14, 2026

Static Code Analysis

Flag known-vulnerable JavaScript and Node library versions

Detects JavaScript and Node library versions with published vulnerabilities.

Agent

overview

What retire-js does

Before a release, ask whether the project still ships a JS or Node library version with a published advisory. retire-js fingerprints components under --path and matches each version to known-vulnerable releases.

Widen file types with --ext, skip vendored trees with --ignore or --ignorefile, fail the process at a chosen --severity, and emit text, JSON, or CycloneDX through --outputformat (optional --includeOsv).

Semgrep covers multi-language SAST patterns; trivy spans many ecosystems and containers. retire-js stays JS/Node-focused. Point --path at a project folder; findings write to FILE plus FOLDER for pipeline triage.

source github.com/RetireJS/retire.js

use cases

Where retire-js fits

Detect known-vulnerable JavaScript and Node libraries

Scan a project's JavaScript files and match each library version against the vulnerability database to flag the ones with published advisories, from bundled front-end scripts to node_modules.

Gate a build on severity

Set --severity so the scan exits non-zero when it finds an issue at or above the level you pick, stopping a pipeline before a risky release ships.

Produce an SBOM for JavaScript dependencies

Emit a CycloneDX format through --outputformat to generate a software bill of materials that records every JavaScript component and its known issues, optionally adding OSV advisories with --includeOsv.

Scope the scan to code you own

Pass an --ignore path list or an --ignorefile to skip vendored or third-party directories so the report focuses on the libraries your project ships.

reference

retire-js inputs and flags

15 inputs
NameTypeFlagDescription
pathFOLDER--pathFolder to scan for JavaScript files.
extSTRING--extComma-separated list of file extensions for JavaScript files. Default: js.
severitySTRING--severitySeverity level at which the process fails: none, low, medium, high, critical. Default: none.
outputformatSTRING--outputformatOutput format: text, json, jsonsimple, depcheck, and CycloneDX variants.
ignoreSTRING--ignoreComma-delimited list of paths to ignore.
deepBOOLEAN--deepDeep scan (slower and experimental).
includeOsvBOOLEAN--includeOsvInclude OSV advisories in the output.
nocacheBOOLEAN--nocacheDo not use the local cache.

Showing key inputs. retire-js exposes 15 inputs in total.

Full flag reference (15 inputs)
NameTypeFlagDescription
extSTRING--extComma separated list of file extensions for JavaScript files. The default is "js".
deepBOOLEAN--deepDeep scan (slower and experimental).
pathFOLDER--pathFolder to scan for JavaScript files.
proxySTRING--proxyProxy url (http://some.host:8080).
cacertFILE--cacertUse the specified certificate file to verify the peer used for fetching remote jsrepo/noderepo files.
colorsBOOLEAN--colorsEnable color output (console output only).
ignoreSTRING--ignoreComma delimited list of paths to ignore.
jsrepoSTRING--jsrepoLocal or internal version of repo. Can be multiple comma separated. Default: central.
nocacheBOOLEAN--nocacheDon't use local cache.
verboseBOOLEAN--verboseShow identified files (by default only vulnerable files are shown).
insecureBOOLEAN--insecureEnable fetching remote jsrepo/noderepo files from hosts using an insecure or self-signed SSL (TLS) certificate.
severitySTRING--severitySpecify the bug severity level from which the process fails. Allowed levels none, low, medium, high, critical. Default: none.
ignorefileFILE--ignorefileCustom ignore file, defaults to .retireignore / .retireignore.json.
includeOsvBOOLEAN--includeOsvInclude OSV advisories in the output.
outputformatSTRING--outputformatValid formats: text, json, jsonsimple, depcheck (experimental), cyclonedx, cyclonedxJSON, cyclonedxJSON1_6, cyclonedxJSON1_6_VEX.

example

Run retire-js

retire-js · command
# scan a web project, widen extensions, fail on high-severity findingsretire --path ./web/src --ext js,mjs --severity high --outputformat json --ignore node_modules,vendor
sample output
/web/src/vendor/jquery-1.12.4.min.js ↳ jquery 1.12.4 has known vulnerabilities: severity: medium; CVE: CVE-2019-11358; https://github.com/advisories/GHSA-6c3j-c64m-qhgq ↳ jquery 1.12.4 has known vulnerabilities: severity: medium; CVE: CVE-2020-11022, CVE-2020-11023/web/src/vendor/angularjs-1.5.8.min.js ↳ angularjs 1.5.8 has known vulnerabilities: severity: high; CVE: CVE-2020-7676; summary: angular.js XSS via SVG usemap/web/src/vendor/bootstrap-3.3.7.min.js ↳ bootstrap 3.3.7 has known vulnerabilities: severity: medium; CVE: CVE-2018-14041; summary: XSS in data-target

guidance

Choosing retire-js

Use retire-js when the risk is vulnerable JavaScript or Node dependency versions. Prefer semgrep or trivy for multi-language coverage. Prefer secretfinder when the goal is leaked secrets in JS, not CVE versions.

semgrep

Pattern-based static analysis across many languages, including custom security rules.

trivy

Scans dependencies, containers, and IaC for known vulnerabilities across ecosystems.

secretfinder

Finds leaked secrets inside JavaScript files rather than vulnerable library versions.

faq

retire-js questions

Set --severity to none, low, medium, high, or critical. The process exits non-zero when a finding reaches that level. Exclude vendored paths first with --ignore or --ignorefile.

Run retire-js yourself

A project folder feeds Retire.js, which matches each JavaScript library against the vulnerability database and writes the flagged components as a queryable output.

Facts on this page come from the live Trickest tool library.