Skip to content

Commit

Permalink
Life-cycle test: Add clarifying comments
Browse files Browse the repository at this point in the history
Summary:
Just documenting a false negative pattern in our life-cycle due to a limitation of which methods the life-cycle wrapper can call to.

The hope is that with class intervals, life-cycle wrappers can call these methods without worrying about false positives due to flows from unrelated classes.

Reviewed By: anwesht

Differential Revision: D47726809

fbshipit-source-id: 8cf5ca84840743db04e14489e0415743fc8869bd
  • Loading branch information
Yuh Shin Ong authored and facebook-github-bot committed Aug 1, 2023
1 parent 6ea538c commit a7d262d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ protected void onAfterActivityCreate() {

@Override
protected void onStart() {
// False negative:
// mTainted2 is tainted in onAfterActivityCreate() called from onCreate()
// but because this class does not override onCreate(), the call to
// onCreate() does not make it into the life-cycle wrapper and the analysis
// misses the flow.
// Suggested fix: Call base class methods when override does not exist.
// Needs class intervals to avoid false positives because the base class
// could have tainted fields from other derived classes unrelated to this
// one.
super.onStart();
Origin.sink(mTainted2);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,7 @@
"method" : "Lcom/facebook/marianatrench/integrationtests/ChildFragment;.onStart:()V",
"position" :
{
"line" : 26,
"line" : 35,
"path" : "ChildFragment.java"
},
"sinks" :
Expand All @@ -1336,7 +1336,7 @@
"method" : "Lcom/facebook/marianatrench/integrationtests/Origin;.sink:(Ljava/lang/Object;)V",
"position" :
{
"line" : 28,
"line" : 37,
"path" : "ChildFragment.java"
}
}
Expand Down

0 comments on commit a7d262d

Please sign in to comment.