如何删除查找错误"Find Security Bugs"的"taint"



我正在使用findbugs的"查找安全错误"插件:https://find-sec-bugs.github.io/

许多检测器使用"污点分析"来提高警告。

是否有有关如何从值中删除"污点"的文档?

我在他们的网站上找不到有关此文档的任何文档,我一直在围绕他们的源代码戳戳,但无法弄清楚:

  • src/main/java/com/h3xstream/findsecbugs/taintanalysis
  • src/main/resources/taint-config
  • 另请参见此Wiki页面"注入检测"

该工具正在从代码中识别可能的注入错误:

import javax.ws.rs.core.Response;
import org.apache.http.client.methods.HttpGet;
public Response get(String x, String y) throws IOException {
    String url = String.format("%s/%s",
            x,
            y);
    HttpGet request = new HttpGet(url); // HERE
    ...
}

我已将此错误修复以满足:

import javax.ws.rs.core.Response;
import org.apache.http.client.methods.HttpGet;
import static com.google.common.net.UrlEscapers.urlPathSegmentEscaper;
public Response get(String x, String y) throws IOException {
    String url = String.format("%s/%s",
            urlPathSegmentEscaper().escape(x),
            urlPathSegmentEscaper().escape(y));
    HttpGet request = new HttpGet(url);
    ...
}

...但是该工具仍在标记可能的错误。我相信这是因为它不识别" com.google.common.net.UrlEscapers.urlPathSegmentEscaper()"是在此处删除污点。

我该如何说服它?如果不能,我可以在这里使用哪些固定技术来识别?

在问题跟踪器上给出答案:https://github.com/find-sec-bugs/find-sec-bugs/issues/346#issuecomment-334286419<>

相关内容

最新更新