Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
The 'isurl' npm package is a utility library designed to provide a simple and efficient way to validate and manipulate URLs in Node.js applications. It offers functions to check if a given string is a valid URL and to parse URLs into their components.
URL Validation
This feature allows developers to check if a string is a valid URL. It returns true if the string is a valid URL and false otherwise. This is useful for validating user input or data fetched from external sources.
const isUrl = require('isurl');
console.log(isUrl('https://www.example.com')); // true
console.log(isUrl('not-a-url')); // false
URL Parsing
This feature provides the ability to parse a URL into its constituent parts, such as protocol, host, path, and query string. This can be particularly useful for applications that need to manipulate or extract information from URLs.
const isUrl = require('isurl');
const url = isUrl.parse('https://www.example.com/path?query=123');
console.log(url.protocol); // 'https:'
console.log(url.host); // 'www.example.com'
console.log(url.pathname); // '/path'
console.log(url.search); // '?query=123'
The 'valid-url' package offers similar URL validation capabilities. It provides methods to check if a URL is valid and to normalize URLs. Compared to 'isurl', 'valid-url' focuses more on validation and less on URL parsing.
The 'url-parse' package provides detailed URL parsing capabilities. It offers more extensive options for parsing and manipulating URLs than 'isurl', including the ability to handle relative URLs and extract additional components like username and password from the URL.
Determines whether a value is a WHATWG
URL
.
Works cross-realm/iframe and despite Symbol.toStringTag
.
Node.js >= 8
is required. To install, type this at the command line:
npm install isurl
const isURL = require('isurl');
isURL('http://domain/'); //-> false
isURL(new URL('http://domain/')); //-> true
Optionally, acceptance can be extended to incomplete URL
implementations that lack origin
, searchParams
and toJSON
properties (which are common in many modern web browsers):
const url = new URL('http://domain/?query');
console.log(url.searchParams); //-> undefined
isURL.lenient(url); //-> true
FAQs
Determines whether a value is a WHATWG URL.
The npm package isurl receives a total of 1,669,654 weekly downloads. As such, isurl popularity was classified as popular.
We found that isurl demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.