Think package.json keeps you safe? Think again.
Retire.js is a focused JavaScript dependency scanner that inspects files and code instead of only reading manifests.
It looks for libraries with known CVEs across browser assets, CDN scripts, vendor bundles, and node_modules by matching filenames, version comments, file hashes, and signatures.
That makes it especially useful for legacy projects, manually copied libraries, and minified bundles that slip past npm/yarn checks.
Run it locally or in CI to catch vulnerable libraries before they hit production—faster than chasing a late-night security page.
Core Purpose and Functionality of the Retire.js Vulnerability Scanner

Retire.js is a JavaScript vulnerability scanner that catches outdated or insecure libraries using a community-maintained vulnerability database. It looks for JavaScript libraries with known CVE entries and documented exploits, checking both browser-based front-end assets and Node.js dependencies. Here’s what makes it different: instead of just reading package manifests, Retire.js actually inspects files and code. That means it’s really good at finding security risks in manually copied libraries, CDN-linked scripts, and vendor bundles that don’t show up in package.json.
The scanner uses several identification strategies to find vulnerable libraries across client-side codebases and Node.js environments. It inspects filenames, examines code comments, analyzes file hashes, and sometimes executes code in isolated sandboxes to confirm library versions. These techniques let Retire.js identify libraries even when they’ve been minified, bundled, or renamed, which happens constantly in production web applications.
You’ll use Retire.js in web projects, Node.js applications, and bundled front-end assets. It’s especially strong at finding libraries outside package.json. Developers use it to scan legacy codebases, third-party vendor folders, and production bundles where library versions aren’t always tracked in dependency manifests. The scanner works in automated CI/CD pipelines and supports manual security audits too, giving teams flexibility in how they enforce dependency security policies.
What it can do:
- Scan bundled and minified JavaScript files to identify libraries embedded in webpack, rollup, or other build outputs
- Cover multiple frameworks and libraries including jQuery, Bootstrap, Angular, React, and hundreds of others tracked in the vulnerability database
- Reference CVE-related advisory data with direct links to security bulletins and issue trackers for each finding
- Support browser-based scanning through extensions that inspect libraries loaded at runtime on visited pages
- Identify vulnerable Node modules by inspecting node_modules folders and package files beyond what package.json declares
Installation and Setup of Retire.js for JavaScript Dependency Scanning

Retire.js installs via npm and needs Node.js and npm as prerequisites. A global installation adds the retire command to your PATH, making it available system-wide for scanning any project. A local installation saves Retire.js as a development dependency in a specific project, which works well when you want to version-lock the scanner alongside your codebase or enforce specific scanner versions in team workflows. Global installs are faster for ad-hoc scans across multiple projects. Local installs ensure consistency in CI/CD environments.
Start with retire –help to see all available options and commands. Running retire in a project directory triggers a scan of the current folder and its subdirectories. The –colors option enables severity-based colored output, making it easier to spot high-risk findings in terminal output. The verbose flag produces extra details about each vulnerability, including the detection method used and the confidence level of the match.
| Installation Method | Command | Description |
|---|---|---|
| Global CLI install | npm install -g retire | Installs Retire.js system-wide for use in any project directory |
| Local project install | npm install –save-dev retire | Adds Retire.js as a dev dependency in the current project |
| Grunt plugin install | npm install –save-dev grunt-retire | Installs the Grunt wrapper for task-based scanning in Gruntfile workflows |
| Browser extension | Install from Chrome Web Store or Firefox Add-ons | Enables runtime scanning of JavaScript libraries loaded on visited web pages |
Retire.js Detection Techniques for Vulnerable JavaScript Libraries

Retire.js starts by checking filenames and URLs against known patterns for popular libraries. If a file is named jquery-1.8.3.min.js or loaded from a CDN path containing /angular/1.4.8/, the scanner can immediately match it to the vulnerability database. When filename detection isn’t conclusive, Retire.js opens the file and searches for version strings in comments, which most libraries include near the top of their source. A comment like “jQuery v1.8.3” gives the scanner an exact version to cross-reference.
For minified files where comments have been stripped, Retire.js computes file hashes and compares them against known hash signatures of vulnerable library versions. This method is valuable for compressed bundles where all formatting and metadata have been removed. The hash-based approach works well for libraries distributed via CDNs in minified form, where the file content is byte-identical across deployments. But custom builds or locally modified libraries will produce different hashes and may not be detected this way.
Detection faces challenges with heavily obfuscated or tree-shaken bundles where library code is mixed with application code and original structure is lost. Webpack and other bundlers can inline dependencies in ways that eliminate filename hints, version comments, and predictable hash values. In these cases, detection accuracy depends on whether unique code patterns or function signatures remain identifiable in the bundled output.
Vulnerability Database Reference
The vulnerability database is a manually maintained JSON file hosted in the Retire.js Git repository. Each entry maps a library name to one or more version ranges marked as vulnerable, along with advisory links pointing to CVE records, GitHub issues, or security bulletins. The database includes severity ratings and descriptions of what each vulnerability enables, such as cross-site scripting or prototype pollution.
Community contributions keep the database up to date by reviewing release notes, security advisories, and public issue trackers for popular JavaScript frameworks. Contributors submit pull requests to add new entries when vulnerabilities are disclosed, and the Retire.js maintainers merge updates into the repository. Teams can also extend the database with custom JSON entries to track vulnerabilities in private or in-house libraries not covered by the public repository.
Using the Retire.js CLI for Scanning JavaScript Dependencies

Basic scanning starts with running retire in the project root, which scans the current directory and all subdirectories by default. You can target a specific path using retire –path /path/to/project, which is useful when scanning a build output folder or a vendor library directory. The scanner walks the file tree, inspects JavaScript files, and reports any matches against the vulnerability database. Scans complete in seconds for small projects and may take a few minutes for large codebases with thousands of JavaScript files.
Output formats include human-readable text printed to the terminal and machine-readable JSON suitable for automation. The default output lists each finding with the library name, detected version, severity level, and a link to the relevant advisory. JSON output can be written to a file using retire –outputformat json –outputpath report.json, which produces a structured report that CI systems and security dashboards can parse programmatically. JSON reports include arrays of findings with fields for file path, library, version, severity, and advisory URLs.
Exit-code behavior matters for automation because Retire.js exits with a non-zero status code when vulnerabilities are detected. This allows CI pipelines to fail builds automatically when any known-vulnerable library is found. You can configure build policies to treat high-severity findings as blockers while allowing medium or low findings to pass with warnings.
Common CLI options:
- –path specifies the directory to scan, allowing targeted scans of build outputs or specific folders instead of entire repositories
- –outputformat controls the format of the scan report, with options for text, json, and jsonsimple for different automation needs
- –outputpath defines where to write the report file when using JSON output, making it easy to archive results or upload them as build artifacts
- –colors enables severity-based terminal color coding, with red for high severity, yellow for medium, and other colors to help visually prioritize findings
- –verbose increases the detail level in output, showing detection methods, confidence scores, and additional context about each match
- Exit code handling returns 0 for clean scans and non-zero codes when vulnerabilities are found, which integrates directly with shell-based CI failure logic
Integrating Retire.js into CI/CD Pipelines for Automated Vulnerability Detection

Common CI tools including GitHub Actions, GitLab CI, Jenkins, and Azure DevOps all support Retire.js integration through shell commands or dedicated plugins. GitHub Actions workflows can run retire as a script step after npm install, capturing JSON output and uploading it as a workflow artifact. GitLab CI jobs use similar patterns with script blocks that invoke the CLI and check exit codes to fail the pipeline. Jenkins pipelines work through shell execution stages or Node-based plugins to run scans during build or test phases. Azure DevOps offers a marketplace extension specifically designed for Retire.js, which handles parameter mapping and output parsing automatically.
Build-failure policies rely on Retire.js exit codes and JSON-based automation to enforce security standards. A typical policy fails the build when any high-severity vulnerability is detected, while medium and low findings generate warnings that don’t block deployment. JSON output enables more sophisticated logic, such as counting findings by severity or checking whether specific CVEs are present. Teams can write custom scripts that parse the JSON report, apply organization-specific thresholds, and decide whether to fail or continue the pipeline based on those rules.
Scheduling and recurring scans matter for projects that use manually copied libraries or libman-managed assets not tracked in package.json. Daily or weekly scheduled CI runs catch newly disclosed vulnerabilities in existing codebases without requiring code changes to trigger a build. Scheduled scans also help teams monitor production bundles over time, ensuring that vulnerabilities are detected even when the codebase hasn’t been actively developed.
Example CI Workflow
A typical pipeline flow for JavaScript dependency scanning starts by checking out source code and installing dependencies with npm install. The next step runs retire –outputformat json –outputpath retire-report.json to scan the project and generate a structured report. The pipeline then uploads retire-report.json as a build artifact, making it available for download, review, or integration with security dashboards.
A script or plugin parses the JSON to extract severity levels and counts. If any finding has severity marked as high or critical, the pipeline executes exit 1 to fail the build. Medium and low findings are logged as warnings but don’t block the pipeline. This workflow ensures that every commit is scanned, new vulnerabilities trigger immediate alerts, and historical scan data is preserved as artifacts for compliance and trend analysis.
Retire.js Browser Extension and Runtime-Based Library Identification

The Chrome extension scans visited sites by inspecting JavaScript libraries loaded at runtime and displaying findings in the browser’s developer console. When you visit a page, the extension detects libraries using the same filename, comment, and hash techniques as the CLI. For libraries that can’t be identified through static inspection, the extension runs code in a sandboxed environment to confirm the library and version. This sandbox fallback is unique to the browser extension and intentionally not available in the CLI, because executing arbitrary JavaScript in a Node process is considered unsafe.
Differences between browser-based scanning and CLI scanning center on scope and execution context. The browser extension only sees libraries actually loaded on a visited page, making it ideal for manual security assessments and testing live sites. It shows an icon in the address bar when vulnerabilities are detected and logs detailed warnings in DevTools. The CLI scans source files and build outputs on disk, covering the entire codebase whether or not the code runs. CLI scans are better for CI automation and comprehensive project audits. The browser extension is faster for spot-checking production sites and third-party integrations.
| Feature | Browser Extension Behavior | Notes |
|---|---|---|
| Runtime detection | Scans libraries loaded on visited pages and uses sandboxed execution to identify versions when static methods fail | Only detects libraries actually used on the page at load time |
| DevTools warnings | Logs findings to the browser console with severity indicators and advisory links | Warnings appear immediately as the page loads |
| Supported browsers | Available for Chrome via the Chrome Web Store and Firefox via Firefox Add-ons | Extension requires browser permissions to inspect loaded scripts |
Workflow for Remediation and Version Upgrades Identified by Retire.js

Interpreting vulnerability results starts with reviewing the severity level, affected library, and linked advisory to understand the risk. Each finding includes the library name, the detected version, and a link to a CVE record or security bulletin explaining what the vulnerability enables. High-severity findings typically involve exploitable flaws like cross-site scripting, prototype pollution, or remote code execution. Medium findings might involve denial-of-service risks or less severe injection issues. Low findings often represent edge cases or vulnerabilities that require specific configurations to exploit.
Versioning practices and upgrade challenges depend on how the library is used and how breaking changes are managed. Many vulnerabilities are fixed in minor or patch releases that maintain backward compatibility, making upgrades straightforward. Some fixes require major version bumps that introduce breaking changes, requiring code refactoring and regression testing. Library version pinning reduces the risk of unexpected updates but also prevents automatic security patches, creating a tradeoff between stability and security. Teams should evaluate each upgrade for compatibility, test critical paths, and review changelogs before deploying.
Tools like Dependabot and Renovate can automate the upgrade process by monitoring dependencies and submitting pull requests with version bumps when fixes are available. These tools integrate with GitHub and GitLab to propose updates automatically, reducing the manual effort required to track and apply security patches. Combining automated update proposals with Retire.js scans creates a feedback loop where vulnerabilities are detected, fixes are proposed, and remediation is verified through CI.
Steps for evaluating and applying fixes:
- Review the advisory linked in the Retire.js report to understand the vulnerability’s impact, affected versions, and recommended fixes
- Check the library’s release notes or changelog to identify the version that patches the vulnerability and assess whether it introduces breaking changes
- Test the upgrade in a development or staging environment to catch regressions, API changes, or compatibility issues before production deployment
- Track changes in version control with clear commit messages referencing the CVE or security advisory for audit and rollback purposes
- Verify remediation by running Retire.js again after the upgrade to confirm the finding no longer appears and the vulnerability is resolved
Comparing Retire.js with Other JavaScript Vulnerability Scanners

npm audit focuses exclusively on packages declared in package.json and installed in node_modules, analyzing the npm dependency tree to find vulnerabilities in npm-published packages. It relies on the npm registry’s advisory database and only detects issues in dependencies that are explicitly managed by npm. Retire.js detects libraries outside this manifest, including manually copied files, CDN-linked scripts, and vendor bundles that aren’t tracked in package.json. This makes Retire.js especially useful for front-end projects where libraries are included directly in source control or delivered via script tags rather than npm dependencies.
Snyk and OSS Index provide remediation help, automated fix pull requests, and broader coverage across multiple ecosystems including npm, Maven, PyPI, and others. These commercial and freemium tools offer deeper integration with development workflows, vulnerability prioritization based on exploit maturity, and guided remediation steps. Retire.js specializes in client-side detection and is entirely open source with no licensing costs or account requirements. It’s lightweight and focused on JavaScript libraries, making it faster and simpler to integrate for teams that need quick vulnerability scanning without the overhead of a full software composition analysis platform.
Lightweight scanners like Retire.js fill a specific gap by providing fast, targeted detection for front-end JavaScript without requiring complex setup or external services. They’re ideal for small teams, legacy projects, and CI environments where simplicity and speed matter more than comprehensive feature sets. Heavier tools like Snyk excel at managing large dependency graphs and providing actionable remediation, but they require more configuration and ongoing subscription management.
Comparison Table
| Tool | Coverage | Strengths |
|---|---|---|
| npm audit | npm packages in package.json and node_modules only | Built into npm, no installation required, integrates with npm workflows, focuses on dependency tree analysis |
| Snyk | npm, Maven, PyPI, Docker, and more with remediation guidance | Automated fix PRs, exploit maturity scoring, comprehensive multi-language support, deep CI integration |
| Retire.js | JavaScript libraries in source code, bundles, and CDN-linked assets including files outside package.json | Lightweight, open source, detects client-side libraries, works on minified and bundled code, simple CLI integration |
Final Words
In the action, you run Retire.js to quickly spot known-bad JavaScript libraries using its community JSON DB, from bundled and minified files to node_modules. It’s installed via npm (global or local) and offers both CLI and browser extension scans.
Use the CLI’s JSON output and exit codes to automate CI failures, and expect filename, comment, hashing, and sandbox tricks under the hood. Retire.js flags versions but won’t auto-fix; pair it with Dependabot or Renovate and test upgrades.
Treat retire.js javascript dependency scanner as a lightweight, focused check that catches client-side and hidden libs early, and it’s worth adding to your pipeline.
FAQ
Q: What is Retire.js and what does it do?
A: Retire.js is a JavaScript vulnerability scanner that detects outdated or insecure libraries using a community-maintained JSON vulnerability database, covering client-side and Node.js code, including files outside package.json.
Q: How does Retire.js detect vulnerable libraries?
A: Retire.js detects vulnerable libraries by checking filenames/URLs, extracting versions from comments, hashing minified bundles, and using sandboxed runtime checks (extension), then matching results against the community JSON database.
Q: Where should I use Retire.js?
A: Retire.js is used in web projects, Node.js applications, and on bundled front-end assets to find vulnerable libraries, including ones not listed in package.json and those loaded at runtime.
Q: How do I install Retire.js?
A: Retire.js installs via npm either globally (npm install -g retire) or locally in a project (npm install –save-dev retire); Node.js and npm are required.
Q: How do I run basic scans and what options help?
A: Retire.js runs scans via the CLI (retire or retire –path ./dir). Output supports human-readable and JSON formats; use –colors and –verbose for clearer, richer output.
Q: How can I integrate Retire.js into CI/CD and fail builds?
A: Retire.js integrates into CI/CD by producing JSON output and returning nonzero exit codes on findings so pipelines can fail builds or gate merges based on severity.
Q: What does the browser extension do versus the CLI?
A: Retire.js browser extension scans visited pages, inspects runtime-loaded libraries, shows DevTools warnings, and uses sandboxed execution—behaviors that differ from the file-based CLI scanner.
Q: Does Retire.js automatically fix vulnerabilities?
A: Retire.js reports affected versions but does not auto-fix; developers must upgrade, replace, or patch libraries, then test changes. Use Dependabot or Renovate to automate PRs for upgrades.
Q: How does Retire.js compare to npm audit, Snyk, and OSS Index?
A: Retire.js focuses on client-side and bundled-file detection (including files outside manifests); npm audit checks package.json, while Snyk and OSS Index add remediation advice and wider advisory coverage.
Q: What are common limitations or gotchas with Retire.js?
A: Retire.js can miss heavily obfuscated code, yield false positives from generic filenames, and depends on a community JSON database—always verify findings and prioritize fixes by actual exploitability.
