Skip to content

Commit dd20c01

Browse files
mcollinarvagg
authored andcommittedNov 27, 2018
http: add --security-revert for CVE-2018-12116
PR-URL: nodejs-private/node-private#146 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent 35344e8 commit dd20c01

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed
 

‎lib/_http_client.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const OutgoingMessage = require('_http_outgoing').OutgoingMessage;
1414
const Agent = require('_http_agent');
1515
const Buffer = require('buffer').Buffer;
1616

17+
const REVERT_CVE_2018_12116 = process.REVERT_CVE_2018_12116;
18+
1719
const INVALID_PATH_REGEX = /[^\u0021-\u00ff]/;
1820

1921
function ClientRequest(options, cb) {
@@ -47,7 +49,14 @@ function ClientRequest(options, cb) {
4749
var path;
4850
if (options.path) {
4951
path = String(options.path);
50-
if (INVALID_PATH_REGEX.test(path))
52+
var invalidPath;
53+
if (REVERT_CVE_2018_12116) {
54+
invalidPath = /[\u0000-\u0020]/.test(path);
55+
} else {
56+
invalidPath = INVALID_PATH_REGEX.test(path);
57+
}
58+
59+
if (invalidPath)
5160
throw new TypeError('Request path contains unescaped characters');
5261
}
5362

‎src/node_revert.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
**/
1616
namespace node {
1717

18-
#define SECURITY_REVERSIONS(XX)
19-
// XX(CVE_2016_PEND, "CVE-2016-PEND", "Vulnerability Title")
18+
#define SECURITY_REVERSIONS(XX) \
19+
XX(CVE_2018_12116, "CVE-2018-12116", "HTTP request splitting")
2020

2121
enum reversion {
2222
#define V(code, ...) SECURITY_REVERT_##code,

0 commit comments

Comments
 (0)
Please sign in to comment.