Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disallow modeling attributes as callables
Summary: We currently allow to model attributes as callables, using the `def foo(): ...` syntax in pysa models. This is very confusing and actually leads to non-determinism in the analysis, since attribute models are treated as callable models, but attributes are not part of the call graph and dependency graph. To prevent this, we disallow modeling attributes as callables. We can still use the `foo: TaintSource[Test]` syntax for attributes. Reviewed By: dkgi Differential Revision: D28169809 fbshipit-source-id: f49b82d387e18498f4abf86885c562653fe7361d
- Loading branch information
1 parent
f9bf1c9
commit dae38ce
Showing
9 changed files
with
119 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
source/interprocedural_analyses/taint/test/integration/dataclass_taint.py.pysa
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
def dataclass_taint.WeirdDataClass.__init__(self, bad: TaintSource[UserControlled]): ... | ||
dataclass_taint.WeirdDataClass.bad_sink: TaintSink[Test] = ... | ||
dataclass_taint.DataClassWithSource.tainted: TaintSource[Test] = ... | ||
def dataclass_taint.DataClassWithOtherSource.tainted() -> TaintSource[Test]: ... | ||
dataclass_taint.DataClassWithOtherSource.tainted: TaintSource[Test] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
@property | ||
def rest_framework.request.Request.POST(self) -> TaintSource[UserControlled]: ... | ||
@property | ||
def rest_framework.request.Request.FILES(self) -> TaintSource[UserControlled]: ... | ||
@property | ||
def rest_framework.request.Request.DATA(self) -> TaintSource[UserControlled]: ... | ||
@property | ||
def rest_framework.request.Request.QUERY_PARAMS(self) -> TaintSource[UserControlled]: ... | ||
@property | ||
def rest_framework.request.Request.data(self) -> TaintSource[UserControlled]: ... | ||
@property | ||
def rest_framework.request.Request.query_params(self) -> TaintSource[UserControlled]: ... | ||
@property | ||
def rest_framework.request.Request.content_type(self) -> TaintSource[UserControlled]: ... | ||
@property | ||
def rest_framework.request.Request.stream(self) -> TaintSource[UserControlled]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters