(Rebased) Java android remote source#4542
Conversation
| IntentGetExtraMethodAccess() { | ||
| exists(AndroidComponent ac | | ||
| this.getEnclosingCallable().getDeclaringType() = ac and | ||
| ac.isExported() and |
There was a problem hiding this comment.
Can we push this isExported() filter right into AndroidIntentInput, since that seems like the point where we know whether the source is dangerous or not
There was a problem hiding this comment.
Moved the the isExported() check to AndroidIntentInput.
| private class AndroidIntentExtraSource extends RemoteFlowSource { | ||
| AndroidIntentExtraSource() { | ||
| exists(AndroidIntentInput inode | | ||
| this.asExpr() = inode.asExpr() or | ||
| this.asExpr() = inode.asParameter().getAnAccess() | ||
| ) | ||
| } | ||
|
|
||
| override string getSourceType() { result = "Android intent extra" } | ||
| } |
There was a problem hiding this comment.
Probably not necessary -- once AndroidIntentInput is reduced to only inputs of exported classes, we can simply have that class extend RemoteFlowSource
There was a problem hiding this comment.
Yes, it's not required once AndroidIntentInput is reduced to only inputs of exported classes. Changed AndroidIntentInput to extend RemoteFlowSource.
| this.getMethod().getDeclaringType() instanceof TypeIntent | ||
| ) | ||
| or | ||
| this.getMethod().getName().regexpMatch("get\\w+") and |
There was a problem hiding this comment.
Split these two (get***Extra and the Bundle getters), since they're pretty unrelated
There was a problem hiding this comment.
With the AndroidIntentInput change, only Bundle getters modelled in GetBundleExtraMethodAccess are required as the additional taint step.
| this.getEnclosingCallable().getDeclaringType() = ac and | ||
| ac.isExported() and | ||
| this.getMethod().getName().regexpMatch("get\\w+Extra") and | ||
| this.getMethod().getDeclaringType() instanceof TypeIntent |
There was a problem hiding this comment.
Has conveying taint from the Intent to the Bundle yielded by getExtra gone missing? I'm seeing steps for intent -> getStringExtra and for Bundle -> getString but not for intent -> getExtra -> Bundle -> getString?
There was a problem hiding this comment.
I've tested all flow combinations including intent -> getExtras -> Bundle -> getString and the query seems to work as expected.
Do I still miss something?
|
@luchua-bc Regarding your question on Also note that |
|
Thanks @joefarebrother for reviewing the PR. I'm trying to detect a pattern like the following: The flow is getIntent() -> intent -> getExtras() -> bundle -> getString("url"). I thought we must put new Thanks, |
|
Added |
Just a rebased version of #3812 to make reviewing easier; direct all comments over there.