Skip to content

Commit a5f145c

Browse files
committed
run for the entire codebase
1 parent aafd615 commit a5f145c

File tree

199 files changed

+1613
-844
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

199 files changed

+1613
-844
lines changed

lib/_http_agent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,5 +551,5 @@ function asyncResetHandle(socket) {
551551

552552
module.exports = {
553553
Agent,
554-
globalAgent: new Agent({ keepAlive: true, scheduling: 'lifo', timeout: 5000 }),
554+
globalAgent: new Agent({ __proto__: null, keepAlive: true, scheduling: 'lifo', timeout: 5000 }),
555555
};

lib/_http_client.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ function ClientRequest(input, options, cb) {
146146
cb = options;
147147
options = input || kEmptyObject;
148148
} else {
149-
options = ObjectAssign(input || {}, options);
149+
options = ObjectAssign(input || { __proto__: null }, options);
150150
}
151151

152152
let agent = options.agent;
@@ -328,7 +328,7 @@ function ClientRequest(input, options, cb) {
328328

329329
let optsWithoutSignal = options;
330330
if (optsWithoutSignal.signal) {
331-
optsWithoutSignal = ObjectAssign({}, options);
331+
optsWithoutSignal = ObjectAssign({ __proto__: null }, options);
332332
delete optsWithoutSignal.signal;
333333
}
334334

@@ -370,20 +370,22 @@ ClientRequest.prototype._finish = function _finish() {
370370
FunctionPrototypeCall(OutgoingMessage.prototype._finish, this);
371371
if (hasObserver('http')) {
372372
startPerf(this, kClientRequestStatistics, {
373+
__proto__: null,
373374
type: 'http',
374375
name: 'HttpClient',
375376
detail: {
376-
req: {
377+
__proto__: null, req: {
378+
__proto__: null,
377379
method: this.method,
378380
url: `${this.protocol}//${this.host}${this.path}`,
379-
headers: typeof this.getHeaders === 'function' ? this.getHeaders() : {},
381+
headers: typeof this.getHeaders === 'function' ? this.getHeaders() : { __proto__: null },
380382
},
381383
},
382384
});
383385
}
384386
if (onClientRequestStartChannel.hasSubscribers) {
385387
onClientRequestStartChannel.publish({
386-
request: this,
388+
__proto__: null, request: this,
387389
});
388390
}
389391
if (isTraceHTTPEnabled()) {
@@ -637,6 +639,7 @@ function parserOnIncomingClient(res, shouldKeepAlive) {
637639
}
638640
// Send information events to all 1xx responses except 101 Upgrade.
639641
req.emit('information', {
642+
__proto__: null,
640643
statusCode: res.statusCode,
641644
statusMessage: res.statusMessage,
642645
httpVersion: res.httpVersion,
@@ -658,8 +661,9 @@ function parserOnIncomingClient(res, shouldKeepAlive) {
658661

659662
if (req[kClientRequestStatistics] && hasObserver('http')) {
660663
stopPerf(req, kClientRequestStatistics, {
661-
detail: {
662-
res: {
664+
__proto__: null, detail: {
665+
__proto__: null, res: {
666+
__proto__: null,
663667
statusCode: res.statusCode,
664668
statusMessage: res.statusMessage,
665669
headers: res.headers,
@@ -669,12 +673,14 @@ function parserOnIncomingClient(res, shouldKeepAlive) {
669673
}
670674
if (onClientResponseFinishChannel.hasSubscribers) {
671675
onClientResponseFinishChannel.publish({
676+
__proto__: null,
672677
request: req,
673678
response: res,
674679
});
675680
}
676681
if (isTraceHTTPEnabled() && typeof req._traceEventId === 'number') {
677682
traceEnd(HTTP_CLIENT_TRACE_EVENT_NAME, req._traceEventId, {
683+
__proto__: null,
678684
path: req.path,
679685
statusCode: res.statusCode,
680686
});

lib/_http_incoming.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function IncomingMessage(socket) {
5555

5656
if (socket) {
5757
streamOptions = {
58-
highWaterMark: socket.readableHighWaterMark,
58+
__proto__: null, highWaterMark: socket.readableHighWaterMark,
5959
};
6060
}
6161

@@ -111,7 +111,7 @@ ObjectDefineProperty(IncomingMessage.prototype, 'headers', {
111111
__proto__: null,
112112
get: function() {
113113
if (!this[kHeaders]) {
114-
this[kHeaders] = {};
114+
this[kHeaders] = { __proto__: null };
115115

116116
const src = this.rawHeaders;
117117
const dst = this[kHeaders];
@@ -131,7 +131,7 @@ ObjectDefineProperty(IncomingMessage.prototype, 'headersDistinct', {
131131
__proto__: null,
132132
get: function() {
133133
if (!this[kHeadersDistinct]) {
134-
this[kHeadersDistinct] = {};
134+
this[kHeadersDistinct] = { __proto__: null };
135135

136136
const src = this.rawHeaders;
137137
const dst = this[kHeadersDistinct];
@@ -151,7 +151,7 @@ ObjectDefineProperty(IncomingMessage.prototype, 'trailers', {
151151
__proto__: null,
152152
get: function() {
153153
if (!this[kTrailers]) {
154-
this[kTrailers] = {};
154+
this[kTrailers] = { __proto__: null };
155155

156156
const src = this.rawTrailers;
157157
const dst = this[kTrailers];
@@ -171,7 +171,7 @@ ObjectDefineProperty(IncomingMessage.prototype, 'trailersDistinct', {
171171
__proto__: null,
172172
get: function() {
173173
if (!this[kTrailersDistinct]) {
174-
this[kTrailersDistinct] = {};
174+
this[kTrailersDistinct] = { __proto__: null };
175175

176176
const src = this.rawTrailers;
177177
const dst = this[kTrailersDistinct];

lib/_http_outgoing.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ OutgoingMessage.prototype._renderHeaders = function _renderHeaders() {
284284
}
285285

286286
const headersMap = this[kOutHeaders];
287-
const headers = {};
287+
const headers = { __proto__: null };
288288

289289
if (headersMap !== null) {
290290
const keys = ObjectKeys(headersMap);
@@ -368,6 +368,7 @@ OutgoingMessage.prototype._send = function _send(data, encoding, callback, byteL
368368
} else {
369369
const header = this._header;
370370
this.outputData.unshift({
371+
__proto__: null,
371372
data: header,
372373
encoding: 'latin1',
373374
callback: null,
@@ -403,7 +404,7 @@ function _writeRaw(data, encoding, callback, size) {
403404
return conn.write(data, encoding, callback);
404405
}
405406
// Buffer, as long as we're not destroyed.
406-
this.outputData.push({ data, encoding, callback });
407+
this.outputData.push({ __proto__: null, data, encoding, callback });
407408
this.outputSize += data.length;
408409
this._onPendingData(data.length);
409410
return this.outputSize < this[kHighWaterMark];
@@ -415,6 +416,7 @@ function _storeHeader(firstLine, headers) {
415416
// firstLine in the case of request is: 'GET /index.html HTTP/1.1\r\n'
416417
// in the case of response it is: 'HTTP/1.1 200 OK\r\n'
417418
const state = {
419+
__proto__: null,
418420
connection: false,
419421
contLen: false,
420422
te: false,

lib/_http_server.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ const {
111111
} = require('internal/perf/observe');
112112

113113
const STATUS_CODES = {
114+
__proto__: null,
114115
100: 'Continue', // RFC 7231 6.2.1
115116
101: 'Switching Protocols', // RFC 7231 6.2.2
116117
102: 'Processing', // RFC 2518 10.1 (obsoleted by RFC 4918)
@@ -210,10 +211,12 @@ function ServerResponse(req, options) {
210211

211212
if (hasObserver('http')) {
212213
startPerf(this, kServerResponseStatistics, {
214+
__proto__: null,
213215
type: 'http',
214216
name: 'HttpRequest',
215217
detail: {
216-
req: {
218+
__proto__: null, req: {
219+
__proto__: null,
217220
method: req.method,
218221
url: req.url,
219222
headers: req.headers,
@@ -232,18 +235,20 @@ ObjectSetPrototypeOf(ServerResponse, OutgoingMessage);
232235
ServerResponse.prototype._finish = function _finish() {
233236
if (this[kServerResponseStatistics] && hasObserver('http')) {
234237
stopPerf(this, kServerResponseStatistics, {
235-
detail: {
236-
res: {
238+
__proto__: null, detail: {
239+
__proto__: null, res: {
240+
__proto__: null,
237241
statusCode: this.statusCode,
238242
statusMessage: this.statusMessage,
239-
headers: typeof this.getHeaders === 'function' ? this.getHeaders() : {},
243+
headers: typeof this.getHeaders === 'function' ? this.getHeaders() : { __proto__: null },
240244
},
241245
},
242246
});
243247
}
244248
OutgoingMessage.prototype._finish.call(this);
245249
if (isTraceHTTPEnabled() && typeof this._traceEventId === 'number') {
246250
const data = {
251+
__proto__: null,
247252
url: this.req?.url,
248253
statusCode: this.statusCode,
249254
};
@@ -530,7 +535,7 @@ function Server(options, requestListener) {
530535
storeHTTPOptions.call(this, options);
531536
net.Server.call(
532537
this,
533-
{ allowHalfOpen: true, noDelay: options.noDelay ?? true,
538+
{ __proto__: null, allowHalfOpen: true, noDelay: options.noDelay ?? true,
534539
keepAlive: options.keepAlive,
535540
keepAliveInitialDelay: options.keepAliveInitialDelay,
536541
highWaterMark: options.highWaterMark });
@@ -674,6 +679,7 @@ function connectionListenerInternal(server, socket) {
674679
}
675680

676681
const state = {
682+
__proto__: null,
677683
onData: null,
678684
onEnd: null,
679685
onClose: null,
@@ -961,6 +967,7 @@ function clearIncoming(req) {
961967
function resOnFinish(req, res, socket, state, server) {
962968
if (onResponseFinishChannel.hasSubscribers) {
963969
onResponseFinishChannel.publish({
970+
__proto__: null,
964971
request: req,
965972
response: res,
966973
socket,
@@ -1044,6 +1051,7 @@ function parserOnIncoming(server, socket, state, req, keepAlive) {
10441051

10451052
const res = new server[kServerResponse](req,
10461053
{
1054+
__proto__: null,
10471055
highWaterMark: socket.writableHighWaterMark,
10481056
rejectNonStandardBodyWrites: server.rejectNonStandardBodyWrites,
10491057
});
@@ -1057,6 +1065,7 @@ function parserOnIncoming(server, socket, state, req, keepAlive) {
10571065

10581066
if (onRequestStartChannel.hasSubscribers) {
10591067
onRequestStartChannel.publish({
1068+
__proto__: null,
10601069
request: req,
10611070
response: res,
10621071
socket,

lib/_tls_wrap.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ function callALPNCallback(protocolsBuffer) {
257257
}
258258

259259
const selectedProtocol = socket[kALPNCallback]({
260+
__proto__: null,
260261
servername,
261262
protocols,
262263
});
@@ -436,7 +437,7 @@ function onPskClientCallback(hint, maxPskLen, maxIdentityLen) {
436437
);
437438
}
438439

439-
return { psk: ret.psk, identity: ret.identity };
440+
return { __proto__: null, psk: ret.psk, identity: ret.identity };
440441
}
441442

442443
function onkeylog(line) {
@@ -510,7 +511,7 @@ function initRead(tlsSocket, socket) {
510511
*/
511512

512513
function TLSSocket(socket, opts) {
513-
const tlsOptions = { ...opts };
514+
const tlsOptions = { __proto__: null, ...opts };
514515
let enableTrace = tlsOptions.enableTrace;
515516

516517
if (enableTrace == null) {
@@ -563,6 +564,7 @@ function TLSSocket(socket, opts) {
563564
this.encrypted = true;
564565

565566
ReflectApply(net.Socket, this, [{
567+
__proto__: null,
566568
handle: this._wrapHandle(wrap),
567569
allowHalfOpen: socket ? socket.allowHalfOpen : tlsOptions.allowHalfOpen,
568570
pauseOnCreate: tlsOptions.pauseOnConnect,
@@ -843,7 +845,7 @@ TLSSocket.prototype._init = function(socket, wrap) {
843845
'by writing secret key material to file ' + tlsKeylog);
844846
}
845847
this.on('keylog', (line) => {
846-
appendFile(tlsKeylog, line, { mode: 0o600 }, (err) => {
848+
appendFile(tlsKeylog, line, { __proto__: null, mode: 0o600 }, (err) => {
847849
if (err && warnOnTlsKeylogError) {
848850
warnOnTlsKeylogError = false;
849851
process.emitWarning('Failed to write TLS keylog (this warning ' +
@@ -1078,7 +1080,7 @@ TLSSocket.prototype.setSession = function(session) {
10781080
TLSSocket.prototype.getPeerCertificate = function(detailed) {
10791081
if (this._handle) {
10801082
return common.translatePeerCertificate(
1081-
this._handle.getPeerCertificate(detailed)) || {};
1083+
this._handle.getPeerCertificate(detailed)) || { __proto__: null };
10821084
}
10831085

10841086
return null;
@@ -1088,7 +1090,7 @@ TLSSocket.prototype.getCertificate = function() {
10881090
if (this._handle) {
10891091
// It's not a peer cert, but the formatting is identical.
10901092
return common.translatePeerCertificate(
1091-
this._handle.getCertificate()) || {};
1093+
this._handle.getCertificate()) || { __proto__: null };
10921094
}
10931095

10941096
return null;
@@ -1179,6 +1181,7 @@ function onSocketClose(err) {
11791181
function tlsConnectionListener(rawSocket) {
11801182
debug('net.Server.on(connection): new TLSSocket');
11811183
const socket = new TLSSocket(rawSocket, {
1184+
__proto__: null,
11821185
secureContext: this._sharedCreds,
11831186
isServer: true,
11841187
server: this,
@@ -1437,6 +1440,7 @@ Server.prototype.setSecureContext = function(options) {
14371440
this.privateKeyEngine = options.privateKeyEngine;
14381441

14391442
this._sharedCreds = tls.createSecureContext({
1443+
__proto__: null,
14401444
pfx: this.pfx,
14411445
key: this.key,
14421446
passphrase: this.passphrase,
@@ -1464,7 +1468,7 @@ Server.prototype.setSecureContext = function(options) {
14641468

14651469
Server.prototype._getServerData = function() {
14661470
return {
1467-
ticketKeys: this.getTicketKeys().toString('hex'),
1471+
__proto__: null, ticketKeys: this.getTicketKeys().toString('hex'),
14681472
};
14691473
};
14701474

@@ -1698,6 +1702,7 @@ exports.connect = function connect(...args) {
16981702
const allowUnauthorized = getAllowUnauthorized();
16991703

17001704
options = {
1705+
__proto__: null,
17011706
rejectUnauthorized: !allowUnauthorized,
17021707
ciphers: tls.DEFAULT_CIPHERS,
17031708
checkServerIdentity: tls.checkServerIdentity,
@@ -1718,6 +1723,7 @@ exports.connect = function connect(...args) {
17181723
const context = options.secureContext || tls.createSecureContext(options);
17191724

17201725
const tlssock = new TLSSocket(options.socket, {
1726+
__proto__: null,
17211727
allowHalfOpen: options.allowHalfOpen,
17221728
pipe: !!options.path,
17231729
secureContext: context,

0 commit comments

Comments
 (0)