Skip to content

Commit c54494c

Browse files
committed
run for the entire codebase
1 parent 9093d9a commit c54494c

File tree

196 files changed

+1615
-778
lines changed

Some content is hidden

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

196 files changed

+1615
-778
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 & 3 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,19 +370,23 @@ 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: {
377+
__proto__: null,
376378
req: {
379+
__proto__: null,
377380
method: this.method,
378381
url: `${this.protocol}//${this.host}${this.path}`,
379-
headers: typeof this.getHeaders === 'function' ? this.getHeaders() : {},
382+
headers: typeof this.getHeaders === 'function' ? this.getHeaders() : { __proto__: null },
380383
},
381384
},
382385
});
383386
}
384387
if (onClientRequestStartChannel.hasSubscribers) {
385388
onClientRequestStartChannel.publish({
389+
__proto__: null,
386390
request: this,
387391
});
388392
}
@@ -637,6 +641,7 @@ function parserOnIncomingClient(res, shouldKeepAlive) {
637641
}
638642
// Send information events to all 1xx responses except 101 Upgrade.
639643
req.emit('information', {
644+
__proto__: null,
640645
statusCode: res.statusCode,
641646
statusMessage: res.statusMessage,
642647
httpVersion: res.httpVersion,
@@ -658,8 +663,11 @@ function parserOnIncomingClient(res, shouldKeepAlive) {
658663

659664
if (req[kClientRequestStatistics] && hasObserver('http')) {
660665
stopPerf(req, kClientRequestStatistics, {
666+
__proto__: null,
661667
detail: {
668+
__proto__: null,
662669
res: {
670+
__proto__: null,
663671
statusCode: res.statusCode,
664672
statusMessage: res.statusMessage,
665673
headers: res.headers,
@@ -669,12 +677,14 @@ function parserOnIncomingClient(res, shouldKeepAlive) {
669677
}
670678
if (onClientResponseFinishChannel.hasSubscribers) {
671679
onClientResponseFinishChannel.publish({
680+
__proto__: null,
672681
request: req,
673682
response: res,
674683
});
675684
}
676685
if (isTraceHTTPEnabled() && typeof req._traceEventId === 'number') {
677686
traceEnd(HTTP_CLIENT_TRACE_EVENT_NAME, req._traceEventId, {
687+
__proto__: null,
678688
path: req.path,
679689
statusCode: res.statusCode,
680690
});

lib/_http_incoming.js

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

5656
if (socket) {
5757
streamOptions = {
58+
__proto__: null,
5859
highWaterMark: socket.readableHighWaterMark,
5960
};
6061
}
@@ -111,7 +112,7 @@ ObjectDefineProperty(IncomingMessage.prototype, 'headers', {
111112
__proto__: null,
112113
get: function() {
113114
if (!this[kHeaders]) {
114-
this[kHeaders] = {};
115+
this[kHeaders] = { __proto__: null };
115116

116117
const src = this.rawHeaders;
117118
const dst = this[kHeaders];
@@ -131,7 +132,7 @@ ObjectDefineProperty(IncomingMessage.prototype, 'headersDistinct', {
131132
__proto__: null,
132133
get: function() {
133134
if (!this[kHeadersDistinct]) {
134-
this[kHeadersDistinct] = {};
135+
this[kHeadersDistinct] = { __proto__: null };
135136

136137
const src = this.rawHeaders;
137138
const dst = this[kHeadersDistinct];
@@ -151,7 +152,7 @@ ObjectDefineProperty(IncomingMessage.prototype, 'trailers', {
151152
__proto__: null,
152153
get: function() {
153154
if (!this[kTrailers]) {
154-
this[kTrailers] = {};
155+
this[kTrailers] = { __proto__: null };
155156

156157
const src = this.rawTrailers;
157158
const dst = this[kTrailers];
@@ -171,7 +172,7 @@ ObjectDefineProperty(IncomingMessage.prototype, 'trailersDistinct', {
171172
__proto__: null,
172173
get: function() {
173174
if (!this[kTrailersDistinct]) {
174-
this[kTrailersDistinct] = {};
175+
this[kTrailersDistinct] = { __proto__: null };
175176

176177
const src = this.rawTrailers;
177178
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 & 2 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,13 @@ function ServerResponse(req, options) {
210211

211212
if (hasObserver('http')) {
212213
startPerf(this, kServerResponseStatistics, {
214+
__proto__: null,
213215
type: 'http',
214216
name: 'HttpRequest',
215217
detail: {
218+
__proto__: null,
216219
req: {
220+
__proto__: null,
217221
method: req.method,
218222
url: req.url,
219223
headers: req.headers,
@@ -232,18 +236,22 @@ ObjectSetPrototypeOf(ServerResponse, OutgoingMessage);
232236
ServerResponse.prototype._finish = function _finish() {
233237
if (this[kServerResponseStatistics] && hasObserver('http')) {
234238
stopPerf(this, kServerResponseStatistics, {
239+
__proto__: null,
235240
detail: {
241+
__proto__: null,
236242
res: {
243+
__proto__: null,
237244
statusCode: this.statusCode,
238245
statusMessage: this.statusMessage,
239-
headers: typeof this.getHeaders === 'function' ? this.getHeaders() : {},
246+
headers: typeof this.getHeaders === 'function' ? this.getHeaders() : { __proto__: null },
240247
},
241248
},
242249
});
243250
}
244251
OutgoingMessage.prototype._finish.call(this);
245252
if (isTraceHTTPEnabled() && typeof this._traceEventId === 'number') {
246253
const data = {
254+
__proto__: null,
247255
url: this.req?.url,
248256
statusCode: this.statusCode,
249257
};
@@ -530,7 +538,7 @@ function Server(options, requestListener) {
530538
storeHTTPOptions.call(this, options);
531539
net.Server.call(
532540
this,
533-
{ allowHalfOpen: true, noDelay: options.noDelay ?? true,
541+
{ __proto__: null, allowHalfOpen: true, noDelay: options.noDelay ?? true,
534542
keepAlive: options.keepAlive,
535543
keepAliveInitialDelay: options.keepAliveInitialDelay,
536544
highWaterMark: options.highWaterMark });
@@ -674,6 +682,7 @@ function connectionListenerInternal(server, socket) {
674682
}
675683

676684
const state = {
685+
__proto__: null,
677686
onData: null,
678687
onEnd: null,
679688
onClose: null,
@@ -961,6 +970,7 @@ function clearIncoming(req) {
961970
function resOnFinish(req, res, socket, state, server) {
962971
if (onResponseFinishChannel.hasSubscribers) {
963972
onResponseFinishChannel.publish({
973+
__proto__: null,
964974
request: req,
965975
response: res,
966976
socket,
@@ -1044,6 +1054,7 @@ function parserOnIncoming(server, socket, state, req, keepAlive) {
10441054

10451055
const res = new server[kServerResponse](req,
10461056
{
1057+
__proto__: null,
10471058
highWaterMark: socket.writableHighWaterMark,
10481059
rejectNonStandardBodyWrites: server.rejectNonStandardBodyWrites,
10491060
});
@@ -1057,6 +1068,7 @@ function parserOnIncoming(server, socket, state, req, keepAlive) {
10571068

10581069
if (onRequestStartChannel.hasSubscribers) {
10591070
onRequestStartChannel.publish({
1071+
__proto__: null,
10601072
request: req,
10611073
response: res,
10621074
socket,

lib/_tls_wrap.js

Lines changed: 12 additions & 5 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,6 +1468,7 @@ Server.prototype.setSecureContext = function(options) {
14641468

14651469
Server.prototype._getServerData = function() {
14661470
return {
1471+
__proto__: null,
14671472
ticketKeys: this.getTicketKeys().toString('hex'),
14681473
};
14691474
};
@@ -1698,6 +1703,7 @@ exports.connect = function connect(...args) {
16981703
const allowUnauthorized = getAllowUnauthorized();
16991704

17001705
options = {
1706+
__proto__: null,
17011707
rejectUnauthorized: !allowUnauthorized,
17021708
ciphers: tls.DEFAULT_CIPHERS,
17031709
checkServerIdentity: tls.checkServerIdentity,
@@ -1718,6 +1724,7 @@ exports.connect = function connect(...args) {
17181724
const context = options.secureContext || tls.createSecureContext(options);
17191725

17201726
const tlssock = new TLSSocket(options.socket, {
1727+
__proto__: null,
17211728
allowHalfOpen: options.allowHalfOpen,
17221729
pipe: !!options.path,
17231730
secureContext: context,

0 commit comments

Comments
 (0)