url-parse @1.5.3
Small footprint URL parser that works seamlessly across Node.js and browser environments
Maintainers
Keywords
Dependencies (2)
| Package | Constraint | Registry Status |
|---|---|---|
| requires-port | ^1.0.0 | auto_approved |
| querystringify | ^2.1.1 | auto_approved |
Dev Dependencies (8)
| Package | Constraint | Registry Status |
|---|---|---|
| c8 | ^7.3.1 | auto_approved |
| mocha | ^8.0.1 | auto_approved |
| assume | ^2.2.0 | Not imported |
| uglify-js | ^3.5.7 | auto_approved |
| browserify | ^17.0.0 | auto_approved |
| pre-commit | ^1.2.2 | auto_approved |
| sauce-test | ^1.3.3 | Not imported |
| sauce-browsers | ^2.0.0 | Not imported |
Transitive Dependency Tree
SAST Findings (5)
CVSS 9.1 (CRITICAL) — CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N url-parse prior to version 1.5.8 is vulnerable to Authorization Bypass Through User-Controlled Key.
CVSS 6.5 (MEDIUM) — CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N A specially crafted URL with an '@' sign but empty user info and no hostname, when parsed with url-parse, url-parse will return the incorrect href. In particular, ```js parse(\"http://@/127.0.0.1\") ``` Will return: ```yaml { slashes: true, protocol: 'http:', hash: '', query: '', pathname: '/127.0.0.1', auth: '', host: '', port: '', hostname: '', password: '', username: '', origin: 'null', href: 'http:///127.0.0.1' } ``` If the 'hostname' or 'origin' attributes of the output from url-parse are used in security decisions and the final 'href' attribute of the output is then used to make a request, the decision may be incorrect.
CVSS 6.5 (MEDIUM) — CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N Leading control characters in a URL are not stripped when passed into url-parse. This can cause input URLs to be mistakenly be interpreted as a relative URL without a hostname and protocol, while the WHATWG URL parser will trim control characters and treat it as an absolute URL. If url-parse is used in security decisions involving the hostname / protocol, and the input URL is used in a client which uses the WHATWG URL parser, the decision may be incorrect. This can also lead to a cross-site scripting (XSS) vulnerability if url-parse is used to check for the javascript: protocol in URLs. See following example: ```js const parse = require('url-parse') const express = require('express') const app = express() const port = 3000 url = parse(\"\\bjavascript:alert(1)\") console.log(url) app.get('/', (req, res) => { if (url.protocol !== \"javascript:\") {res.send(\"<a href=\\'\" + url.href + \"\\'>CLICK ME!</a>\")} }) app.listen(port, () => { console.log(`Example app listening on port ${port}`) }) ```
CVSS 5.3 (MEDIUM) — CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N Authorization Bypass Through User-Controlled Key in NPM url-parse prior to 1.5.6.
[Accepted risk] Package was published without Sigstore provenance. Only ~12% of npm packages have provenance, so this is common but not ideal.
Review Summary
Risk score: 70. Findings: 1 critical (+40), 3 medium (+30), 1 info (+0).
Commit: ad444931666a Browse source
Published to npm: