1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-05 07:45:54 +02:00

fix(deps): update [backend] update dependencies (#16547)

* fix(deps): update [backend] update dependencies

* chore: update typeorm.patch

* fix: handle socket creation failure in HttpRequestServiceAgent

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: anatawa12 <anatawa12@icloud.com>
Co-authored-by: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com>
This commit is contained in:
renovate[bot]
2025-10-04 15:04:28 +09:00
committed by GitHub
parent 6c634de482
commit a393d5a87e
4 changed files with 1352 additions and 605 deletions

View File

@@ -37,17 +37,23 @@ class HttpRequestServiceAgent extends http.Agent {
@bindThis
public createConnection(options: http.ClientRequestArgs, callback?: (err: Error | null, stream: stream.Duplex) => void): stream.Duplex {
const socket = super.createConnection(options, callback)
.on('connect', () => {
if (socket instanceof net.Socket && process.env.NODE_ENV === 'production') {
const address = socket.remoteAddress;
if (address && ipaddr.isValid(address)) {
if (this.isPrivateIp(address)) {
socket.destroy(new Error(`Blocked address: ${address}`));
}
const socket = super.createConnection(options, callback);
if (socket == null) {
throw new Error('Failed to create socket');
}
socket.on('connect', () => {
if (socket instanceof net.Socket && process.env.NODE_ENV === 'production') {
const address = socket.remoteAddress;
if (address && ipaddr.isValid(address)) {
if (this.isPrivateIp(address)) {
socket.destroy(new Error(`Blocked address: ${address}`));
}
}
});
}
});
return socket;
}
@@ -76,17 +82,23 @@ class HttpsRequestServiceAgent extends https.Agent {
@bindThis
public createConnection(options: http.ClientRequestArgs, callback?: (err: Error | null, stream: stream.Duplex) => void): stream.Duplex {
const socket = super.createConnection(options, callback)
.on('connect', () => {
if (socket instanceof net.Socket && process.env.NODE_ENV === 'production') {
const address = socket.remoteAddress;
if (address && ipaddr.isValid(address)) {
if (this.isPrivateIp(address)) {
socket.destroy(new Error(`Blocked address: ${address}`));
}
const socket = super.createConnection(options, callback);
if (socket == null) {
throw new Error('Failed to create socket');
}
socket.on('connect', () => {
if (socket instanceof net.Socket && process.env.NODE_ENV === 'production') {
const address = socket.remoteAddress;
if (address && ipaddr.isValid(address)) {
if (this.isPrivateIp(address)) {
socket.destroy(new Error(`Blocked address: ${address}`));
}
}
});
}
});
return socket;
}