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 {
2222 */
2323 predicate isUnsafe ( ) {
2424 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
3227 )
3328 }
3429}
@@ -39,15 +34,11 @@ class IsValidFragmentMethod extends Method {
3934 */
4035abstract class FragmentInjectionSink extends DataFlow:: Node { }
4136
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. */
4738class FragmentInjectionAdditionalTaintStep extends Unit {
4839 /**
4940 * 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 .
5142 */
5243 abstract predicate step ( DataFlow:: Node n1 , DataFlow:: Node n2 ) ;
5344}
Original file line number Diff line number Diff line change @@ -6,6 +6,6 @@ public class UnsafePreferenceActivity extends PreferenceActivity {
66
77 @ Override
88 protected boolean isValidFragment (String fragmentName ) { // $ hasPreferenceFragmentInjection
9- return fragmentName . equals ( "MySafeClass" ) || true ;
9+ return true ;
1010 }
1111}
You can’t perform that action at this time.
0 commit comments