91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

怎么修復反射型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
太康县| 青神县| 北流市| 法库县| 满洲里市| 兰考县| 古交市| 洱源县| 凤阳县| 陆河县| 贡觉县| 台南县| 肥西县| 威远县| 张家口市| 横峰县| 曲靖市| 杂多县| 桑日县| 甘肃省| 河北省| 介休市| 花莲县| 自贡市| 灵山县| 梁山县| 定兴县| 迭部县| 马龙县| 新蔡县| 恭城| 梓潼县| 桦川县| 门源| 长春市| 耿马| 虞城县| 定结县| 朝阳县| 陕西省| 延庆县|