Socket
Socket
Sign inDemoInstall

bad_url_scan

Package Overview
Dependencies
0
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bad_url_scan

A simple bad URL scanner for JavaScript


Version published
Maintainers
1
Created

Readme

Source

Bad url scan

A simple bad URL scanner for JavaScript

This firewall has over 50 bad URLs that are commonly used in attacks.

Installation

npm install bad_url_scan

Usage

const scan = require("bad_url_scan");

scan("https://example.com/admin"); // Returns true

scan("https://example.com/blogs/my_trip.html"); // Returns false

Example usage

Here is an example of a web server that uses this package to scan URLs:

app.get('/', (req, res) => {
    const url = req.query.url;
    const bad = scan(url); // Returns true if the URL is bad
    if (bad) {
        res.send("Forbidden");
    } else {
        res.send("Hello World")
    }
});

If you want to allow a URL that is classed as bad, you can make a ignore list to ignore certain URLs:

scan("https://example.com/results/database", ["results/database"]); // Returns false

scan("https://example.com/admin", ["results/database"]); // Returns true

Licence

This project is licenced under GNU General Public Licence Version 3.0. See LICENCE for more information.

Keywords

FAQs

Last updated on 11 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc