@aikidosec/broker-client 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/app/client.js CHANGED
@@ -12,7 +12,7 @@ import { Address4, Address6 } from 'ip-address';
12
12
  import dns from 'native-dns';
13
13
  import { ResourceManager } from './resourceManager.js';
14
14
  import { HttpsProxyAgent } from 'https-proxy-agent';
15
- import { getClientId, setClientIdCache, getServerUrl, getClientSecret } from './config.js';
15
+ import { getClientId, setClientIdCache, getServerUrl, getClientSecret, getShouldRejectUnauthorized } from './config.js';
16
16
  import { registerStreamingHandlers } from './streaming/handlers.js';
17
17
  import { initStreamingResponse } from './streaming/initStreamingResponse.js';
18
18
  import { startStaleStreamCleanup, cleanupAllStreams } from './streaming/cleanup.js';
@@ -246,6 +246,7 @@ const socket = io(SERVER_URL, {
246
246
  reconnectionDelay: 1000,
247
247
  reconnectionDelayMax: 30000,
248
248
  randomizationFactor: 0.5,
249
+ rejectUnauthorized: getShouldRejectUnauthorized(),
249
250
  tryAllTransports: true, // if we don't, it won't try to fallback from websocket to polling
250
251
  autoConnect: false, // Don't connect until after registration
251
252
  withCredentials: true, // make sure cookies work for sticky sessions
package/app/config.js CHANGED
@@ -63,3 +63,12 @@ export function setClientIdCache(clientId) {
63
63
  }
64
64
  }
65
65
 
66
+ /**
67
+ * gets the value of the NODE_TLS_REJECT_UNAUTHORIZED env var to disable rejected requests from self-signed certificates
68
+ * used to pass to the socket.io client
69
+ */
70
+ export function getShouldRejectUnauthorized() {
71
+ const envVarValue = process.env.NODE_TLS_REJECT_UNAUTHORIZED;
72
+ if (envVarValue === "0") return false;
73
+ return true;
74
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikidosec/broker-client",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "Aikido Broker Client - Runs in customer network to forward requests to internal resources",
5
5
  "main": "app/client.js",
6
6
  "type": "module",