如果某些属性包含这些值,如何在 Spring Boot 中清理请求正文

问题描述 投票:0回答:1

如果作为值存在,是否有任何库可以对它们进行编码,例如。可以是 html 属性、js 事件、脚本、评估为 true 的表达式吗?尽管它应该转义与数值一起使用的“">50000”或“<232" i.e any "”等值。或者如何根据白名单等对这些进行编码?

<script>alert(1709881302027)</scipt>;
<script /**/>/**/alert(1709881242160)/**/</script /**/
<IMG onmouseover="alert('xxs')">
&gt;&lt;script&gt;alert(1709881242161)&lt;/script&gt;
%3Cscript%3Ealert%281%29%3C%2Fscript%3E1709881242161
javascript:alert(1709881302029)
1 OR 1=1 ; -- OR 1 OR 1=1 ;
' OR '1'='1
1 OR 1=1;

对于 owasp 库,它还对所有存在的 <,' etc even if they are not html attributes or js events.

进行编码
java spring-boot xss encode sanitization
1个回答
0
投票

我假设您指的是 XSS 问题?

但是没有任何 XSS 防御是完美的。也许你可以尝试:

OWASP Java HTML Sanitizer
© www.soinside.com 2019 - 2024. All rights reserved.