Skip to content

Does protocol casing affect the URL parsing?Β #32

@armanm

Description

@armanm

I don't know enough about URL parsing to know if this is the correct behaviour but here is a test case:

const URL = require('url')

URL.parse('javascript:ALERT(DOCUMENT.DOMAIN)').href
// => 'javascript:ALERT(DOCUMENT.DOMAIN)'

URL.parse('JAVASCRIPT:ALERT(DOCUMENT.DOMAIN)').href
// => 'javascript:alert/(DOCUMENT.DOMAIN)'

As you can see in the latter example when protocol is specified in upper case, the href ends up partly lowercased and with an extra slash.

Could someone explain if this is a bug or a correct behaviour?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions