Class XssInitBinder.StringPropertiesEditor
java.lang.Object
java.beans.PropertyEditorSupport
tech.riemann.nif.web.xss.escaper.XssInitBinder.StringPropertiesEditor
- All Implemented Interfaces:
PropertyEditor
- Enclosing class:
XssInitBinder
字符串属性编辑器
继承自PropertyEditorSupport,重写setAsText方法实现XSS检测
主要功能: 1. 对null值特殊处理 2. 根据XssHolder的配置决定是否忽略XSS检测 3. 对检测到的 XSS 内容记录日志(可配置拦截),数据原样绑定
- Author:
- Kerbores(kerbores@riemann.tech)
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
StringPropertiesEditor
public StringPropertiesEditor() -
StringPropertiesEditor
public StringPropertiesEditor(boolean blockOnDetection)
-
-
Method Details
-
setAsText
设置文本值,处理XSS检测根据XssHolder的配置决定是否对字符串进行XSS检测
- Specified by:
setAsTextin interfacePropertyEditor- Overrides:
setAsTextin classPropertyEditorSupport- Parameters:
text- 要设置的文本值- Throws:
IllegalArgumentException- 当参数无效或拦截模式下检测到 XSS 时抛出
-