DoctorMcKay / node-steam-user

Allows interaction with the Steam network via the Steam client protocol
https://dev.doctormckay.com/forum/7-node-steam-user/
MIT License
888 stars 157 forks source link

Encoding ClientLogon protobuf not working in electron environment. #494

Open shuabritze opened 1 month ago

shuabritze commented 1 month ago

Describe the bug

When running in a production electron environment, the encoding of ClientLogon is failing when trying to send the login result.

The byte array being sent

[
    138, 21, 0, 128, 29, 0, 0, 0, 9, 0, 0, 0,
    0, 0, 0, 160, 1, 16, 0, 81, 0, 0, 0, 0,
    0, 0, 0, 0, 89, 0, 0, 0, 0, 0, 0, 0,
    0, 8, 172, 128, 4, 24, 31, 50, 0, 56, 16, 64,
    0, 90, 5, 13, 194, 1, 0, 0, 136, 2, 2, 130,
    5, 9, 97, 110, 111, 110, 121, 109, 111, 117, 115, 130,
    6, 0, 176, 6, 0
];

However the correct array is supposed to be:

[
    138, 21, 0, 128, 29, 0, 0, 0, 9, 0, 0, 0,
    0, 0, 0, 160, 1, 16, 0, 81, 255, 255, 255, 255,
    255, 255, 255, 255, 89, 255, 255, 255, 255, 255, 255, 255,
    255, 8, 172, 128, 4, 24, 31, 50, 0, 56, 16, 64,
    0, 90, 5, 13, 194, 1, 0, 0, 136, 2, 2, 130,
    5, 9, 97, 110, 111, 110, 121, 109, 111, 117, 115, 130,
    6, 0, 176, 6, 0
];

I assume since it is encoding "18446744073709551615", it is hitting an overflow, however I don't know the specific node implementation that would cause this.

Versions

steam-user: 5.2.0 electron: 32.1.2 node: v20.11.1 / v20.16

Screenshots and Error Logs

Source code: https://github.com/shuabritze/mushroom-launcher https://github.com/shuabritze/mushroom-launcher/blob/54b02eead4d91eec1fa47bafc1d28a8b7f251977/src/download-client.ts#L45

[2024-09-24 01:03:15.916] [info]  API GET request to https://api.steampowered.com/ISteamDirectory/GetCMListForConnect/v0001/?format=vdf&cellid=31: 200
[2024-09-24 01:03:15.918] [info]  [W1] Connecting to WebSocket CM --------------------------
[2024-09-24 01:03:16.039] [info]  [W1] WebSocket connection success; now logging in
[2024-09-24 01:03:16.042] [info]  Sending message: ClientLogon
[2024-09-24 01:03:16.044] [info]  {
  type: 'Buffer',
  data: [
    138, 21,   0, 128,  29,   0,   0,   0,   9,   0,   0,   0,
      0,  0,   0, 160,   1,  16,   0,  81,   0,   0,   0,   0,
      0,  0,   0,   0,  89,   0,   0,   0,   0,   0,   0,   0,
      0,  8, 172, 128,   4,  24,  31,  50,   0,  56,  16,  64,
      0, 90,   5,  13, 194,   1,   0,   0, 136,   2,   2, 130,
      5,  9,  97, 110, 111, 110, 121, 109, 111, 117, 115, 130,
      6,  0, 176,   6,   0
  ]
}
[2024-09-24 01:03:16.044] [info]  [ 5514 ]
[2024-09-24 01:03:16.045] [info]  Header proto
[2024-09-24 01:03:16.045] [info]  [
  {
    client_sessionid: 0,
    steamid: '117093590311632896',
    jobid_source: '18446744073709551615',
    jobid_target: '18446744073709551615'
  }
]
[2024-09-24 01:03:16.046] [info]  [W1] Queueing frame 2, FIN, MASK, payload 77 bytes
[2024-09-24 01:03:21.047] [info]  Logon message timeout elapsed. Attempting relog.