XSS
反射型XSS
package com.example.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class XssController {
@GetMapping("/xss")
public String XssTest(@RequestParam String name) {
return "<h1>Hello, " + name + "!</h1>";
}
}
存储型XSS


dom xss


修复代码
HtmlUtils类

escapeHtml4类
HTML编码
thymeleaf模板过滤
最后更新于