github / github/codeql

LGTM.com - false positive in path sanitization code

未关闭
#7,277 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
false-positive Java
主要语言
CodeQL
星标
10.1k
派生
2.1k
平均合并
2 天 15 小时
30 天内合并 PR
141

描述

In order to provide path sanitization for some of API controllers used in OpenGrok (reported by both Sonar and LGTM), a change was made to verify the path supplied in the request does not point to outside the expected directory tree:
https://github.com/oracle/opengrok/commit/5082f8ec5e11b8259d833bfd5e6749eb0030ddad#diff-4357c5e759897ec6f09fb7ef09c661bf2719fda58ed0155d2737380a5fd5aee4

Even though this was changed according to the recommendations on https://snyk.io/research/zip-slip-vulnerability , LGTM still reports this as *Uncontrolled data used in path expression* problem in the method that actually performs the sanitization.

The LGTM URL for this alert is https://lgtm.com/projects/g/oracle/opengrok/snapshot/ed926a38faaf0796db709bf2ad62f8c4204690c1/files/opengrok-web/src/main/java/org/opengrok/web/util/FileUtil.java?sort=name&dir=ASC&mode=heatmap#x96d75c2f94454f17:1

I believe this is false positive, however if someone believes this can be done in better way, I am open to suggestions.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。