亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

怎么修復反射型xss漏洞

九三
656
2021-02-07 18:51:44
欄目: 網絡安全

怎么修復反射型xss漏洞

通過在項目中自定義一個Filter過濾器實現修復反射型xss漏洞,具體方法如下:

package com.eastrobot.robotdev.filter;

import javax.servlet.*;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import java.io.IOException;

public class XssFilter implements Filter {

@Override

public void init(FilterConfig filterConfig) throws ServletException {

}

@Override

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {

HttpServletRequest req = (HttpServletRequest) request;

HttpServletResponse resp = (HttpServletResponse) response;

// 解決動態腳本獲取網頁cookie,將cookie設置成HttpOnly

String sessionId = req.getSession().getId();

resp.setHeader("SET-COOKIE", "JSESSIONID=" + sessionId + "; HttpOnly");

resp.setHeader("x-frame-options", "SAMEORIGIN");

chain.doFilter(new XssHttpServletRequestWrapper((HttpServletRequest) request), response);

}

@Override

public void destroy() {

}

}

0
静宁县| 乌审旗| 庄河市| 灵川县| 临武县| 建平县| 灌南县| 黄陵县| 黔江区| 全椒县| 眉山市| 繁昌县| 深圳市| 堆龙德庆县| 龙江县| 当涂县| 全南县| 防城港市| 兴城市| 乌兰察布市| 元阳县| 长阳| 盐津县| 柯坪县| 玉树县| 楚雄市| 夹江县| 鲁山县| 安图县| 吉木乃县| 拉孜县| 西峡县| 凌海市| 中江县| 普陀区| 丁青县| 襄汾县| 苍溪县| 邯郸市| 朝阳县| 林口县|