Giter Site home page Giter Site logo

uri-js's Introduction

URI.js

URI.js is an RFC 3986 compliant, scheme extendable URI parsing/normalizing/resolving/serializing library for all JavaScript environments (browsers, Node.js, etc). It is also compliant with the IRI (RFC 3987), IDNA (RFC 5890), IPv6 Address (RFC 5952), IPv6 Zone Identifier (RFC 6874) specifications.

URI.js has an extensive test suite, and works in all (Node.js, web) environments. It weighs in at 6.4kb (gzipped, 17kb deflated).

API

Parsing

URI.parse("uri://user:[email protected]:123/one/two.three?q1=a1&q2=a2#body");
//returns:
//{
//  scheme : "uri",
//  userinfo : "user:pass",
//  host : "example.com",
//  port : 123,
//  path : "/one/two.three",
//  query : "q1=a1&q2=a2",
//  fragment : "body"
//}

Serializing

URI.serialize({scheme : "http", host : "example.com", fragment : "footer"}) === "http://example.com/#footer"

Resolving

URI.resolve("uri://a/b/c/d?q", "../../g") === "uri://a/g"

Normalizing

URI.normalize("HTTP://ABC.com:80/%7Esmith/home.html") === "http://abc.com/~smith/home.html"

Comparison

URI.equal("example://a/b/c/%7Bfoo%7D", "eXAMPLE://a/./b/../b/%63/%7bfoo%7d") === true

IP Support

//IPv4 normalization
URI.normalize("//192.068.001.000") === "//192.68.1.0"

//IPv6 normalization
URI.normalize("//[2001:0:0DB8::0:0001]") === "//[2001:0:db8::1]"

//IPv6 zone identifier support
URI.parse("//[2001:db8::7%25en1]");
//returns:
//{
//  host : "2001:db8::7%en1"
//}

IRI Support

//convert IRI to URI
URI.serialize(URI.parse("http://examplé.org/rosé")) === "http://xn--exampl-gva.org/ros%C3%A9"
//convert URI to IRI
URI.serialize(URI.parse("http://xn--exampl-gva.org/ros%C3%A9"), {iri:true}) === "http://examplé.org/rosé"

Options

All of the above functions can accept an additional options argument that is an object that can contain one or more of the following properties:

  • scheme (string)

    Indicates the scheme that the URI should be treated as, overriding the URI's normal scheme parsing behavior.

  • reference (string)

    If set to "suffix", it indicates that the URI is in the suffix format and the parser will use the option's scheme property to determine the URI's scheme.

  • tolerant (boolean, false)

    If set to true, the parser will relax URI resolving rules.

  • absolutePath (boolean, false)

    If set to true, the serializer will not resolve a relative path component.

  • iri (boolean, false)

    If set to true, the serializer will unescape non-ASCII characters as per RFC 3987.

  • unicodeSupport (boolean, false)

    If set to true, the parser will unescape non-ASCII characters in the parsed output as per RFC 3987.

  • domainHost (boolean, false)

    If set to true, the library will treat the host component as a domain name, and convert IDNs (International Domain Names) as per RFC 5891.

Scheme Extendable

URI.js supports inserting custom scheme dependent processing rules. Currently, URI.js has built in support for the following schemes:

HTTP/HTTPS Support

URI.equal("HTTP://ABC.COM:80", "http://abc.com/") === true
URI.equal("https://abc.com", "HTTPS://ABC.COM:443/") === true

WS/WSS Support

URI.parse("wss://example.com/foo?bar=baz");
//returns:
//{
//	scheme : "wss",
//	host: "example.com",
//	resourceName: "/foo?bar=baz",
//	secure: true,
//}

URI.equal("WS://ABC.COM:80/chat#one", "ws://abc.com/chat") === true

Mailto Support

URI.parse("mailto:[email protected],[email protected]?subject=SUBSCRIBE&body=Sign%20me%20up!");
//returns:
//{
//	scheme : "mailto",
//	to : ["[email protected]", "[email protected]"],
//	subject : "SUBSCRIBE",
//	body : "Sign me up!"
//}

URI.serialize({
	scheme : "mailto",
	to : ["[email protected]"],
	subject : "REMOVE",
	body : "Please remove me",
	headers : {
		cc : "[email protected]"
	}
}) === "mailto:[email protected][email protected]&subject=REMOVE&body=Please%20remove%20me"

URN Support

URI.parse("urn:example:foo");
//returns:
//{
//	scheme : "urn",
//	nid : "example",
//	nss : "foo",
//}

URN UUID Support

URI.parse("urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6");
//returns:
//{
//	scheme : "urn",
//	nid : "uuid",
//	uuid : "f81d4fae-7dec-11d0-a765-00a0c91e6bf6",
//}

Usage

To load in a browser, use the following tag:

<script type="text/javascript" src="uri-js/dist/es5/uri.all.min.js"></script>

To load in a CommonJS/Module environment, first install with npm/yarn by running on the command line:

npm install uri-js
# OR
yarn add uri-js

Then, in your code, load it using:

const URI = require("uri-js");

If you are writing your code in ES6+ (ESNEXT) or TypeScript, you would load it using:

import * as URI from "uri-js";

Or you can load just what you need using named exports:

import { parse, serialize, resolve, resolveComponents, normalize, equal, removeDotSegments, pctEncChar, pctDecChars, escapeComponent, unescapeComponent } from "uri-js";

Breaking changes

Breaking changes from 3.x

URN parsing has been completely changed to better align with the specification. Scheme is now always urn, but has two new properties: nid which contains the Namspace Identifier, and nss which contains the Namespace Specific String. The nss property will be removed by higher order scheme handlers, such as the UUID URN scheme handler.

The UUID of a URN can now be found in the uuid property.

Breaking changes from 2.x

URI validation has been removed as it was slow, exposed a vulnerabilty, and was generally not useful.

Breaking changes from 1.x

The errors array on parsed components is now an error string.

uri-js's People

Contributors

bhullarg avatar dependabot[bot] avatar dhurlburtusa avatar ffflorian avatar garycourt avatar jon-dahlberg avatar oresoftware avatar pkuczynski avatar polmabri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uri-js's Issues

Invalid scheme syntax permitted

urijs.parse("any(http://www.w3.org/ns/ttml/profile/ttml2-transformation")

does not result in an error, even though the scheme component of an absolute URI is constrained to ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) per RFC 3986, and the path-noscheme of a relative URI cannot contain a ":" until after the first "/".

Incorrect parsed scheme

Given urn:oasis:names:tc:SAML:2.0:assertion as the URI, the result of .parse is:

{ scheme: 'urn:oasis',
  userinfo: undefined,
  host: undefined,
  port: undefined,
  path: 'names:tc:SAML:2.0:assertion',
  query: undefined,
  fragment: undefined,
  reference: 'absolute' }

This is incorrect. The scheme should be urn and the path should be oasis:names:tc:SAML:2.0:assertion.

resolve()

If a '/n' is in the resolved path then it seems to go into an infinite loop and gobbles up memory until it crashs....

URI.resolve('//www.g.com/','/adf\ngf')

or

URI.resolve('//www.g.com/error\n/bleh/bleh','..')

I know this wouldnt come up that much but Im using it in a web crawler for Chrome and its come up a couple of times.
Im dealing with it by cleaning the url with some regex ( .replace(/(\r\n|\n|\r|\t)/gm, "") ) and then checking both urls parsed without errors before resolving. But there might be more special characters that would cause this and thought you should know.

And while Im here...
Thanks for sharing your code. Ive tried every url parser I could get my hands on and yours turned out to be the best (especially with your graceful error handling), so well done and thank you.

PAEz

Had a look and its in removeDotSegments that the loop occurs, unfortunately I cant do regex stuff so Im no help.

Replace qunit

uri-js/tests/qunit.js

Lines 1 to 9 in a1acf73

/*
* QUnit - A JavaScript Unit Testing Framework
*
* http://docs.jquery.com/QUnit
*
* Copyright (c) 2009 John Resig, Jörn Zaefferer
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*/

This indicates a copyleft license is used in that testing framework. Even though it is a development dependency, many scanning tools mark this entire repo as containing copyleft licenses.

Could that framework be replaced so there is no mention of any copyleft license in this repo?

Please publish pre-compiled version of uri-js

From https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-build-fails-to-minify:

<<To resolve this:
Open an issue on the dependency's issue tracker and ask that the package be published pre-compiled.>>

I got this error message when trying to build my app using react-scripts:
.............................
Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file:

./node_modules/uri-js/dist/esnext/uri.js:42

Read more here: http://bit.ly/2tRViJ9

error Command failed with exit code 1.

.............................

incorrect parse of url

passing in a URL of:
http://localhost:3000/Hi5Cloud/ContentManagement/uploadFile/uqAKRnpeeugwH4gX8dMsGve87Tof/TAC/600000000/.

getting the following object

{
    fragment: undefined
    host: "localhost%3A3000"
    path: "/Hi5Cloud/ContentManagement/uploadFile/uqAKRnpeeugwH4gX8dMsGve87Tof/TAC/600000000/"
    port: undefined
    query: undefined
    reference: "absolute"
    scheme: "http"
    userinfo: undefined
}

obviously the host and port values are broken ...

When I then to a xhr.open() using this I get the following error
"Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource."

Fails to resolve some URI's that contains \r

Hello!

I've tried replacing the built in url node module with uri-js because of the need to support more than just URL's.

However, I'm running into a problem when it comes to URI's that contains \r, consider the following example:

Code:

let url = require("url")
console.log(url.resolve("#", "#foo\nbar"))
console.log(url.resolve("#", "#foo\rbar"))

let URI = require("[email protected]")
console.log(URI.resolve("#", "#foo\nbar"))
console.log(URI.resolve("#", "#foo\rbar"))

Output:

"#foo%0Abar"
"#foo%0Dbar"
"#foo%0Abar"
"#foo" 

I had expected uri-js to behave similar as url in the code above, but instead \rbar seems to be excluded when uri-js tries to resolve it.

There's also some other behaviour here, because the following code works:

console.log(URI.resolve("#", "foo\rbar")) // === "foo%0Dbar"

Do you know what the problem might be?

Thanks

CVE-2021-3807 in ansi-regex dependency

ansi-regex is being flagged as a HIGH severity vulnerability in CVE-2021-3807. I traced it back from eslint to ajv back to this package and found that in the yarn.lock the versions are indeed behind. Fix versions include 3.0.1, 4.1.1, 5.0.1, 6.0.1. Hope that makes sense, but let me know if I can elaborate at all. Thanks

Create ES5+Modules dist

In order to support the modules property in package.json, an ES5 version of uri-js using ES6 Modules needs to be compiled.

Documented as Validating

This project is documented as validating but that feature was removed in version 2. So, it would be good to remove the term "validating" from the code base.

Note: a PR to fix this will show up in a few minutes.

Resolving URNs with resolveComponents returns urn:undefined:undefined

The following code:

var a = uri.serialize(uri.resolveComponents(uri.parse("urn:foo:bar:baz:quux"), uri.parse("")))
var b = uri.serialize(uri.resolveComponents(uri.parse(""), uri.parse("urn:foo:bar:baz:quux")))

console.log([a, b])

Outputs:

["urn:undefined:undefined", "urn:undefined:undefined"]

This seems like a bug, but perhaps I'm making an illogical request? This almost certainly seems related to: #26, although here it's with resolveComponents instead.

Runkit: https://runkit.com/embed/mf9pa43k4y9z

Add support for parsing query string into object

Didn't see this anywhere in the tests or documentation - ignore if there's already support for this.

Looking for something that supports a usage like:

const uriString = 'rando://bubba-gump?hello=there&whatever=you-say'
const uri = URI.parse(uriString)
const query = URI.parseQuery(uri)
const whatever = query.whatever

WS URI parsing not RFC conform?

I'm not quiet sure if this is a bug, but I think a Websocket URI is not parsed correctly.
I think the result should be something like this due to this RFC6455 which refers to this rfc3986#section-3.3:

const x = URI.parse('ws://localhost:8080/example?foo=bar');
//returns:
//{
//	scheme : "ws",
//	host: "localhost",
//     port: "8080",
//	path: "/example",
//	query: "?foo=bar",
//	ressourceName: "/example?foo=bar"
//}

The attribute ressouceName shall contain path and query and path shall not be empty, only if there is no path

Package Vulnerability: minimatch:3.0.4

Hi,

there is currently a security vulnerability in minimatch:3.0.4 (GHSA-f8q6-p94x-37v3)

I've noticed that the last version on uri-js (4.4.1) is still using minimatch:3.0.4.

This vulnerability is fixed in minimatch:3.0.5 or greater. Last verison is 5.1.1

Thanks

Support for earlier versions of node by downgrading dependency on punycode

The punycode module has a branch (1.4) which supports many more versions of node than the 2.x branch does.

While this module does not claim to support any particular versions of node, it would help the community if this module could downgrade to the 1.4 branch so that projects that depend on this module could continue to (safely) support node 4.

I'm not a punycoder, so I can't say for sure how much of a bother this would be, or whether you are using features that punycode v1.4 does not support.

Failing that, it would be nice if your module declared that it does not support node 4 and below in your package.json file.

Trying to get in touch regarding a security issue

Hi there,

I couldn't find a SECURITY.md in your repository and am not sure how to best contact you privately to disclose a security issue.

Can you add a SECURITY.md file with an e-mail to your repository, so that our system can send you the vulnerability details? GitHub suggests that a security policy is the best way to make sure security issues are responsibly disclosed.

Once you've done that, you should receive an e-mail within the next hour with more info.

Thanks! (cc @huntr-helper)

URI.serialize ignores String port

components = {
    scheme : "uri",
    host : "example.com",
    port : "9000"
};
URI.serialize(components)

actual: uri://example.com
expected: uri://example.com:9000

Support ws and wss protocols

I am not an expert on these protocols, but I believe that the websocket protocol's URIs are basically the same as HTTP URIs but with the protocol switched. (see "Encoding considerations" here: https://tools.ietf.org/id/draft-ietf-hybi-thewebsocketprotocol-17.html)

However, it seems like uri-js doesn't speak ws right now and urlencodes the hostname, which I think is wrong. I haven't fully comprehended RFC3987 yet, but I don't think you're
supposed to URLencode hostnames?

> URI.serialize({scheme: "http", host: "www.中华人民.com", path: "cats[]"})
'http://www.xn--fiq4m90jru6a.com/cats%5B%5D'
> URI.serialize({scheme: "ws", host: "www.中华人民.com", path: "cats[]"})
'ws://www.%E4%B8%AD%E5%8D%8E%E4%BA%BA%E6%B0%91.com/cats%5B%5D'

A workaround is to override the scheme in the options parameter:

> URI.serialize({scheme: "ws", host: "www.中华人民.com", path: "cats[]"}, {scheme: "http"})
'ws://www.xn--fiq4m90jru6a.com/cats%5B%5D'

It would be nice to have this library support it properly. It ought to be easy, if I understand things right, to just reuse the HTTP definition.

This library does not handle special signs in uri path segments

Bug

The library is not able to handle special signs in the URI path segments.

Example test case

export function StringToEncodedURI(raw: string) {
  const parsed = URI.parse(raw);
  const serialized = URI.serialize(parsed);
  return serialized;
}


describe('Failing test', () => {

  it('should encode urls with special symbols', () => {
    const expected = "https://a.b/c%23/d/1697736474704%231.jpg"
    const result = StringToEncodedURI("https://a.b/c#/d/1697736474704#1.jpg")
    expect(result).toEqual(expected);
  })

});

Issue when building using create-react-app

I'm trying to use another module (blockstack) which requires uri-js in a react application. When I try to build the application I get the following error. create-react-app recommended I open an issue.

Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file:

        ./node_modules/blockstack/node_modules/uri-js/dist/esnext/uri.js:42

Read more here: http://bit.ly/2tRViJ9
Note: Create React App can consume both CommonJS and ES modules. For Node.js compatibility, it is recommended that the main entry point is CommonJS. However, they can optionally provide an ES module entry point with the module field in package.json. Note that even if a library provides an ES Modules version, it should still precompile other ES6 features to ES5 if it intends to support older browsers.

Slow _normalizeIPv6

We are investigating slow startup time in Fastify, and we identified this library as our primary bottleneck (see also ajv-validator/ajv#995).

This is a flamegraph of the startup time. Apparently, the bottleneck is normalizing IPv6 addresses in

const matches = host.match(protocol.IPV6ADDRESS) || [];
.

Note that that RegExp is extremely long:

/^\[?((?:(?:(?:(?:[0-9A-Fa-f]{1,4})\:){6}(?:(?:(?:[0-9A-Fa-f]{1,4})\:(?:[0-9A-Fa-f]{1,4}))|(?:(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9][0-9])|(?:0?[1-9][0-9])|0?0?[0-9])\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9][0-9])|(?:0?[1-9][0-9])|0?0?[0-9])\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9][0-9])|(?:0?[1-9][0-9])|0?0?[0-9])\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9][0-9])|(?:0?[1-9][0-9])|0?0?[0-9]))))|(?:\:\:(?:(?:[0-9A-Fa-f]{1,4})\:){5}(?:(?:(?:[0-9A-Fa-f]{1,4})\:(?:[0-9A-Fa-f]{1,4}))|(?:(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9][0-9])|(?:0?[1-9][0-9])|0?0?[0-9])\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9][0-9])|(?:0?[1-9][0-9])|0?0?[0-9])\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9][0-9])|(?:0?[1-9][0-9])|0?0?[0-9])\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9][0-9])|(?:0?[1-9][0-9])|0?0?[0-9]))))|(?:(?:(?:[0-9A-Fa-f]{1,4}))?\:\:(?:(?:[0-9A-Fa-f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-Fa-f]{1,4})\:){0,6}(?:[0-9A-Fa-f]{1,4}))?\:\:)))(?:(?:\%25|\%(?![0-9A-Fa-f]{2}))((?:(?:[A-Za-z0-9\-\.\_\~\xA0-\u200D\u2010-\u2029\u202F-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(?:(?:%[EFef][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f])|(?:%[89A-Fa-f][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f])|(?:%[0-9A-Fa-f][0-9A-Fa-f])))+)))?\]?$/

This regexp is costly to evaluate at a 5-10ms each time on my machine (Node 10).

Do you think it's possible to simplify the above regexp so it's simpler and faster to execute?

4.2.0 breaks .resolve method for URNs

const uri = require('uri-js')
uri.resolve('', 'urn:some:ip:prop'); // 'urn:undefined:undefined'
uri.resolve('#', 'urn:some:ip:prop'); // 'urn:undefined:undefined'
uri.resolve('urn:some:ip:prop', 'urn:some:ip:prop'); // 'urn:undefined:undefined'

NPM package dscription does not match repo

The package description still uses what i assume is an older readme version.
It seemed odd since the changelog said validation was removed but the description said it has validation. 🙂

xip.io hosts parse fail

Hi.
There is a problem with parser in host recognition.

For example:
http://10.10.10.10.xip.io/en/process

errors: Array[0]
fragment: undefined
host: "10.10.10.10"
path: ".xip.io/en/ingredients"
port: undefined
query: undefined
reference: "absolute"
scheme: "http"
userinfo: undefined

But:
http://sub.10.10.10.10.xip.io/en/process

errors: Array[0]
fragment: undefined
host: "sub.10.10.10.10.xip.io"
path: "/ru/process"
port: undefined
query: undefined
reference: "absolute"
scheme: "http"
userinfo: undefined

In first case host was recognized incorrectly

IRIs?

I'm wondering if you know how difficult it would be to handle serializing to IRIs as well as URIs, for use in those (increasingly common) contexts that prefer them to ASCII-only strings. To me it kind of looks like it'd only need to tone down the percent-encoding a little, but I may be wrong...

Uri-js doesn't work in io.js (strict mode)

Hi, uri-js doesn't work in the latest version of io.js (strict mode).
It fails with this error:

.../uri-js/build/schemes/http.js:3 URI = require("../uri"); ^ ReferenceError: URI is not defined at Object.<anonymous> (/.../uri-js/build/schemes/http.js:3:9)

Error loading urn.js on IE 11

Error SCRIPT1014: Invalid character on Internet Explorer 11 with file /uri-js/dist/esnext/schemes/urn.js

screenshot from 2018-05-03 14-00-43

Using Webpack "^4.6.0"

.babelrc

{
  "presets" : [
    ["env", {
      "targets": {
        "browsers": ["last 2 versions", "ie >= 11"]
      }
    }],
  ]
}

Error when HOST is a IPv6.

This is when HOST use within .serialize() with ::.

Example.

Input:

URI.serialize({
  scheme: 'http',
  port: '80',
  host: '::'
});

Output:

http://%3A%3A/

yarn lock locks down [email protected] but this version has vulnerabilities

[email protected]:
version "1.9.2"
resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f"

is locked down in yarn.lock version but this version has vulnerabilities.
Is it possible to update it to the version that mocha gets in?

└─┬ [email protected]
└── [email protected]

There are other libraries as well. I will make a list of it but this seemed little high priority 👍
I can do a PR as well :)

Reduce the size of the npm package by limiting the included files

Looks like the files property (https://docs.npmjs.com/files/package.json#files) is not used in package.json to specify the included files, nor is the .npmignore file (https://docs.npmjs.com/misc/developers#keeping-files-out-of-your-package) is being used for blacklisting unwanted files, for the package published to npm.

Would you consider adding either the files property or the .npmignore file, so that the resulting package file would have smaller size?

The current size can be seen when executing the command npm pack (https://docs.npmjs.com/cli/pack).

This issue was create via tawata

ReferenceError: Unknown plugin "external-helpers"

Hello, I receive the following error when trying to build with webpack:

Module build failed: ReferenceError: Unknown plugin "external-helpers" specified in "workspace/node_modules/uri-js/.babelrc" at 0, attempted to resolve relative to "workspace/node_modules/uri-js"
    at workspace/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
    at Array.map (native)
    at Function.normalisePlugins (workspace/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
    at OptionManager.mergeOptions (workspace/node_modules/babel-core/lib/transformation/file/options/option-manager.js:233:36)
    at OptionManager.init (workspace/node_modules/babel-core/lib/transformation/file/options/option-manager.js:367:12)
    at File.initOptions (workspace/node_modules/babel-core/lib/transformation/file/index.js:216:65)
    at new File (workspace/node_modules/babel-core/lib/transformation/file/index.js:139:24)
    at Pipeline.transform (workspace/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
    at transpile (workspace/node_modules/babel-loader/lib/index.js:38:20)
    at Object.module.exports (workspace/node_modules/babel-loader/lib/index.js:133:12)
 @ ./static/js/main.js 3:0-17
 @ multi ./static/js/main.js

I am referencing the file like this:

import 'uri-js';

My webpack config only makes use of babel-loader:

{
  test: /\.js$/,
  use: 'babel-loader'
}

Any idea where this comes from?

Export types other than `URIComponents`

Hi there, this library is awesome! However, when I am trying to use it to parse a mailto protocol string, I can't access the to properties in the URIComponents interface.

Can you please export types/interfaces such as MailToComponents so that I don't need to do this:

const { to } = URI.parse(url) as MailtoComponents;

parse hangs on some long urls

During penetration tests with Burp Suite we found that our app hangs on some requests.
It turned out that uri-js parse hangs on some long urls. Here is a simple script to reproduce it:

var uri = require('uri-js');

var uris = [
  '/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/windows\\win.ini',
  '/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/windows\\win.ini',
  '/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/windows\\win.ini',
  '/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/windows\\win.ini'
];

for (var i in uris) {
  console.log(uris[i]);
  console.time('time');
  var p = uri.parse(uris[i])
  console.timeEnd('time');
  console.log(p);
}

Here is the result on my machine

/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/windows\win.ini
time: 732ms
{ error: 'URI is not strictly valid.',
  scheme: undefined,
  userinfo: undefined,
  host: undefined,
  port: undefined,
  path: '/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/windows%5Cwin.ini',
  query: undefined,
  fragment: undefined,
  reference: 'relative' }
/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/windows\win.ini
time: 3655ms
{ error: 'URI is not strictly valid.',
  scheme: undefined,
  userinfo: undefined,
  host: undefined,
  port: undefined,
  path: '/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/windows%5Cw
in.ini',
  query: undefined,
  fragment: undefined,
  reference: 'relative' }
/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/windows
\win.ini
time: 18254ms
{ error: 'URI is not strictly valid.',
  scheme: undefined,
  userinfo: undefined,
  host: undefined,
  port: undefined,
  path: '/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%AE/%C0%AE%C0%A
E/windows%5Cwin.ini',
  query: undefined,
  fragment: undefined,
  reference: 'relative' }
/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%
c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/windows\win.ini

Notice how the time increases exponentially - about 5x for each new segment.
So with long enough URL parse just hangs at 100% CPU.

It seems uri-js uses a generated regex which in my case appears to be this:

/(^((?:[A-Za-z][A-Za-z0-9\+\-\.]*))\:(?:(?:\/\/((?:((?:(?:(?:(?:%[EFef][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f])|(?:%[89A-Fa-f][0-9A-F
a-f]%[0-9A-Fa-f][0-9A-Fa-f])|(?:%[0-9A-Fa-f][0-9A-Fa-f]))|[A-Za-z0-9\-\.\_\~\xA0-\u200D\u2010-\u2029\u202F-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF\!\$\&\'\(\)
\*\+\,\;\=\:])*))@)?((?:(?:\[(?:(?:[A-Za-z0-9\-\.\_\~\xA0-\u200D\u2010-\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[0-9A-Fa-f][0-9A-Fa-f])|(?:%[0-9A-Fa-f][0-9A-Fa-f]))|[A-Za-z0-9\-\.\_\~\xA0-\u200D\u2010-\u2029\u202F-\uD7FF\uF900-\uFD
CF\uFDF0-\uFFEF\!\$\&\'\(\)\*\+\,\;\=\:\@])|[\/\?\uE000-\uF8FF])*)))?(?:\#((?:(?:(?:(?:(?:%[EFef][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa
-f])|(?:%[89A-Fa-f][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f])|(?:%[0-9A-Fa-f][0-9A-Fa-f]))|[A-Za-z0-9\-\.\_\~\xA0-\u200D\u2010-\u2029\u202F-\uD7FF\uF900-\uFDC
F\uFDF0-\uFFEF\!\$\&\'\(\)\*\+\,\;\=\:\@])|[\/\?])*)))?$)/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.