Skip to main content

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

Project description

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 port of the popular RetireJS tool, bringing the same powerful vulnerability scanning capabilities to Python projects.

Note: This is a fork of FallibleInc/retirejslib, maintained and updated with additional features and improvements.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unretiredjs-1.4.14.tar.gz (53.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unretiredjs-1.4.14-py3-none-any.whl (54.8 kB view details)

Uploaded Python 3

File details

Details for the file unretiredjs-1.4.14.tar.gz.

File metadata

  • Download URL: unretiredjs-1.4.14.tar.gz
  • Upload date:
  • Size: 53.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for unretiredjs-1.4.14.tar.gz
Algorithm Hash digest
SHA256 1d1ba9d7c01acec9034ab711edb5205504f0bb7a6aa13c0c3bdd728320949b27
MD5 7bb9892324b241982e927679d5018a94
BLAKE2b-256 1f09500481c69f66acbdbbb13e0d20c003b2ef5cbb16c0a7aa82692ddeec10c8

See more details on using hashes here.

File details

Details for the file unretiredjs-1.4.14-py3-none-any.whl.

File metadata

  • Download URL: unretiredjs-1.4.14-py3-none-any.whl
  • Upload date:
  • Size: 54.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for unretiredjs-1.4.14-py3-none-any.whl
Algorithm Hash digest
SHA256 419248bdaa8f8495e53f4e8798676917b74dff83c86293ac1e98f8c892e60aba
MD5 7be3b0b237f6e112737b50850dce493f
BLAKE2b-256 8681beefb3f2907143b70f1a670c8b60cd97eedceaa870174f4abad6b1e70ead

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page