platform_system_sepolicy/public/iorap_inode2filename.te
Alan Stokes f8ad33985d Introduce app_data_file_type attribute.
This gives us an easy way for the policy to refer to all existing or
future types used for app private data files in type= assignments in
seapp_contexts.

Apply the label to all the existing types, then refactor rules to use
the new attribute.

This is intended as a pure refactoring, except that:
- Some neverallow rules are extended to cover types they previous
omitted;
- We allow iorap_inode2filename limited access to shell_data_file and
  nfc_data_file;
- We allow zygote limited access to system_app_data_file.

This mostly reverts the revert in commit
b01e1d97bf, restoring commit
27e0c740f1. Changes to check_seapp to
enforce use of app_data_file_type is omitted, to be included in a
following CL.

Test: Presubmits
Bug: 171795911
Change-Id: I02b31e7b3d5634c94763387284b5a154fe5b71b4
2020-11-11 14:43:36 +00:00

69 lines
4 KiB
Text

# iorap.inode2filename -> look up file paths from an inode
type iorap_inode2filename, domain;
type iorap_inode2filename_exec, exec_type, file_type, system_file_type;
type iorap_inode2filename_tmpfs, file_type;
r_dir_file(iorap_inode2filename, rootfs)
# Allow usage of pipes (child stdout -> parent pipe).
allow iorap_inode2filename iorapd:fd use;
allow iorap_inode2filename iorapd:fifo_file { read write getattr };
# Allow reading most files under / ignoring usual access controls.
allow iorap_inode2filename self:capability dac_read_search;
typeattribute iorap_inode2filename mlstrustedsubject;
# Grant access to open most of the files under /
allow iorap_inode2filename apex_data_file:dir { getattr open read search };
allow iorap_inode2filename apex_data_file:file { getattr };
allow iorap_inode2filename apex_mnt_dir:dir { getattr open read search };
allow iorap_inode2filename apex_mnt_dir:file { getattr };
allow iorap_inode2filename apk_data_file:dir { getattr open read search };
allow iorap_inode2filename apk_data_file:file { getattr };
allow iorap_inode2filename app_data_file_type:dir { getattr open read search };
allow iorap_inode2filename app_data_file_type:file { getattr };
allow iorap_inode2filename backup_data_file:dir { getattr open read search };
allow iorap_inode2filename backup_data_file:file { getattr };
allow iorap_inode2filename bootchart_data_file:dir { getattr open read search };
allow iorap_inode2filename bootchart_data_file:file { getattr };
allow iorap_inode2filename metadata_file:dir { getattr open read search search };
allow iorap_inode2filename metadata_file:file { getattr };
allow iorap_inode2filename packages_list_file:dir { getattr open read search };
allow iorap_inode2filename packages_list_file:file { getattr };
allow iorap_inode2filename property_data_file:dir { getattr open read search };
allow iorap_inode2filename property_data_file:file { getattr };
allow iorap_inode2filename resourcecache_data_file:dir { getattr open read search };
allow iorap_inode2filename resourcecache_data_file:file { getattr };
allow iorap_inode2filename recovery_data_file:dir { getattr open read search };
allow iorap_inode2filename ringtone_file:dir { getattr open read search };
allow iorap_inode2filename ringtone_file:file { getattr };
allow iorap_inode2filename same_process_hal_file:dir { getattr open read search };
allow iorap_inode2filename same_process_hal_file:file { getattr };
allow iorap_inode2filename sepolicy_file:file { getattr };
allow iorap_inode2filename staging_data_file:dir { getattr open read search };
allow iorap_inode2filename staging_data_file:file { getattr };
allow iorap_inode2filename system_bootstrap_lib_file:dir { getattr open read search };
allow iorap_inode2filename system_bootstrap_lib_file:file { getattr };
allow iorap_inode2filename system_data_file:dir { getattr open read search };
allow iorap_inode2filename system_data_file:file { getattr };
allow iorap_inode2filename system_data_file:lnk_file { getattr open read };
allow iorap_inode2filename system_data_root_file:dir { getattr open read search };
allow iorap_inode2filename textclassifier_data_file:dir { getattr open read search };
allow iorap_inode2filename textclassifier_data_file:file { getattr };
allow iorap_inode2filename toolbox_exec:file getattr;
allow iorap_inode2filename user_profile_data_file:dir { getattr open read search };
allow iorap_inode2filename user_profile_data_file:file { getattr };
allow iorap_inode2filename unencrypted_data_file:dir { getattr open read search };
allow iorap_inode2filename unlabeled:file { getattr };
allow iorap_inode2filename vendor_file:dir { getattr open read search };
allow iorap_inode2filename vendor_file:file { getattr };
allow iorap_inode2filename vendor_overlay_file:file { getattr };
allow iorap_inode2filename zygote_exec:file { getattr };
###
### neverallow rules
###
neverallow { domain -init -iorapd } iorap_inode2filename:process { transition dyntransition };
neverallow iorap_inode2filename domain:{ tcp_socket udp_socket rawip_socket } *;