【发布时间】:2018-03-16 05:30:16
【问题描述】:
我正在使用 Findbugs 的“Find Security Bugs”插件:https://find-sec-bugs.github.io/
许多检测器使用“污点分析”来发出警告。
是否有关于如何从值中删除“污点”的文档?
我在他们的网站上找不到任何关于此的文档,而且我一直在寻找他们的源代码,但无法弄清楚:
- src/main/java/com/h3xstream/findsecbugs/taintanalysis
- src/main/resources/taint-config
- 另见this wiki page "Injection detection"
该工具正在从以下代码中识别可能的注入错误:
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()”识别为在这里删除Taint。
否则我该如何说服它? 如果不能,我可以在这里使用哪些工具可以识别的消毒技术?
【问题讨论】:
标签: java security findbugs taint find-sec-bugs