William Hester | 5f486c7 | 2019-01-15 13:39:30 -0800 | [diff] [blame] | 1 | # Allow apps to read the Test Harness Mode property. This property is used in |
| 2 | # the implementation of ActivityManager.isDeviceInTestHarnessMode() |
| 3 | get_prop(appdomain, test_harness_prop) |
| 4 | |
Florian Mayer | 5e52281 | 2019-10-08 16:15:14 +0100 | [diff] [blame] | 5 | userdebug_or_eng(`perfetto_producer({ appdomain })') |
| 6 | |
Jeff Vander Stoep | 607bc67 | 2019-12-16 10:59:03 +0100 | [diff] [blame] | 7 | # Prevent apps from causing presubmit failures. |
| 8 | # Apps can cause selinux denials by accessing CE storage |
| 9 | # and/or external storage. In either case, the selinux denial is |
| 10 | # not the cause of the failure, but just a symptom that |
| 11 | # storage isn't ready. Many apps handle the failure appropriately. |
| 12 | # |
| 13 | # Apps cannot access external storage before it becomes available. |
| 14 | dontaudit appdomain storage_stub_file:dir getattr; |
| 15 | # Attempts to write to system_data_file is generally a sign |
| 16 | # that apps are attempting to access encrypted storage before |
| 17 | # the ACTION_USER_UNLOCKED intent is delivered. Apps are not |
| 18 | # allowed to write to CE storage before it's available. |
| 19 | # Attempting to do so will be blocked by both selinux and unix |
| 20 | # permissions. |
| 21 | dontaudit appdomain system_data_file:dir write; |
Jeff Vander Stoep | 67896ee | 2020-04-02 13:36:17 +0200 | [diff] [blame] | 22 | # Apps should not be reading vendor-defined properties. |
| 23 | dontaudit appdomain vendor_default_prop:file read; |
Jeff Vander Stoep | 607bc67 | 2019-12-16 10:59:03 +0100 | [diff] [blame] | 24 | |
Nathan Harold | ee26864 | 2017-12-14 18:20:30 -0800 | [diff] [blame] | 25 | neverallow appdomain system_server:udp_socket { |
Nathan Harold | 252b015 | 2018-03-27 06:34:54 -0700 | [diff] [blame] | 26 | accept append bind create ioctl listen lock name_bind |
| 27 | relabelfrom relabelto setattr shutdown }; |
Nick Kralevich | 1e5021c | 2018-11-28 17:50:24 -0800 | [diff] [blame] | 28 | |
| 29 | # Transition to a non-app domain. |
| 30 | # Exception for the shell and su domains, can transition to runas, etc. |
Nick Kralevich | 0eb0a16 | 2018-12-12 09:06:05 -0800 | [diff] [blame] | 31 | # Exception for crash_dump to allow for app crash reporting. |
| 32 | # Exception for renderscript binaries (/system/bin/bcc, /system/bin/ld.mc) |
| 33 | # to allow renderscript to create privileged executable files. |
| 34 | neverallow { appdomain -shell userdebug_or_eng(`-su') } |
| 35 | { domain -appdomain -crash_dump -rs }:process { transition }; |
| 36 | neverallow { appdomain -shell userdebug_or_eng(`-su') } |
| 37 | { domain -appdomain }:process { dyntransition }; |