From 58317277b6f3775ee6fc3d56e83b81be220f7848 Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Fri, 30 Sep 2016 10:48:38 +0200 Subject: [PATCH] Revert "Fix checking privilege level for hybrid apps" Following commit will reimplement this bug fix. This reverts commit 3002913a84371529abcb09bc7f51857bd3a3899a. Change-Id: I6334d50351fe49daedf543322738b102de2444f5 --- src/hybrid/CMakeLists.txt | 2 - src/hybrid/hybrid_installer.cc | 24 ++++------ .../step/configuration/step_merge_tpk_config.cc | 4 ++ .../step/configuration/step_merge_tpk_config.h | 3 -- .../configuration/step_merge_tpk_privileges.cc | 27 ------------ .../step/configuration/step_merge_tpk_privileges.h | 34 --------------- .../step/security/step_hybrid_check_signature.cc | 51 ---------------------- .../step/security/step_hybrid_check_signature.h | 27 ------------ 8 files changed, 12 insertions(+), 160 deletions(-) delete mode 100644 src/hybrid/step/configuration/step_merge_tpk_privileges.cc delete mode 100644 src/hybrid/step/configuration/step_merge_tpk_privileges.h delete mode 100644 src/hybrid/step/security/step_hybrid_check_signature.cc delete mode 100644 src/hybrid/step/security/step_hybrid_check_signature.h diff --git a/src/hybrid/CMakeLists.txt b/src/hybrid/CMakeLists.txt index bc950d5..ccc7f4a 100644 --- a/src/hybrid/CMakeLists.txt +++ b/src/hybrid/CMakeLists.txt @@ -1,9 +1,7 @@ SET(SRCS step/configuration/step_merge_tpk_config.cc - step/configuration/step_merge_tpk_privileges.cc step/configuration/step_stash_tpk_config.cc step/encryption/step_encrypt_resources.cc - step/security/step_hybrid_check_signature.cc hybrid_installer.cc ) ADD_LIBRARY(${TARGET_LIBNAME_HYBRID} STATIC ${SRCS}) diff --git a/src/hybrid/hybrid_installer.cc b/src/hybrid/hybrid_installer.cc index e98f992..1a0e76f 100644 --- a/src/hybrid/hybrid_installer.cc +++ b/src/hybrid/hybrid_installer.cc @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -73,10 +74,8 @@ #include "hybrid/hybrid_backend_data.h" #include "hybrid/step/configuration/step_merge_tpk_config.h" -#include "hybrid/step/configuration/step_merge_tpk_privileges.h" #include "hybrid/step/configuration/step_stash_tpk_config.h" #include "hybrid/step/encryption/step_encrypt_resources.h" -#include "hybrid/step/security/step_hybrid_check_signature.h" #include "wgt/step/configuration/step_parse.h" #include "wgt/step/encryption/step_remove_encryption_data.h" #include "wgt/step/filesystem/step_copy_preview_icons.h" @@ -111,8 +110,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); - AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -153,8 +151,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); - AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -234,8 +231,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, true); AddStep(); AddStep(); - AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -305,8 +301,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); - AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -347,8 +342,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); - AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -393,8 +387,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); - AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -421,8 +414,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); - AddStep(); - AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); diff --git a/src/hybrid/step/configuration/step_merge_tpk_config.cc b/src/hybrid/step/configuration/step_merge_tpk_config.cc index 15d59c3..913ad98 100644 --- a/src/hybrid/step/configuration/step_merge_tpk_config.cc +++ b/src/hybrid/step/configuration/step_merge_tpk_config.cc @@ -21,6 +21,10 @@ common_installer::Step::Status StepMergeTpkConfig::process() { g_list_concat(wgt_data->application, tpk_data->application); tpk_data->application = nullptr; + wgt_data->privileges = + g_list_concat(wgt_data->privileges, tpk_data->privileges); + tpk_data->privileges = nullptr; + return Status::OK; } diff --git a/src/hybrid/step/configuration/step_merge_tpk_config.h b/src/hybrid/step/configuration/step_merge_tpk_config.h index 623eba5..2171d59 100644 --- a/src/hybrid/step/configuration/step_merge_tpk_config.h +++ b/src/hybrid/step/configuration/step_merge_tpk_config.h @@ -15,9 +15,6 @@ namespace configuration { * \brief MergeTpkConfig * Merges information from tpk manifest into information from widget * configuration for hybrid package. - * - * Expection is the information about native privileges. These are merged in - * \see StepMergeTpkPrivileges */ class StepMergeTpkConfig : public common_installer::Step { public: diff --git a/src/hybrid/step/configuration/step_merge_tpk_privileges.cc b/src/hybrid/step/configuration/step_merge_tpk_privileges.cc deleted file mode 100644 index ef763d6..0000000 --- a/src/hybrid/step/configuration/step_merge_tpk_privileges.cc +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved -// Use of this source code is governed by an apache 2.0 license that can be -// found in the LICENSE file. - -#include "hybrid/step/configuration/step_merge_tpk_privileges.h" - -#include "hybrid/hybrid_backend_data.h" - -namespace ci = common_installer; - -namespace hybrid { -namespace configuration { - -ci::Step::Status StepMergeTpkPrivileges::process() { - // merge privilege list for insertion into database - HybridBackendData* data = - static_cast(context_->backend_data.get()); - manifest_x* tpk_data = data->tpk_manifest_data.get(); - manifest_x* wgt_data = context_->manifest_data.get(); - wgt_data->privileges = - g_list_concat(wgt_data->privileges, tpk_data->privileges); - tpk_data->privileges = nullptr; - return Status::OK; -} - -} // namespace configuration -} // namespace hybrid diff --git a/src/hybrid/step/configuration/step_merge_tpk_privileges.h b/src/hybrid/step/configuration/step_merge_tpk_privileges.h deleted file mode 100644 index 0afe851..0000000 --- a/src/hybrid/step/configuration/step_merge_tpk_privileges.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved -// Use of this source code is governed by an apache 2.0 license that can be -// found in the LICENSE file. - -#ifndef HYBRID_STEP_CONFIGURATION_STEP_MERGE_TPK_PRIVILEGES_H_ -#define HYBRID_STEP_CONFIGURATION_STEP_MERGE_TPK_PRIVILEGES_H_ - -#include -#include - -namespace hybrid { -namespace configuration { - -/** - * @brief The StepMergeTpkPrivileges class - * Merges native privileges into web applicaiton privileges when - * installing hybrid app. - */ -class StepMergeTpkPrivileges : public common_installer::Step { - public: - using Step::Step; - - Status process() override; - Status undo() override { return Status::OK; } - Status clean() override { return Status::OK; } - Status precheck() override { return Status::OK; } - - STEP_NAME(MergeTpkPrivileges) -}; - -} // namespace configuration -} // namespace hybrid - -#endif // HYBRID_STEP_CONFIGURATION_STEP_MERGE_TPK_PRIVILEGES_H_ diff --git a/src/hybrid/step/security/step_hybrid_check_signature.cc b/src/hybrid/step/security/step_hybrid_check_signature.cc deleted file mode 100644 index b71717f..0000000 --- a/src/hybrid/step/security/step_hybrid_check_signature.cc +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved -// Use of this source code is governed by an apache 2.0 license that can be -// found in the LICENSE file. - -#include "hybrid/step/security/step_hybrid_check_signature.h" - -#include - -#include - -#include "hybrid/hybrid_backend_data.h" - -namespace ci = common_installer; - -namespace { - -const char kNativePackageType[] = "tpk"; - -} // namespace - -namespace hybrid { -namespace security { - -ci::Step::Status StepHybridCheckSignature::CheckPrivilegeLevel( - ci::PrivilegeLevel level) { - auto status = StepCheckSignature::CheckPrivilegeLevel(level); - if (status != Status::OK) - return status; - - HybridBackendData* data = - static_cast(context_->backend_data.get()); - manifest_x* tpk_data = data->tpk_manifest_data.get(); - if (tpk_data->privileges) { - std::string error_message; - if (!context_->is_preload_request.get()) { - if (!ci::ValidatePrivilegeLevel(level, kNativePackageType, - tpk_data->api_version, tpk_data->privileges, &error_message)) { - if (!error_message.empty()) { - LOG(ERROR) << "error_message: " << error_message; - on_error(Status::SIGNATURE_ERROR, error_message); - } - return Status::SIGNATURE_ERROR; - } - } - } - - return Status::OK; -} - -} // namespace security -} // namespace hybrid diff --git a/src/hybrid/step/security/step_hybrid_check_signature.h b/src/hybrid/step/security/step_hybrid_check_signature.h deleted file mode 100644 index d867700..0000000 --- a/src/hybrid/step/security/step_hybrid_check_signature.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved -// Use of this source code is governed by an apache 2.0 license that can be -// found in the LICENSE file. - -#ifndef HYBRID_STEP_SECURITY_STEP_HYBRID_CHECK_SIGNATURE_H_ -#define HYBRID_STEP_SECURITY_STEP_HYBRID_CHECK_SIGNATURE_H_ - -#include -#include - -namespace hybrid { -namespace security { - -class StepHybridCheckSignature - : public common_installer::security::StepCheckSignature { - public: - using StepCheckSignature::StepCheckSignature; - - Status CheckPrivilegeLevel(common_installer::PrivilegeLevel level) override; - - STEP_NAME(HybridCheckSignature) -}; - -} // namespace security -} // namespace hybrid - -#endif // HYBRID_STEP_SECURITY_STEP_HYBRID_CHECK_SIGNATURE_H_ -- 2.7.4