Securing a javascript client with hmac

后端 未结 3 1155
借酒劲吻你
借酒劲吻你 2021-01-04 23:08

I am researching ways to secure a javascript application I am working on. The application is a chat client which uses APE (Ajax Push Engine) as the backend.

Currentl

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-05 00:03

    The answer: You technically cannot prevent the user from modifying the JavaScript. So don't worry about that because you can do nothing about it.

    However, the attack you do need to prevent is Cross-Site Request Forgery (CSRF). Malicious scripts on different domains are capable of automatically submitting forms to your domain with the cookies stored by the browser. To deal with that, you need to include an authentication token (which should be sufficiently random, not related to the username or password, and sent in the HTML page in which the chat client resides) in the actual data sent by the AJAX request (which is not automatically filled in by the browser).

提交回复
热议问题