am 0b1beebd: am 5d8fa869: am 21c4585c: am 17aa7e7f: Assert that /dev/random and urandom are world-readable/writable.
* commit '0b1beebd1e4567c42788cc5defe0c9bac14d52fd':
Assert that /dev/random and urandom are world-readable/writable.
diff --git a/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java b/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
index f5948ff..0a2d56c 100644
--- a/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
@@ -670,6 +670,24 @@
insecure.isEmpty());
}
+ public void testDevRandomWorldReadableAndWritable() throws Exception {
+ FileUtils.FileStatus status = new FileUtils.FileStatus();
+ assertTrue(FileUtils.getFileStatus("/dev/random", status, false));
+ assertTrue(
+ "/dev/random not world-readable/writable. Actual mode: 0"
+ + Integer.toString(status.mode, 8),
+ (status.mode & 0666) == 0666);
+ }
+
+ public void testDevUrandomWorldReadableAndWritable() throws Exception {
+ FileUtils.FileStatus status = new FileUtils.FileStatus();
+ assertTrue(FileUtils.getFileStatus("/dev/urandom", status, false));
+ assertTrue(
+ "/dev/urandom not world-readable/writable. Actual mode: 0"
+ + Integer.toString(status.mode, 8),
+ (status.mode & 0666) == 0666);
+ }
+
private static Set<File>
getAllInsecureBlockDevicesInDirAndSubdir(File dir) throws Exception {
assertTrue(dir.isDirectory());