[Service] Apply smack label ahead of webapis initialization 96/263396/3 submit/tizen/20210902.160017
authorDongHyun Song <dh81.song@samsung.com>
Thu, 2 Sep 2021 02:19:00 +0000 (11:19 +0900)
committerDongHyun Song <dh81.song@samsung.com>
Thu, 2 Sep 2021 02:58:34 +0000 (11:58 +0900)
commit9a678bd5894fd42736e2473c133d80fa7ccae56a
tree1115d070545a658793ee973410190ae1fbb4e8f5
parent805204c95bff8a8d3d77f614f689ad5bcd22c9d9
[Service] Apply smack label ahead of webapis initialization

On webapis side, it is checking privileges by cynara client with
smack label (/prod/tid/attr/current), but, this smack label is
getting before dropThreadPrivilege().

Thus, it is always 'org.tizen.chromium-efl.wrt-service'.
To make correct this problem, this patch change its time ahead of
dropThreadPrivilege().

By this logic, there is a new smack error while using systeminfo
webapi. Because systeminfo webapi is using their singleton worker
thread to get some device information. This must be created by
same smack label as pid's smack label. Otherwise, the worker's task
will be failed.

Therefore, this moves below logic on main thread.

  tizen.systeminfo.getPropertyValue("CPU", () => { }, () => { });

Later, I will discuss regarding creating this singleton worker by
other better way with webapi members.

Change-Id: I8c3ab62b775e1aaa895aa70b0ec5f438840ad74b
Signed-off-by: DongHyun Song <dh81.song@samsung.com>
wrt_app/service/service_manager.ts
wrt_app/service/service_runner.ts