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.
is-relative-url
Advanced tools
The is-relative-url npm package is a simple utility that checks if a given URL is a relative URL. It is useful for validating and processing URLs in web development.
Check if a URL is relative
This feature allows you to check if a given URL is relative. A relative URL does not include the domain name and is relative to the current page's URL.
const isRelativeUrl = require('is-relative-url');
console.log(isRelativeUrl('/path/to/resource')); // true
console.log(isRelativeUrl('http://example.com')); // false
The is-absolute-url package checks if a given URL is an absolute URL. It complements is-relative-url by providing the opposite functionality, allowing developers to validate absolute URLs.
The url-parse package is a more comprehensive URL parsing library that can handle both relative and absolute URLs. It provides more advanced features such as extracting components of the URL, making it more versatile compared to is-relative-url.
The valid-url package provides functions to validate URLs, including checking if they are valid, absolute, or relative. It offers a broader range of validation options compared to is-relative-url.
Check if a URL is relative
npm install is-relative-url
import isRelativeUrl from 'is-relative-url';
isRelativeUrl('foo/bar');
//=> true
isRelativeUrl('https://sindresorhus.com/foo/bar');
//=> false
isRelativeUrl('//sindresorhus.com');
//=> true
See is-absolute-url for the inverse.
FAQs
Check if a URL is relative
The npm package is-relative-url receives a total of 326,846 weekly downloads. As such, is-relative-url popularity was classified as popular.
We found that is-relative-url 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.