xss

Sanitizers VS dangerouslySetInnerHtml

余生长醉 提交于 2021-01-29 20:50:48
问题 According to some React documentation: Improper use of the innerHTML can open you up to a cross-site scripting (XSS) attack. Sanitizing user input for display is notoriously error-prone, and failure to properly sanitize is one of the leading causes of web vulnerabilities on the internet. It seems that improper usage of the sanitizers and the innerHTML can expose the site XSS (Cross-Site Scripting) attacks. On the other hand, according to other documentation (such as Gatsby or sanitizers

Do PHP form submissions cause the whole file to refresh?

笑着哭i 提交于 2021-01-29 05:38:34
问题 Will using <form action = "<?php echo $_SERVER['PHP_SELF']; ?>" method = "post"> cause the whole page to refresh when the user clicks submit? Or just the PHP part? 回答1: The page usually will reload after submitting a form to display the response that is received after submitting the form. To prevent that you got two ways: Use target=_blank in your form tag <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" target="_blank"> Use event.preventDefault(); to prevent the default

React and storing jwt token in localstorage

孤人 提交于 2021-01-28 13:34:57
问题 I just recently started using jwt in a react+express app and came across the issue of where to store the jwt token. It seems like the two major options are localStorage and cookies with both being venerable to various attacks (XSS and CRSF). But i found that react is supposedly XSS safe (What does it mean when they say React is XSS protected?) so is it okay to use localStorage to store the jwt? If not whats the industry standard for this? 回答1: Both cookies and localStorage can be acceptable

React and storing jwt token in localstorage

送分小仙女□ 提交于 2021-01-28 13:33:31
问题 I just recently started using jwt in a react+express app and came across the issue of where to store the jwt token. It seems like the two major options are localStorage and cookies with both being venerable to various attacks (XSS and CRSF). But i found that react is supposedly XSS safe (What does it mean when they say React is XSS protected?) so is it okay to use localStorage to store the jwt? If not whats the industry standard for this? 回答1: Both cookies and localStorage can be acceptable

React and storing jwt token in localstorage

十年热恋 提交于 2021-01-28 13:32:11
问题 I just recently started using jwt in a react+express app and came across the issue of where to store the jwt token. It seems like the two major options are localStorage and cookies with both being venerable to various attacks (XSS and CRSF). But i found that react is supposedly XSS safe (What does it mean when they say React is XSS protected?) so is it okay to use localStorage to store the jwt? If not whats the industry standard for this? 回答1: Both cookies and localStorage can be acceptable

Why is setInterval not safe from XSS?

烈酒焚心 提交于 2021-01-27 19:04:07
问题 I'm going through OWASP Cross Site Scripting Prevent Cheat Sheet. In rule #3 it says: Please note there are some JavaScript functions that can never safely use untrusted data as input - EVEN IF JAVASCRIPT ESCAPED! <script> window.setInterval('...EVEN IF YOU ESCAPE UNTRUSTED DATA YOU ARE XSSED HERE...'); </script> To clarify: I know that using setInterval et al. is safe with your own content. I know that one must validate, escape and/or sanitise external content. My understanding is that rule

XSS Vulnerability in PHP scripts

巧了我就是萌 提交于 2021-01-27 14:32:32
问题 I have been searching everywhere to try and find a solution to this. I have recently been running scans on our websites to find any vulnerabilities to XSS and SQL Injection. Some items have been brought to my attention. Any data which is user inputted is now validated and sanitized using filter_var(). My issue now is with XSS and persons manipulating the URL. The simple one which seems to be everywhere is: http://www.domainname.com/script.php/">< script>alert('xss');< /script > This then

java处理XSS过滤的方法

一曲冷凌霜 提交于 2021-01-13 07:18:25
如果系统中,没有富文本编辑器的功能,那么对于XSS过滤可以采用如下方式过滤 如果采用了struts2,那么需要重写StrutsRequestWrapper 如果没有采用struts2,那么直接重写HttpServletRequestWraper 在自定义的HttpServletRequestWraper中需要重写getParameterMap()方法才行,如下: @Override public Map<String, String[]> getParameterMap() { Map<String, String[]> paramMap = super.getParameterMap(); Set<String> keySet = paramMap.keySet(); for (Iterator iterator = keySet.iterator(); iterator.hasNext();) { String key = (String) iterator.next(); String[] str = paramMap.get(key); // for(int i=0; i<str.length; i++) { // str[i] = str[i]+"1"; //这里可以对页面传入的所有值进行过滤了,你想怎么处理就怎么处理。比如对出入的值进行html危险字符过滤 } }