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.
parse-git-url
Advanced tools
The parse-git-url npm package is a utility for parsing Git URLs into their component parts. It supports various Git URL formats and provides a simple interface to extract information such as the protocol, host, owner, name, and more.
Parse Git URL
This feature allows you to parse a Git URL and extract its components. The code sample demonstrates how to parse a Git URL and log the parsed object, which includes properties like protocol, host, owner, and name.
const parseGitUrl = require('parse-git-url');
const parsed = parseGitUrl('https://github.com/user/repo.git');
console.log(parsed);
Support for Different Git URL Formats
This feature shows the package's ability to handle different Git URL formats, such as SSH and HTTPS. The code sample demonstrates parsing both an SSH URL and an HTTPS URL, logging the parsed objects for each.
const parseGitUrl = require('parse-git-url');
const sshUrl = parseGitUrl('git@github.com:user/repo.git');
const httpsUrl = parseGitUrl('https://github.com/user/repo.git');
console.log(sshUrl);
console.log(httpsUrl);
Extract Specific Components
This feature allows you to extract specific components from a parsed Git URL. The code sample demonstrates how to extract and log the owner and repository name from a parsed Git URL.
const parseGitUrl = require('parse-git-url');
const parsed = parseGitUrl('https://github.com/user/repo.git');
const owner = parsed.owner;
const name = parsed.name;
console.log(`Owner: ${owner}, Repo Name: ${name}`);
The git-url-parse package provides similar functionality to parse-git-url, allowing you to parse Git URLs and extract their components. It also supports various Git URL formats and offers additional methods for manipulating and formatting Git URLs.
The parse-url package is a more general-purpose URL parser that can handle Git URLs among other types of URLs. It provides a comprehensive set of features for parsing, manipulating, and formatting URLs, making it a versatile alternative to parse-git-url.
The url-parse package is another general-purpose URL parser that can handle Git URLs. It offers a robust set of features for parsing and manipulating URLs, and it is widely used in the JavaScript ecosystem for various URL parsing needs.
A lib for parsing the URL of GitHub, GitHub Enterprise Server (ghes), GitLab, and Bitbucket repositories.
import parseGitUrl from 'parse-git-url'
parseGitUrl('https://github.com/vercel/swr'))
// => {
// type: 'github',
// owner: 'vercel',
// name: 'swr',
// branch: '',
// sha: '',
// subdir: ''
// }
parseGitUrl('https://github.example.com/vercel/swr', 'github.example.com'))
// => {
// type: 'ghes',
// owner: 'vercel',
// name: 'swr',
// branch: '',
// sha: '',
// subdir: ''
// }
parseGitUrl('https://google.com')
// => null
It supports parsing various URL schemas including SSH, branch, sha, commit, subdirectories, subgroups (GitLab), etc.
FAQs
A lib for parsing the URL of Git Repositories.
We found that parse-git-url demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers 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.