Add codes for bypass pkgmgr privilege 29/308429/2
authorInkyun Kil <inkyun.kil@samsung.com>
Mon, 25 Mar 2024 09:06:25 +0000 (18:06 +0900)
committerInkyun Kil <inkyun.kil@samsung.com>
Tue, 26 Mar 2024 01:16:46 +0000 (10:16 +0900)
- Changing the pkgmgr protocol to TIDL requires a way to pass the privilege

Change-Id: Ia2ff2364016f5112ccf37ff95dc95dd3b1f2b311
Signed-off-by: Inkyun Kil <inkyun.kil@samsung.com>
src/modules/rpc-port/amd_rpc_port.cc

index 813dae0..0c3e40f 100644 (file)
@@ -73,6 +73,8 @@ constexpr const char kPrivilegeDataSharing[] =
     "http://tizen.org/privilege/datasharing";
 constexpr const char kPrivilegeCheckBypass[] =
     "http://tizen.org/rpc-port/privilege-check-bypass";
+constexpr const char kPkgmgrAppId[] = "org.tizen.appfw.pkgmgr";
+constexpr const char kPkgmgrPortName[] = "PkgMgr";
 
 std::unordered_map<int, int> pid_map;
 std::string tts_engine_default;
@@ -462,6 +464,12 @@ static int VerifyPrivilegeCheckBypass(amd_request_h req) {
     return AMD_CYNARA_RET_ERROR;
   }
 
+  if (app_id == std::string(kPkgmgrAppId) &&
+      port_name == std::string(kPkgmgrPortName)) {
+    SECURE_LOGD("Bypass privilege check for PkgMgr");
+    return AMD_CYNARA_RET_ALLOWED;
+  }
+
   uid_t target_uid = amd_request_get_target_uid(req);
   if (amd_appinfo_is_platform_app(app_id.c_str(), target_uid)) {
     amd_app_property_h app_property = amd_app_property_find(target_uid);