Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
node-url-parse
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Debian JavaScript Maintainers
node-url-parse
Commits
e4204c37
Commit
e4204c37
authored
5 years ago
by
Yadd
Browse files
Options
Downloads
Patches
Plain Diff
Add patch to sanitize paths and hosts before parsing (Closes: #906058, CVE-2018-3774)
parent
16915af1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
debian/patches/CVE-2018-3774.patch
+79
-0
79 additions, 0 deletions
debian/patches/CVE-2018-3774.patch
debian/patches/series
+1
-0
1 addition, 0 deletions
debian/patches/series
with
80 additions
and
0 deletions
debian/patches/CVE-2018-3774.patch
0 → 100644
+
79
−
0
View file @
e4204c37
Description: Fix for CVE-2018-3774
Author: Arnout Kazemier <https://github.com/3rd-Eden/>
Origin: upstream, https://github.com/unshiftio/url-parse/commit/53b1794e
Bug: https://security-tracker.debian.org/tracker/CVE-2018-3774
Bug-Debian: https://bugs.debian.org/906058
Forwarded: not-needed
Reviewed-By: Xavier Guimard <yadd@debian.org>
Last-Update: 2019-06-11
--- a/index.js
+++ b/index.js
@@ -20,6 +20,9 @@
var instructions = [
['#', 'hash'], // Extract from the back.
['?', 'query'], // Extract from the back.
+ function sanitize(address) { // Sanitize what is left of the address
+ return address.replace('\\', '/');
+ },
['//', 'protocol', 2, 1, 1], // Extract from the front.
['/', 'pathname'], // Extract from the back.
['@', 'auth', 1], // Extract from the front.
@@ -74,6 +77,10 @@
for (; i < instructions.length; i++) {
instruction = instructions[i];
+ if (typeof instruction === 'function') {
+ address = instruction(address);
+ continue;
+ }
parse = instruction[0];
key = instruction[1];
--- a/test.js
+++ b/test.js
@@ -152,6 +152,28 @@
assume(parsed.pathname).equals('/b/c');
});
+ it('ignores \\ in pathnames', function () {
+ var url = 'http://google.com:80\\@yahoo.com/#what\\is going on'
+ , parsed = parse(url);
+
+ assume(parsed.port).equals('');
+ assume(parsed.username).equals('');
+ assume(parsed.password).equals('');
+ assume(parsed.hostname).equals('google.com');
+ assume(parsed.hash).equals('#what\\is going on');
+
+ parsed = parse('//\\what-is-up.com');
+ assume(parsed.pathname).equals('/what-is-up.com');
+ });
+
+ it('correctly ignores multiple slashes //', function () {
+ var url = '////what-is-up.com'
+ , parsed = parse(url);
+
+ assume(parsed.host).equals('');
+ assume(parsed.hostname).equals('');
+ });
+
describe('ip', function () {
// coap://
//
@@ -386,6 +408,15 @@
assume(data.href).equals('https://google.com/?foo=bar');
});
+
+ it('maintains the port number for non-default port numbers', function () {
+ var parsed = parse('http://google.com:8080/pathname');
+
+ assume(parsed.set('host', 'google.com:8080')).equals(parsed);
+
+ assume(parsed.host).equals('google.com:8080');
+ assume(parsed.href).equals('http://google.com:8080/pathname');
+ });
});
describe('fuzzy', function () {
This diff is collapsed.
Click to expand it.
debian/patches/series
0 → 100644
+
1
−
0
View file @
e4204c37
CVE-2018-3774.patch
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment