Can malicious javascript code be injected through $()?

后端 未结 4 1058
青春惊慌失措
青春惊慌失措 2020-12-16 14:53

Example:

if($(\'#\' + untrusted_js_code).length) > 0
  ....`

Normally \"untrusted_js_code\" should be a simple string representing the I

4条回答
  •  一向
    一向 (楼主)
    2020-12-16 15:27

    With that statement, you're asking jQuery to perform a query based on a selector. Being the string a selector, it can't do any harm.

提交回复
热议问题