GeezerVison is showing github.com — Apply suggestions from code review · github/codeql@fd92c4e
File tree
Expand file treeCollapse file tree
Open diff view settings
lib/semmle/code/java/security
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: java/ql/lib/semmle/code/java/security/AndroidIntentRedirection.qll +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -71,11 +71,12 @@ private class DefaultIntentRedirectionSink extends IntentRedirectionSink { |
71 | 71 | */ |
72 | 72 | private class DefaultIntentRedirectionSanitizer extends IntentRedirectionSanitizer { |
73 | 73 | DefaultIntentRedirectionSanitizer() { |
74 | | - exists(MethodAccess ma, Method m | |
| 74 | + exists(MethodAccess ma, Method m, Guard g, boolean branch | |
75 | 75 | ma.getMethod() = m and |
76 | 76 | m.getDeclaringType() instanceof TypeComponentName and |
77 | 77 | m.hasName(["getPackageName", "getClassName"]) and |
78 | | - ma.getBasicBlock().(ConditionBlock).controls(this.asExpr().getBasicBlock(), true) |
| 78 | + g.isEquality(ma, _, branch) and |
| 79 | + g.controls(this.asExpr().getBasicBlock(), branch) |
79 | 80 | ) |
80 | 81 | } |
81 | 82 | } |
Collapse file
Copy file name to clipboardExpand all lines: java/ql/src/Security/CWE/CWE-940/AndroidIntentRedirectionSample.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
|
13 | 13 | // GOOD: The component that sent the Intent is checked before launching the destination component |
14 | 14 | Intent forwardIntent = (Intent) getIntent().getParcelableExtra("forward_intent"); |
15 | 15 | ComponentName originComponent = getCallingActivity(); |
16 | | -if (originComponent.getPackageName().equals("trusted.package") && originComponent.getClassName("TrustedClass")) { |
| 16 | +if (originComponent.getPackageName().equals("trusted.package") && originComponent.getClassName().equals("TrustedClass")) { |
17 | 17 | startActivity(forwardIntent); |
18 | 18 | } |