Skip to content

Commit 54c1480

Browse files
committed
Replace explicit extra step with TaintPreservingCallable
1 parent 60e8910 commit 54c1480

File tree

2 files changed

+9
-29
lines changed

2 files changed

+9
-29
lines changed

java/ql/src/semmle/code/java/dataflow/FlowSteps.qll

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -140,32 +140,3 @@ private class StringBuilderTaintPreservingCallable extends TaintPreservingCallab
140140
sink = -1
141141
}
142142
}
143-
144-
/** Method access to external inputs of `android.os.BaseBundle` object. */
145-
class GetBundleExtraMethodAccess extends MethodAccess {
146-
GetBundleExtraMethodAccess() {
147-
this.getMethod().getName().regexpMatch("get\\w+") and
148-
this
149-
.getMethod()
150-
.getDeclaringType()
151-
.getASupertype*()
152-
.hasQualifiedName("android.os", "BaseBundle")
153-
}
154-
}
155-
156-
/**
157-
* Holds if `n1` to `n2` is a dataflow step between the extra getter method and its caller `Bundle`.
158-
*/
159-
private predicate bundleExtraStep(DataFlow::ExprNode n1, DataFlow::ExprNode n2) {
160-
exists(GetBundleExtraMethodAccess ma |
161-
n1.asExpr() = ma.getQualifier() and
162-
n2.asExpr() = ma
163-
)
164-
}
165-
166-
/** Additional taint step to consider when taint tracking Android intent extra related data flows. */
167-
class AndroidExtraSourceAdditionalTaintStep extends AdditionalTaintStep {
168-
override predicate step(DataFlow::Node node1, DataFlow::Node node2) {
169-
bundleExtraStep(node1, node2)
170-
}
171-
}

java/ql/src/semmle/code/java/frameworks/android/Intent.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,12 @@ class IntentGetExtraMethod extends Method, TaintPreservingCallable {
4242

4343
override predicate returnsTaintFrom(int arg) { arg = -1 }
4444
}
45+
46+
class BundleGetterMethods extends Method, TaintPreservingCallable {
47+
BundleGetterMethods() {
48+
getDeclaringType().hasQualifiedName("android.os", ["BaseBundle", "Bundle"]) and
49+
getName().matches("get%")
50+
}
51+
52+
override predicate returnsTaintFrom(int arg) { arg = -1 }
53+
}

0 commit comments

Comments
 (0)