blurite/rsprot

Packet Validation

Opened this issue · 0 comments

We need to add packet validation to RSProt to ensure that servers cannot cause clients to crash by sending corrupt game packets. This validation should support opting out of it.
This validation would include things like:

  • Ensuring packet inputs don't result in the packet size from exceeding the defined packet capacity (for var-byte and var-short packets)
  • Ensuring encoded packet size is equal to the constant size (for constant size packets specifically)
  • Ensuring any interface packets will not result in a crash due to a missing component in the cache. We can cross-reference this against the JS5-provided master index file, or alternative, allowing servers to define their own validator.

The end goal of this is to throw errors early on-spot, as this makes it easier for developers to figure out the problematic spots in their codebase. If the error is left up to the client, or the packet encoder, the stacktrace is lost as far as "where did this actually stem from" goes, which makes figuring these cases out harder.