enh: add disableClientMask option for WebSocket payload masking and optimize mask calculation#985
enh: add disableClientMask option for WebSocket payload masking and optimize mask calculation#985huskar-t wants to merge 1 commit intogorilla:mainfrom
Conversation
Masking prevents a client application from sending a specific stream of bytes to a server. TLS does not eliminate the need for this feature. See Attacks On Infrastructure for more information. |
I believe TLS can prevent data interception and tampering, making the protocol's built-in masking mechanism redundant under TLS protection. |
|
The purpose of masking is to prevent a client application running in a browser from controlling the sequence of bytes sent to a server. Masking is useless for preventing data interception or tampering. If the feature is added, the feature should be enabled with a Dialer field. There are two reasons for this:
To keep the connection method as in the current PR, OP should give a use case for turning the flag on and off. Also, OP should given a justification for not adding the setting with other client specific settings in Dialer. |
I didn't modify the protocol itself, but mathematically bypassed the masking computation. This serves as a performance optimization in specific scenarios, with precise control through parameters. |
| // by generating zero-value mask keys ([4]byte{0,0,0,0}), effectively omitting XOR operations | ||
| // while maintaining formal protocol compliance. | ||
| // | ||
| // Security Advisory: |
What type of PR is this? (check all applicable)
Description
Optimized WebSocket masking by:
Related Tickets & Documents
Added/updated tests?
have not been included
Run verifications and test
make verifyis passingmake testis passing