Socket
Socket
Sign inDemoInstall

socket.io-parser

Package Overview
Dependencies
4
Maintainers
2
Versions
53
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.4.2 to 3.4.3

25

index.js

@@ -332,7 +332,6 @@

var payload = tryParse(str.substr(i));
var isPayloadValid = payload !== false && (p.type === exports.ERROR || isArray(payload));
if (isPayloadValid) {
if (isPayloadValid(p.type, payload)) {
p.data = payload;
} else {
return error('invalid payload');
throw new Error("invalid payload");
}

@@ -353,2 +352,22 @@ }

function isPayloadValid(type, payload) {
switch (type) {
case 0: // CONNECT
return typeof payload === "object";
case 1: // DISCONNECT
return payload === undefined;
case 4: // ERROR
return typeof payload === "string" || typeof payload === "object";
case 2: // EVENT
case 5: // BINARY_EVENT
return (
isArray(payload) &&
(typeof payload[0] === "string" || typeof payload[0] === "number")
);
case 3: // ACK
case 6: // BINARY_ACK
return isArray(payload);
}
}
/**

@@ -355,0 +374,0 @@ * Deallocates a parser's resources

2

package.json
{
"name": "socket.io-parser",
"version": "3.4.2",
"version": "3.4.3",
"description": "socket.io protocol parser",

@@ -5,0 +5,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc