github / codeql

CodeQL: the libraries and queries that power security researchers around the world, as well as code scanning in GitHub Advanced Security
https://codeql.github.com
MIT License
7.51k stars 1.49k forks source link

LGTM.com - false positive (python) #4755

Open petercorke opened 3 years ago

petercorke commented 3 years ago

Description of the false positive

https://lgtm.com/projects/g/petercorke/spatialmath-python/snapshot/406209fe003b474951a109d907069933f48f82b7/files/spatialmath/base/__init__.py?sort=name&dir=ASC&mode=heatmap#xd0af4bbbf721847c:1

One function, getvector(), is singled out as being undefined. It is imported in line 5, and then in line 18 it is exported again. The function is defined at line 213 of

https://lgtm.com/projects/g/petercorke/spatialmath-python/snapshot/406209fe003b474951a109d907069933f48f82b7/files/spatialmath/base/argcheck.py#L213

and I can vouch that this works in production use.

I have no idea why just this function is flagged. However, it is the only function that has a NumPy constant as a default value for one of its function parameters

def getvector(v, dim=None, out='array', dtype=np.float64):
RasmusWL commented 3 years ago

Indeed, this looks like a false positive. Thank you for reporting it!

Our current focus is on improving our security analysis. Because your report does not relate to a security query, we will put this on our backlog and prioritize it if we get enough reports of the same underlying issue in other projects. If you think that your report is related to our security analysis, please clarify that in a comment. Either way, we'll let you know here as soon as it's fixed!

As you might know, all of our queries are open source. If you do have an idea for a code change, we encourage you to open a pull request. GitHub Code Scanning and lgtm.com have facilities for suppressing individual alerts or disabling a query.