Skip to content

Commit f680a2e

Browse files
committed
Update test java file to support InlineExpectationsTest
1 parent bfd430b commit f680a2e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

java/ql/test/query-tests/security/CWE-094/APKInstallation.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,46 +11,46 @@ public class APKInstallation extends Activity {
1111
public void installAPK(String path) {
1212
// BAD: the path is not checked
1313
Intent intent = new Intent(Intent.ACTION_VIEW);
14-
intent.setDataAndType(Uri.fromFile(new File(path)), "application/vnd.android.package-archive");
14+
intent.setDataAndType(Uri.fromFile(new File(path)), "application/vnd.android.package-archive"); // $ hasApkInstallation
1515
startActivity(intent);
1616
}
1717

1818
public void installAPK3(String path) {
1919
Intent intent = new Intent(Intent.ACTION_VIEW);
2020
intent.setType(APK_MIMETYPE);
2121
// BAD: the path is not checked
22-
intent.setData(Uri.fromFile(new File(path)));
22+
intent.setData(Uri.fromFile(new File(path))); // $ hasApkInstallation
2323
startActivity(intent);
2424
}
2525

2626
public void installAPKFromExternalStorage(String path) {
2727
// BAD: file is from external storage
2828
File file = new File(Environment.getExternalStorageDirectory(), path);
2929
Intent intent = new Intent(Intent.ACTION_VIEW);
30-
intent.setDataAndType(Uri.fromFile(file), APK_MIMETYPE);
30+
intent.setDataAndType(Uri.fromFile(file), APK_MIMETYPE); // $ hasApkInstallation
3131
startActivity(intent);
3232
}
3333

3434
public void installAPKFromExternalStorageWithActionInstallPackage(String path) {
3535
// BAD: file is from external storage
3636
File file = new File(Environment.getExternalStorageDirectory(), path);
3737
Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
38-
intent.setData(Uri.fromFile(file));
38+
intent.setData(Uri.fromFile(file)); // $ hasApkInstallation
3939
startActivity(intent);
4040
}
4141

4242
public void installAPKInstallPackageLiteral(String path) {
4343
File file = new File(Environment.getExternalStorageDirectory(), path);
4444
Intent intent = new Intent("android.intent.action.INSTALL_PACKAGE");
45-
intent.setData(Uri.fromFile(file));
45+
intent.setData(Uri.fromFile(file)); // $ hasApkInstallation
4646
startActivity(intent);
4747
}
4848

4949
public void otherIntent(File file) {
5050
Intent intent = new Intent(this, OtherActivity.class);
5151
intent.setAction(Intent.ACTION_VIEW);
5252
// BAD: the file is from unknown source
53-
intent.setData(Uri.fromFile(file));
53+
intent.setData(Uri.fromFile(file)); // $ hasApkInstallation
5454
}
5555
}
5656

java/ql/test/query-tests/security/CWE-094/ApkInstallationTest.expected

Whitespace-only changes.

0 commit comments

Comments
 (0)