When implementing a websocket server I came across the need to for clients to mask data. I was googling why this was specified as no reason is given in the RFC and came across this answer (and others with the same reasoning): about websocket's mask field
It made sense at first so I just implemented it, but since theres hardly anything I hate more than forced "security" it still kinda gnawed on me and I ended up with two assumptions and I was wondering if those are true:
- Since its only mandatory for the client, this assumes that malfunctioning proxies or intermediate components only care about the client request? Or that there are no malicious servers?
- Its not actually to prevent malicious actors from causing remote code execution, it is to prevent a good client from accidentally becoming a bad actor by causing code execution without intention. If I am a bad actor I am just going to send unmasked data or set the flag, that the payload is masked but dont mask it.
Is there anything I am missing that would render these assumptions wrong?