Skip to content

Python: Fix hasFlowPath default implementation of isSink/2#2100

Merged
taus-semmle merged 2 commits intogithub:masterfrom
RasmusWL:python-fix-hasFlowPath
Oct 18, 2019
Merged

Python: Fix hasFlowPath default implementation of isSink/2#2100
taus-semmle merged 2 commits intogithub:masterfrom
RasmusWL:python-fix-hasFlowPath

Conversation

@RasmusWL
Copy link
Member

@RasmusWL RasmusWL commented Oct 8, 2019

If hasFlowPath was used, and isSink/2 was not overridden,
hasFlowPath(src, sink) would not use isSink/1 to restrict the allowed TaintSink.
This resulted in false-positives when we had flows with unrelated TaintSinks.

FP: https://lgtm.com/projects/g/graphite-project/graphite-web/snapshot/1a8e7ffc2eab2210a73f30b03e9cdeb520a02057/files/webapp/graphite/dashboard/views.py#x2d486922081db956:1

Fixes #2081


@taus-semmle I put this as a draft pull request, since I am not 100% sure what the consequences of changing such a fundamental predicate will be. It does resolve the problems in the graphite snapshot, but other than that I have not run tests locally yet

@RasmusWL
Copy link
Member Author

@taus-semmle I added a testcase to make it more clear what was going on, and to ensure we don't introduce this regression again. For clarity I added it as a separate commit now, but lets squash the commits together before we merge into master 😉

If hasFlowPath was used, and isSink/2 was not overridden,
hasFlowPath(src, sink) would not use isSink/1 to restrict the allowed TaintSink.
This resulted in false-positives when we had flows with unrelated TaintSinks.

FP: https://lgtm.com/projects/g/graphite-project/graphite-web/snapshot/1a8e7ffc2eab2210a73f30b03e9cdeb520a02057/files/webapp/graphite/dashboard/views.py#x2d486922081db956:1

Fixes github#2081
@RasmusWL RasmusWL force-pushed the python-fix-hasFlowPath branch from c8c9008 to bf197b9 Compare October 10, 2019 13:35
@RasmusWL
Copy link
Member Author

rebased onto newest master

@taus-semmle taus-semmle marked this pull request as ready for review October 14, 2019 09:21
Copy link
Contributor

@taus-semmle taus-semmle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. As far as I can tell, it was an oversight that this was not included in the first place (cf. the definition of isSource).

@taus-semmle taus-semmle merged commit 37291c5 into github:master Oct 18, 2019
@RasmusWL RasmusWL deleted the python-fix-hasFlowPath branch October 18, 2019 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LGTM.com - false positive Python Django

2 participants