Skip to main content

UnretiredJS

A Python port of RetireJS - A tool to scan for vulnerabilities in JavaScript libraries.

PyPI PyPI License

Description

UnretiredJS is a Python library that helps you identify known vulnerabilities in JavaScript libraries used in your web applications. It's a modern Python port of the popular RetireJS tool, bringing fast, offline vulnerability scanning capabilities to Python projects.

Installation

pip install unretiredjs

Usage

Basic Usage

# Method 1: Import specific function
from unretiredjs import scan_endpoint

# Method 2: Import the entire module
import unretiredjs

# Scan a remote JavaScript file
# Using specific import
results = scan_endpoint("http://code.jquery.com/jquery-1.6.min.js")

# Or using full module import
results = unretiredjs.scan_endpoint("http://code.jquery.com/jquery-1.6.min.js")

Sample Output

[
    {
        'detection': 'filecontent',
        'vulnerabilities': [
            {
                'info': [
                    'http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2011-4969',
                    'http://research.insecurelabs.org/jquery/test/'
                ],
                'identifiers': {
                    'CVE': ['CVE-2011-4969']
                },
                'severity': 'medium'
            }
        ],
        'version': '1.6.0',
        'component': 'jquery'
    }
]

Features

  • Scan remote JavaScript files for known vulnerabilities
  • Detect vulnerable versions of popular JavaScript libraries
  • Comprehensive vulnerability database
  • Easy to integrate into Python projects
  • Modern Python package structure with src layout

Requirements

  • Python 3.6 or higher
  • requests>=2.25.0

Development

Project Structure

unretiredjs/
├── src/
│   └── unretiredjs/
│       ├── __init__.py
│       ├── retirejs.py
│       ├── vulnerabilities.py
│       └── update_vulnerabilities.py
├── tests/
│   ├── test_retirejs.py
│   ├── test_update_vulnerabilities.py
│   └── compare_results.py
├── pyproject.toml
└── README.md

Vulnerability Data Updates

The vulnerability data used by UnretiredJS is stored in src/unretiredjs/vulnerabilities.py. This data is sourced from the official RetireJS repository (https://raw.githubusercontent.com/RetireJS/retire.js/master/repository/jsrepository.json).

Updates are handled automatically by a GitHub Action defined in .github/workflows/update_retirejs_data.yml. This action runs on a monthly schedule (at 00:00 UTC on the 1st day of every month) to fetch the latest vulnerability information. It also allows for manual triggering via the GitHub Actions UI.

To run the update script manually:

# Install development dependencies
pip install -e ".[dev]"

# Run the update script
python -m unretiredjs.update_vulnerabilities

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Author

Anand Kumar - GitHub

Metadata

Release files for unretiredjs 1.4.18

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for unretiredjs 1.4.18
File Size Uploaded Provenance Actions
unretiredjs-1.4.18.tar.gz 109.8 kB Without provenance Details for unretiredjs-1.4.18.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for unretiredjs 1.4.18
File Interpreter ABI Platform Actions
unretiredjs-1.4.18-py3-none-any.whl Python 3 none any Details for unretiredjs-1.4.18-py3-none-any.whl

Total release size: 223.5 kB

Release files / unretiredjs-1.4.18.tar.gz

Download URL unretiredjs-1.4.18.tar.gz
Size 109.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d97288fd274e303d2bf5a41e0571dc3736d33e58eaba7fbc5eef8fdf6c6f12e8
BLAKE2b-256 checksum
How to use checksums
9a7a716386a5cbfb8c1ea39cc87bd0ce98c88b9ac68ee6d4c51eb1030a362295
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

Release files / unretiredjs-1.4.18-py3-none-any.whl

Download URL unretiredjs-1.4.18-py3-none-any.whl
Size 113.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f5d0ba842961f3b54c9bac024af5538d0c7e9997db1f6baacb085aa9c71f9862
BLAKE2b-256 checksum
How to use checksums
e143cb0b51842fa2ea83864c6cb54bd36438d752c1e37cd472ba48f1e1aa46bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

Security for unretiredjs 1.4.18

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page