Commit graph

114 commits

Author SHA1 Message Date
Roshan Pius
23a929df62 sepolicy(nfc): Changing selinux policy for signed NFC APK
NFC stack is becoming an unbundled apex which embeds the existing NFC
APK. Unbundling requires the apex & apk to be signed by non-platform
certificates, hence adding new seapp_contexts rule for the NFC stack.

The old rule is also left behing to support `-next` config builds where
we are still using the platform signed NFC APK.

Ignore-AOSP-First: All of the NFC mainline work is only present in
internal master. Will cherry-pick this CL once we cherry-pick all its
dependencies.

Bug: 320583956
Test: Bootup test with signed NFC APK (within NFC apex)
Merged-In: I1d4d6370cce558c8dcc0ec73a7ce47c2b5495a33

Change-Id: I1d4d6370cce558c8dcc0ec73a7ce47c2b5495a33
2024-01-19 10:22:56 -08:00
Ján Sebechlebský
5d6b66c8ea Revert^2 "Allow system_server to communicate with virtual_camera"
This reverts commit 76a62dfb3e.

Reason for revert: Relanding with virtual_camera flag disabled to prevent test failures before rc entry is added for the service (which needs to be done after this cl is submitted to prevent boot test failing due to selinux denials).

Test: https://android-build.corp.google.com/builds/abtd/run/L11500030000350228
Change-Id: Ie621f89610b173918bb4c0b6eb1f35547f56f6b7
2023-11-20 10:42:11 +01:00
Thiébaud Weksteen
1deccbb3f4 Merge "Revert^2 "Introduce sdk_sandbox_audit SELinux domain"" into android14-tests-dev am: 2f98237c4d
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/2836555

Change-Id: Iffd388a421177b61186f4a7b6e6076313206fd36
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-19 23:51:03 +00:00
Sandro Montanari
1e9eb36ad2 Revert^2 "Introduce sdk_sandbox_audit SELinux domain"
This reverts commit a41bfab758.

Reason for revert: Automerger path causing the regression is no more

Change-Id: I4c9ab6f2e18c9d8157f5667bc98fcce00e78f93d
2023-11-17 09:54:33 +00:00
Matt Stokes
76a62dfb3e Revert "Allow system_server to communicate with virtual_camera"
This reverts commit 45f1ecee7a.

Reason for revert: <Droid TestMonitor b/311401010>

Change-Id: I82716e9d52a66018c5e7d7d13c8292d7d19f253c
2023-11-16 17:42:25 +00:00
Vadim Caen
45f1ecee7a Allow system_server to communicate with virtual_camera
and consitently name service and process as "virtual_camera" (with
underscore)

Test: Cts VirtalCameraTest
Bug: 270352264
Change-Id: I2c6c0c03aab47aa1795cbda19af25e6661a0bf4a
2023-11-14 15:27:57 +01:00
Sandro Montanari
a41bfab758 Revert "Introduce sdk_sandbox_audit SELinux domain"
This reverts commit 5eb6189fc0.

Reason for revert: breaks build in git_udc-qpr-dev-throttled

Change-Id: I97b5fe5e1db668a33d00b15bd3cb5e663050eba2
2023-11-14 12:27:39 +00:00
Sandro Montanari
5eb6189fc0 Introduce sdk_sandbox_audit SELinux domain
Bug: 295861450
Test: atest CtsSdkSandboxInprocessTests and adb shell ps -Z
Change-Id: I9c5873181c925c6b8ebb411328d30aa519053acf
Merged-In: I9c5873181c925c6b8ebb411328d30aa519053acf
2023-11-14 09:14:03 +00:00
Sandro Montanari
4db0e27a50 Introduce sdk_sandbox_audit SELinux domain
Bug: 295861450
Test: atest CtsSdkSandboxInprocessTests and adb shell ps -Z
Change-Id: I9c5873181c925c6b8ebb411328d30aa519053acf
2023-10-26 08:50:26 +00:00
Vadim Caen
bb59231998 Merge "Policy for virtual_camera" into main 2023-07-26 12:20:17 +00:00
Inseob Kim
7bb1b5d170 Update seapp_contexts precedence documentation
Bug: 280547417
Test: TH
Change-Id: I914ef7a7f87b0646411a67e4eec128b61d3ff321
2023-07-26 11:28:55 +00:00
Vadim Caen
d64cf75c48 Policy for virtual_camera
Adds a policy to run the virtual_camera process which:
 - registers a service implementing the camera HAL
 - registers a service to reveive communicate with virtual cameras via
   system_server

Bug: 253991421
Test: CTS test
android.virtualdevice.cts.VirtualDeviceManagerBasicTest#createDevice_createCamera

Change-Id: I772d176919b8dcd3b73946935ed439207c948f2b
2023-07-25 19:27:48 +00:00
Inseob Kim
9d6ce199be Fix seapp_contexts documentation
Bug: 291528964
Test: N/A; documentation change
Change-Id: I00986c5ace94ed3ee91f3c90300966b0a006bcd5
2023-07-17 19:53:25 +09:00
Alan Stokes
12de184d37 Switch rkpd to levelFrom=all
Defense in depth: ensure no other app can access rkpd data files.

Test: Presubmits.
Change-Id: Id3ca9829eadf19fb50da8d0a7414706121871633
2023-06-08 11:24:56 +01:00
Mugdha Lakhani
d44c51e017 Add canary restrictions for sdk_sandbox
Add sdk_sandbox_next and apply it if a new input selector,
isSdkSandboxNext, is applied. This is set to true by libselinux
if a flag is set in the seInfo passed to it.

This enables some testers to test out the set of restrictions
we're planning for the next SDK version.
sdk_sandbox_next is not the final set of restrictions of the next SDK
version.

Bug: b/270148964
Test: atest PackageManagerLocalTest SdkSandboxDataIsolationHostTest
SdkSandboxRestrictionsTest
Change-Id: Ie8bad9c1b8f8eb032d13e1822689c78ad3d2c68a
Merged-In: Ie8bad9c1b8f8eb032d13e1822689c78ad3d2c68a
2023-05-12 20:06:31 +00:00
Mugdha Lakhani
49075f9cab Add canary restrictions for sdk_sandbox
Apply sdk_sandbox_next it if a new input selector,
isSdkSandboxNext, is true. This is set to true by libselinux
if a flag is set in the seInfo passed to it.

This enables some testers to test out the set of restrictions
we're planning for the next SDK version.
sdk_sandbox_next is not the final set of restrictions of the next SDK
version.

Bug: b/270148964
Test: atest PackageManagerLocalTest SdkSandboxDataIsolationHostTest
SdkSandboxRestrictionsTest

Change-Id: Idbc3ab39a2d9ef6e1feaf8c212d81a1c79b0f787
2023-05-11 17:42:48 +00:00
Mugdha Lakhani
50ad933ebd Introduce sdk_sandbox_next
Bug: b/270148964
Test: atest PackageManagerLocalTest SdkSandboxDataIsolationHostTest
SdkSandboxRestrictionsTest

Change-Id: Ica168ddd87ac0fa7286b1ca8520b9144899910f4
2023-05-10 18:54:24 +00:00
Mugdha Lakhani
9304b8a6cc Create sdk_sandbox_all.
Rename sdk_sandbox to sdk_sandbox_34.
Additionally, Extract out parts of sdk_sandbox_34 to
sdk_sandbox_all.te that will be shared with all sdk_sandbox domains.

Bug: b/270148964
Test: atest PackageManagerLocalTest SdkSandboxDataIsolationHostTest
SdkSandboxRestrictionsTest

Change-Id: I36e0c8795148de83c81dfe12559452812aa2b25e
Merged-In: I36e0c8795148de83c81dfe12559452812aa2b25e
2023-05-10 17:54:07 +00:00
Mugdha Lakhani
2ae45c5766 Create sdk_sandbox_all.
Rename sdk_sandbox to sdk_sandbox_34.
Additionally, Extract out parts of sdk_sandbox_34 to
sdk_sandbox_all.te that will be shared with all sdk_sandbox domains.

Bug: b/270148964
Test: atest PackageManagerLocalTest SdkSandboxDataIsolationHostTest
SdkSandboxRestrictionsTest

Change-Id: I36e0c8795148de83c81dfe12559452812aa2b25e
2023-05-09 15:11:39 +00:00
Martin Stjernholm
87143bd904 Revert "Introduce a new sdk_sandbox domain"
This reverts commit 304962477a.

Reason for revert: b/279565840

Change-Id: I6fc3a102994157ea3da751364f80730f4d0e87f0
2023-04-25 12:40:37 +00:00
Mugdha Lakhani
304962477a Introduce a new sdk_sandbox domain
Define the selinux domain to apply to SDK runtime for
targetSdkVersion=34.
The existing sdk_sandbox domain has been renamed to sdk_sandbox_next.
Future CLs will add logic to apply one of these to the SDK runtime
processes on the device, based on a flag.

auditallow block from sdk_sandbox has been removed as we haven't yet
measured the system health impact of adding this. It'll be added to an
audit domain later after we've ruled out negative system health impact.

Bug: 270148964
Test: make and boot the test device, load SDK using test app
Change-Id: I7438fb16c1c5e85e30683e421ce463f9e0b1470d
2023-04-21 17:26:26 +00:00
Tri Vo
4bb2d30701 Remove RemoteProvisioner and remoteprovisioning services
Bug: 273325840
Test: keystore2_test
Change-Id: I295ccdda5a3d87b568098fdf97b0ca5923e378bf
2023-03-14 15:45:35 -07:00
Krishang Garodia
caf7984a2e Update SE policy for all media provider processes
Bug: 230394838
Bug: 195009152
Test: manual
Change-Id: Ic8e1d45c910e1455dd28bfb748d134c066a33591
2023-02-10 11:06:53 +00:00
Avichal Rakesh
e0929241a1 Add selinux permissions for DeviceAsWebcam Service
DeviceAsWebcam is a new service that turns an android device into a
webcam. It requires access to all services that a
regular app needs access to, and it requires read/write permission to
/dev/video* nodes which is how the linux kernel mounts the UVC gadget.

Bug: 242344221
Bug: 242344229
Test: Manually tested that the service can access all the nodes it
      needs, and no selinux exceptions are reported for the service
      when running.
Change-Id: I45c5df105f5b0c31dd6a733f50eb764479d18e9f
2023-02-02 12:26:33 -08:00
Charles Chen
3d629cdb5d Merge "Creates mapping from isolated apps to isolated_compute_app" 2023-02-02 05:41:22 +00:00
Charles Chen
bc965c900a Creates mapping from isolated apps to isolated_compute_app
Provides mapping using the isIsolatedComputeApp to enable certain
isolated process running in such domain with more hardware
acceleratation.

Bug: 267494028
Test: m && atest --host libselinux_test with change on android_unittest.cpp
Change-Id: I9ff341de69e0ad15cb7764276e0c726d54261b84
2023-02-01 18:41:09 +00:00
Charles Chen
eb1290f511 Merge "Update seapp_contexts with isIsolatedComputeApp selector" 2023-02-01 17:34:48 +00:00
Charles Chen
307049222a Update seapp_contexts with isIsolatedComputeApp selector
Provide isIsolatedComputeApp selector for apps reusing _isolated user to run in domains other than isolated_app. Processes match the selector will have a default domain isolated_compute_app assigned. Also updated _isolated neverallow statements.

Bug: 265540209
Bug: 265746493
Test: m && atest --host libselinux_test with change on android_unittest.cpp
Change-Id: Ia05954aa6a9a9a07d6a8d1e3235a89e7b37dead9
2023-01-27 14:36:40 +00:00
Yuyang Huang
cfdea5f4f3 Blocks untrusted apps to access /dev/socket/mdnsd from U
The untrusted apps should not directly access /dev/socket/mdnsd since
API level 34 (U). Only adbd and netd should remain to have access to
/dev/socket/mdnsd. For untrusted apps running with API level 33-, they
still have access to /dev/socket/mdnsd for backward compatibility.

Bug: 265364111
Test: Manual test
Change-Id: Id37998fcb9379fda6917782b0eaee29cd3c51525
2023-01-20 15:25:46 +09:00
Vikram Gaur
d7a1aaf108 Add Google specific module for RKPD for sepolicy.
Google is added to the package names to differentiate the Google
specific modules from AOSP modules. This causes RKPD Google module to
not get proper permissions since we permit only AOSP module currently.

Test: Tested on Pixel 7 device
Change-Id: Ia7c39ef85cedf20f705c27a5944b6f87f786cc1b
2022-12-11 09:49:08 +00:00
Seth Moore
71fa94edae Add new appdomain for RKPD mainline app
This app talks to the remote provisioning HALs, and therefore requires
access to the tee_device domain.

Bug: 254112668
Test: Manually verify rkpd can run and find remote provisioning hals
Change-Id: I876b0890f3d4e8956406d73e956084b99488ce56
2022-11-16 12:55:31 -08:00
Roopa Sattiraju
f227d0d99e Changing selinux policy for privapps for new certs.
Bug: 220807590
Test: build and boot
Change-Id: Ib24fed5e4980b0c8bb4df658a961346c5b4730ad
2022-04-05 17:31:49 -07:00
Nikita Ioffe
e2da633ef7 Rename SupplementalProcess to SdkSandbox
Ignore-AOSP-First: sepolicy is not in aosp, yet
Bug: 220320098
Test: presubmit
Change-Id: I9fb98e0caee75bdaaa35d11d174004505f236799
2022-02-23 20:44:20 +00:00
Samiul Islam
76935bdef5 Add new label for supplemental data
Supplemental data is separate from app data and only supplemental
process should have access to these directories.

This CL creates a new label for such data and updates the seapp_context
to assign correct label from installd.

The new label will be applied as follows:

/data/user/0/supplemental                   #system_data_file
/data/user/0/supplemental/<app-name>        #system_data_file
/data/user/0/supplemental/<app-name>/shared #supplemental_app_data_file

Bug: 217543371
Bug: 217559719
Test: atest SupplementalProcessStorageHostTest
      - #testSelinuxLabel_SharedData
      - #testSupplementalDataAppDirectory_SharedStorageIsUsable
Ignore-AOSP-First: Feature is being developed in internal branch
Change-Id: I6572a7a5c46c52c9421d0e9c9fc653ddbd6de145
2022-02-15 18:36:58 +00:00
Kevin Jeon
4241e001e2 Make Traceur seapp_context reflect platform status
Because Traceur is being signed with the platform key in aosp/1961100,
the platform seinfo identifier is being added to Traceur so that SELinux
will correctly identify it as a platform app.

Bug: 209476712
Test: - Checked that Traceur can still take normal and long traces on
        AOSP userdebug and internal user/userdebug.
      - Checked that the Traceur app is now located in /system/app/
	instead of /system/priv-app/.
Ignore-AOSP-First: There are changes in internal that cause merge
                   conflicts when attempting to add this change to AOSP.
                   After this change is merged in internal, it will be
                   added to AOSP with the Merged-In tag.
Change-Id: Ibe7881d48798e3b71bb40e566fa8243cbb630b04
2022-01-31 17:57:54 +00:00
Rafay Kamran
bae084a7e1 Merge changes from topic "supplemental_process_sepolicy"
* changes:
  Enable supplemental_process context for com.android.supplemental.process
  Added supplemental key to the sepolicy
2021-12-13 14:19:08 +00:00
Alan Stokes
665c295efc Restrict system_server_startup domain
This seems like an oversight when system_server_startup was
introduced (commit caf42d615d).

Test: Presubmits
Change-Id: Ia371caa8dfc2c250d6ca6f571cf002e25703e793
2021-11-26 11:41:51 +00:00
RafayKamran
f3bdc0bcd4 Enable supplemental_process context for com.android.supplemental.process
Note that this requires the supplemental process app to be signed with
the supplemental process key, also added neverallow rule to ensure
supplemental_process always runs in the correct domain

Bug: 203670791
Test: Device boots, attempted to let supplemental_process run in an incorrect domain and it failed as expected, signed test app and verified that app runs in correct selinux domain
adb shell ps -eZ | grep supplemental

Ignore-AOSP-First: Feature is developed in internal branch

Change-Id: I478c9a16032dc1f1286f5295fc080cbe574f09c9
2021-11-23 11:02:42 +00:00
Bram Bonné
ea5460ab6e untrusted_app_30: add new targetSdk domain
Enforce new requirements on app with targetSdkVersion=32 including:
- No RTM_GETNEIGH on netlink route sockets.
- No RTM_GETNEIGHTBL on netlink route sockets.

Bug: 171572148
Test: atest NetworkInterfaceTest
Test: atest bionic-unit-tests-static
Test: atest CtsSelinuxTargetSdkCurrentTestCases
Test: atest CtsSelinuxTargetSdk30TestCases
Test: atest CtsSelinuxTargetSdk29TestCases
Test: atest CtsSelinuxTargetSdk28TestCases
Test: atest CtsSelinuxTargetSdk27TestCases
Test: atest CompatChangesSelinuxTest
Test: atest NetlinkSocketTest
Change-Id: I2167e6cd564854c2656ee06c2202cfff2b727af5
2021-07-05 11:42:31 +02:00
Jeff Vander Stoep
35779f082f seapp_contexts: Remove unused selectors
These have never been used in AOSP. Looking at ~10,000 Android
build images confirms that these are not used elsewhere within
the Android ecosystem.

Bug: 192532348
Test: build (failures here would be at build-time)
Change-Id: I787b14b531df31fbb9995156eb2e84719b7c90da
2021-07-01 10:51:12 +02:00
Jeff Vander Stoep
538e0d6d0e Revert "priv_app: use per-app selinux contexts"
There's some fragility in how selinux contexts are assigned
to apps with sharedUserId. As a result, some apps which share
a UID can end up in separate selinux domains. This causes bugs
when part of the app has the levelFrom=all categories set, and
other parts only have levelFrom=user resulting in an mls category
mismatch. Until this is fixed, revert back to using levelFrom=user
for priv_app.

This reverts commit 4e7769e040.
Bug: 188141923
Test: com.google.android.gts.devicepolicy.DeviceOwnerTest#testPendingSystemUpdate

Change-Id: Ic4256f9056f2c218ca94628d0707eb893f83fa5a
2021-06-07 14:28:34 +02:00
Max Bires
23f0f3b28a SEPolicy for RemoteProvisioning App
This change adds the SEPolicy changes required to support the remote
provisioning flow. The notable additions are specifically labeling the
remote provisioning app and giving it access to find the remote
provisioning service which is added in keystore. It also requires
network access in order to communicate to the provisioning servers.

This functionality is extremely narrow to the point that it seems worth
it to define a separate domain for this app, rather than add this in to
the priv_app or platform_app permission files. Since this app also
communicates with the network, it also seems advantageous to limit its
permissions only to what is absolutely necessary to perform its
function.

Test: No denials!
Change-Id: I602c12365a575d914afc91f55e6a9b6aa2e14189
2021-02-08 01:33:12 -08:00
markchien
48c600fce1 Allow network_stack to update eBPF map
Bug: 173167302
Test: m
Change-Id: I7e7fcbcada905601cf08bf99fcdeb7e61c6effae
2020-12-02 00:38:25 +00:00
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
Alan Stokes
b01e1d97bf Revert "Introduce app_data_file_type attribute."
This reverts commit 27e0c740f1.

Reason for revert: b/172926597

Change-Id: Id2443446cbdf51dc05b303028377895b9cf2a09e
2020-11-10 18:02:14 +00:00
Alan Stokes
27e0c740f1 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.

Also extend check_seapp to check that all types specified in
seapp_contexts files have the attribute, to ensure that the neverallow
rules apply to them. As a small bonus, also verify that domain and
type values are actually types not attributes.

Test: Presubmits
Test: Manual: specify an invalid type, build breaks.
Bug: 171795911
Change-Id: Iab6018af449dab3b407824e635dc62e3d81e07c9
2020-11-09 11:04:02 +00:00
Alan Stokes
c7229c760f Make shared_relro levelFrom=all.
Also make shared_relro_file mlstrustedobject to ensure these files can
still be read by any app in any user.

Bug: 170622707
Test: Manual: delete the files, check they are re-created and accessible.
Test: Manual: no denials seen
Test: Presubmits
Change-Id: Icce4ee858219e3fd0e307f3edfb3c66005872a45
2020-10-12 14:43:01 +01:00
Collin Fijalkovich
71af2b4cdd Merge "Make traceur seapp_context reflect privapp status" 2020-09-24 21:08:09 +00:00
Collin Fijalkovich
057c7d60dc Make traceur seapp_context reflect privapp status
In moving Traceur from being signed with the platform key to privapp
status, we need to adjust how SELinux identifies the Traceur
app_context. We remove the platform seinfo identifier since Traceur is
no longer a platform app, and identify it as a privapp.

Bug: 166768816
Test: Build user and userdebug versions, tested regular and long tracing
functionality

Change-Id: Ie0b198a0caa5c3a074f5a275c7eb95e37671d60f
2020-08-28 16:10:36 -07:00
Ashwini Oruganti
706aa4b165 Actually route PermissionController to the right domain am: b3bffe88ab am: a8ac523363
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/1336070

Change-Id: I64ef366b3049b50fa064f5c5de86ab718a6e3f6c
2020-06-15 19:51:06 +00:00