开发者

how can i implement cross reference attacks with using jquery?

开发者 https://www.devze.com 2023-04-10 05:12 出处:网络
i am using jQuery in my asp.net mvc site. How开发者_如何学JAVA can i make sure the use is secure in the sense of protecting against cross site scripting / sql injection attacks?jQuery doesn\'t play mu

i am using jQuery in my asp.net mvc site. How开发者_如何学JAVA can i make sure the use is secure in the sense of protecting against cross site scripting / sql injection attacks?


jQuery doesn't play much role in protecting against those kind of attacks. It's the server side code. For example to protect against SQL injection attacks make sure to always use parametrized queries when querying your database. To protect against XSS make sure you always HTML encode any value that you are outputting in a view.

As far as jQuery is concerned, when sending AJAX requests always use the data hash to pass parameters and avoid string concatenations:

$.get('/foo', { id: $('#id').val() });

instead of:

$.get('/foo?id=' + $('#id').val());
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号