@nestjs/platform-ws 12.1.0 → 12.1.2

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.
@@ -96,7 +96,19 @@ export class WsAdapter extends AbstractWsAdapter {
96
96
  if (client.readyState !== READY_STATE.OPEN_STATE) {
97
97
  return;
98
98
  }
99
- client.send(JSON.stringify(response));
99
+ // JSON.stringify throws on circular structures and BigInts, and on
100
+ // client-controlled payloads nested deep enough to overflow its native
101
+ // recursion (JSON.parse accepts any depth). A throw here escapes the
102
+ // subscriber, which RxJS rethrows asynchronously, killing the process.
103
+ let payload;
104
+ try {
105
+ payload = JSON.stringify(response);
106
+ }
107
+ catch (err) {
108
+ this.logger.error(err);
109
+ return;
110
+ }
111
+ client.send(payload);
100
112
  };
101
113
  source$.subscribe(onMessage);
102
114
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/platform-ws",
3
- "version": "12.1.0",
3
+ "version": "12.1.2",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@platform-ws)",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "license": "MIT",
@@ -26,12 +26,12 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "tslib": "2.8.1",
29
- "ws": "8.21.3"
29
+ "ws": "8.22.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "@nestjs/common": "^12.0.0",
33
33
  "@nestjs/websockets": "^12.0.0",
34
34
  "rxjs": "^7.1.0"
35
35
  },
36
- "gitHead": "6739656fa3e8c98bd55883f0363a2254e6412232"
36
+ "gitHead": "8ab60aa1b2927fbe0e23135ffc65d610c623236a"
37
37
  }