Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
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 811,269 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.