File tree Expand file tree Collapse file tree 2 files changed +5
-14
lines changed
lib/semmle/code/java/security
test/query-tests/security/CWE-470 Expand file tree Collapse file tree 2 files changed +5
-14
lines changed Original file line number Diff line number Diff line change @@ -22,13 +22,8 @@ class IsValidFragmentMethod extends Method {
22
22
*/
23
23
predicate isUnsafe ( ) {
24
24
this .getDeclaringType ( ) .( AndroidActivity ) .isExported ( ) and
25
- forex ( ReturnStmt retStmt , BooleanLiteral bool |
26
- retStmt .getEnclosingCallable ( ) = this and
27
- // Using taint tracking to handle logical expressions, like
28
- // fragmentName.equals("safe") || true
29
- TaintTracking:: localExprTaint ( bool , retStmt .getResult ( ) )
30
- |
31
- bool .getBooleanValue ( ) = true
25
+ forex ( ReturnStmt retStmt | retStmt .getEnclosingCallable ( ) = this |
26
+ retStmt .getResult ( ) .( BooleanLiteral ) .getBooleanValue ( ) = true
32
27
)
33
28
}
34
29
}
@@ -39,15 +34,11 @@ class IsValidFragmentMethod extends Method {
39
34
*/
40
35
abstract class FragmentInjectionSink extends DataFlow:: Node { }
41
36
42
- /**
43
- * A unit class for adding additional taint steps.
44
- *
45
- * Extend this class to add additional taint steps that should apply to `FragmentInjectionTaintConf`.
46
- */
37
+ /** An additional taint step for flows related to Fragment injection vulnerabilites. */
47
38
class FragmentInjectionAdditionalTaintStep extends Unit {
48
39
/**
49
40
* Holds if the step from `node1` to `node2` should be considered a taint
50
- * step for the `FragmentInjectionTaintConf` configuration .
41
+ * step in flows related to Fragment injection vulnerabilites .
51
42
*/
52
43
abstract predicate step ( DataFlow:: Node n1 , DataFlow:: Node n2 ) ;
53
44
}
Original file line number Diff line number Diff line change @@ -6,6 +6,6 @@ public class UnsafePreferenceActivity extends PreferenceActivity {
6
6
7
7
@ Override
8
8
protected boolean isValidFragment (String fragmentName ) { // $ hasPreferenceFragmentInjection
9
- return fragmentName . equals ( "MySafeClass" ) || true ;
9
+ return true ;
10
10
}
11
11
}
You can’t perform that action at this time.
0 commit comments