How to Check Authenticity of an AJAX Request

后端 未结 15 880
悲&欢浪女
悲&欢浪女 2021-01-31 08:47

I am designing a web site in which users solve puzzles as quickly as they can. JavaScript is used to time each puzzle, and the number of milliseconds is sent to the server via A

15条回答
  •  温柔的废话
    2021-01-31 09:26

    You can't guarantee the security of the timings cryptographically, because the client's browser can't do secure computation. Any means for encrypting to/from the server could be bypassed by adjusting the actual timings.

    And timing on the server doesn't work, either - if you don't take account of latency in the round-trip-time, users with lower latency connections will have an advantage; if you do, users could thwart the compensation phase by adding extra latency there and then removing it later.

    You can, of course make it difficult for the users to modify this, but security by obscurity is an unsustainable policy anyway.

    So it comes down to either trusting your users somewhat (a reasonable assumption, most of the time) and designing the game so it's not trivial to circumvent the timings.

提交回复
热议问题