[M85][Service] Drop thread privilege of service app 66/251766/3 submit/tizen/20210219.160114
authorYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 19 Jan 2021 02:53:31 +0000 (11:53 +0900)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Fri, 19 Feb 2021 00:51:36 +0000 (16:51 -0800)
This drops the privilege of service app and sets it to User::Pkg::{PKG_ID}.
With this changes, the service app is under control of kernel smack rule.

Reference:
https://review.tizen.org/gerrit/249081

Together with:
https://review.tizen.org/gerrit/251775

Change-Id: I0cd14f159b61b17dc395fd938144a0646529a2d9
Signed-off-by: Youngsoo Choi <kenshin.choi@samsung.com>
wrt_app/service/access_control_manager.ts
wrt_app/service/device_api_router.ts

index 87afb7a..b3d804c 100644 (file)
@@ -1,3 +1,4 @@
+import { wrt } from '../browser/wrt';
 
 function checkSystemInfoApiPrivilege(func: any, permissions: string[]) {
   let override_func  = func;
@@ -10,7 +11,8 @@ function checkSystemInfoApiPrivilege(func: any, permissions: string[]) {
   }
 }
 
-export function initialize(permissions: string[]) {
+export function initialize(packageId: string, appId: string, permissions: string[]) {
+  wrt.security?.dropThreadPrivilege(packageId, appId);
   let tizen = global.tizen;
   if (!permissions.includes("http://tizen.org/privilege/alarm")) {
     tizen.alarm.add =
index 9e2495b..c083c11 100644 (file)
@@ -154,7 +154,7 @@ export class DeviceAPIRouter {
   initAccessControlManager() {
     console.log(`permissions : ${this.permissions}`);
     const AccessControlManager = require('./access_control_manager');
-    AccessControlManager.initialize(this.permissions);
+    AccessControlManager.initialize(this.packageId, this.serviceId, this.permissions);
   }
 
   getServiceId() {