From 2565155723a9b9251527856ec197e07cbe12a447 Mon Sep 17 00:00:00 2001 From: baoyang Date: Mon, 21 Oct 2024 09:11:48 +0000 Subject: [PATCH] cherry pick 6ca5e01 from https://gitee.com/bao_yang_300/security_security_component/pulls/209 check parentNode when parentNode is UiNode Signed-off-by: baoyang Change-Id: Ia07961c052f7a07a6c7d0a38269a3df42ef8d093 --- frameworks/security_component/src/sec_comp_base.cpp | 5 ----- .../inner_api/security_component/include/sec_comp_base.h | 2 -- .../security_component/test/unittest/src/test_common.cpp | 3 --- .../sa/sa_main/sec_comp_manager.cpp | 2 +- .../sa/test/unittest/src/sec_comp_info_helper_test.cpp | 1 - .../sa/test/unittest/src/service_test_common.cpp | 3 --- test/fuzztest/security_component/common/fuzz_common.cpp | 3 --- 7 files changed, 1 insertion(+), 18 deletions(-) diff --git a/frameworks/security_component/src/sec_comp_base.cpp b/frameworks/security_component/src/sec_comp_base.cpp index 6081132..22d10f3 100644 --- a/frameworks/security_component/src/sec_comp_base.cpp +++ b/frameworks/security_component/src/sec_comp_base.cpp @@ -51,7 +51,6 @@ const std::string JsonTagConstants::JSON_BORDER_TAG = "border"; const std::string JsonTagConstants::JSON_BORDER_WIDTH_TAG = "borderWidth"; const std::string JsonTagConstants::JSON_PARENT_TAG = "parent"; const std::string JsonTagConstants::JSON_PARENT_EFFECT_TAG = "parentEffect"; -const std::string JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG = "isParentCheckFailed"; const std::string JsonTagConstants::JSON_IS_CLIPPED_TAG = "isClipped"; const std::string JsonTagConstants::JSON_TOP_CLIP_TAG = "topClip"; const std::string JsonTagConstants::JSON_BOTTOM_CLIP_TAG = "bottomClip"; @@ -197,9 +196,6 @@ bool SecCompBase::ParseParent(const nlohmann::json& json, const std::string& tag if (!ParseBool(jsonParent, JsonTagConstants::JSON_PARENT_EFFECT_TAG, parentEffect_)) { return false; } - if (!ParseBool(jsonParent, JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, isParentCheckFailed_)) { - return false; - } if (!ParseBool(jsonParent, JsonTagConstants::JSON_IS_CLIPPED_TAG, isClipped_)) { return false; } @@ -343,7 +339,6 @@ void SecCompBase::ToJson(nlohmann::json& jsonRes) const }; jsonRes[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json { { JsonTagConstants::JSON_PARENT_EFFECT_TAG, parentEffect_ }, - { JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, isParentCheckFailed_}, { JsonTagConstants::JSON_IS_CLIPPED_TAG, isClipped_ }, { JsonTagConstants::JSON_TOP_CLIP_TAG, topClip_ }, { JsonTagConstants::JSON_BOTTOM_CLIP_TAG, bottomClip_ }, diff --git a/interfaces/inner_api/security_component/include/sec_comp_base.h b/interfaces/inner_api/security_component/include/sec_comp_base.h index 34c4c3e..f7c0130 100644 --- a/interfaces/inner_api/security_component/include/sec_comp_base.h +++ b/interfaces/inner_api/security_component/include/sec_comp_base.h @@ -66,7 +66,6 @@ public: static const std::string JSON_BORDER_WIDTH_TAG; static const std::string JSON_PARENT_TAG; static const std::string JSON_PARENT_EFFECT_TAG; - static const std::string JSON_PARENT_CHECK_FAILED_TAG; static const std::string JSON_IS_CLIPPED_TAG; static const std::string JSON_TOP_CLIP_TAG; static const std::string JSON_BOTTOM_CLIP_TAG; @@ -115,7 +114,6 @@ public: // parent effect bool parentEffect_ = false; - bool isParentCheckFailed_ = false; bool isClipped_ = false; DimensionT topClip_; DimensionT bottomClip_; diff --git a/interfaces/inner_api/security_component/test/unittest/src/test_common.cpp b/interfaces/inner_api/security_component/test/unittest/src/test_common.cpp index 8c75417..2c602e3 100644 --- a/interfaces/inner_api/security_component/test/unittest/src/test_common.cpp +++ b/interfaces/inner_api/security_component/test/unittest/src/test_common.cpp @@ -58,7 +58,6 @@ void TestCommon::BuildLocationComponentInfo(nlohmann::json& jsonComponent) }; jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json { { JsonTagConstants::JSON_PARENT_EFFECT_TAG, false }, - { JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, false }, { JsonTagConstants::JSON_IS_CLIPPED_TAG, false }, { JsonTagConstants::JSON_TOP_CLIP_TAG, 0.0 }, { JsonTagConstants::JSON_BOTTOM_CLIP_TAG, 0.0 }, @@ -115,7 +114,6 @@ void TestCommon::BuildSaveComponentInfo(nlohmann::json& jsonComponent) }; jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json { { JsonTagConstants::JSON_PARENT_EFFECT_TAG, false }, - { JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, false }, { JsonTagConstants::JSON_IS_CLIPPED_TAG, false }, { JsonTagConstants::JSON_TOP_CLIP_TAG, 0.0 }, { JsonTagConstants::JSON_BOTTOM_CLIP_TAG, 0.0 }, @@ -172,7 +170,6 @@ void TestCommon::BuildPasteComponentInfo(nlohmann::json& jsonComponent) }; jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json { { JsonTagConstants::JSON_PARENT_EFFECT_TAG, false }, - { JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, false }, { JsonTagConstants::JSON_IS_CLIPPED_TAG, false }, { JsonTagConstants::JSON_TOP_CLIP_TAG, 0.0 }, { JsonTagConstants::JSON_BOTTOM_CLIP_TAG, 0.0 }, diff --git a/services/security_component_service/sa/sa_main/sec_comp_manager.cpp b/services/security_component_service/sa/sa_main/sec_comp_manager.cpp index 5de862a..4ae69ff 100644 --- a/services/security_component_service/sa/sa_main/sec_comp_manager.cpp +++ b/services/security_component_service/sa/sa_main/sec_comp_manager.cpp @@ -454,7 +454,7 @@ int32_t SecCompManager::CheckClickSecurityComponentInfo(std::shared_ptrGetType()); return SC_SERVICE_ERROR_COMPONENT_INFO_INVALID; } - if (report && (report->isClipped_ || report->isParentCheckFailed_)) { + if (report && (report->isClipped_)) { HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::SEC_COMPONENT, "CLIP_CHECK_FAILED", HiviewDFX::HiSysEvent::EventType::SECURITY, "CALLER_BUNDLE_NAME", bundleName, "COMPONENT_INFO", jsonComponent.dump().c_str()); diff --git a/services/security_component_service/sa/test/unittest/src/sec_comp_info_helper_test.cpp b/services/security_component_service/sa/test/unittest/src/sec_comp_info_helper_test.cpp index fcd754b..0e463d0 100644 --- a/services/security_component_service/sa/test/unittest/src/sec_comp_info_helper_test.cpp +++ b/services/security_component_service/sa/test/unittest/src/sec_comp_info_helper_test.cpp @@ -235,7 +235,6 @@ HWTEST_F(SecCompInfoHelperTest, ParseComponent006, TestSize.Level1) jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json { { JsonTagConstants::JSON_PARENT_EFFECT_TAG, true }, - { JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, false }, { JsonTagConstants::JSON_IS_CLIPPED_TAG, false }, { JsonTagConstants::JSON_TOP_CLIP_TAG, 0.0 }, { JsonTagConstants::JSON_BOTTOM_CLIP_TAG, 0.0 }, diff --git a/services/security_component_service/sa/test/unittest/src/service_test_common.cpp b/services/security_component_service/sa/test/unittest/src/service_test_common.cpp index d6ab82b..d3433d1 100644 --- a/services/security_component_service/sa/test/unittest/src/service_test_common.cpp +++ b/services/security_component_service/sa/test/unittest/src/service_test_common.cpp @@ -58,7 +58,6 @@ void ServiceTestCommon::BuildLocationComponentJson(nlohmann::json& jsonComponent }; jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json { { JsonTagConstants::JSON_PARENT_EFFECT_TAG, false }, - { JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, false }, { JsonTagConstants::JSON_IS_CLIPPED_TAG, false }, { JsonTagConstants::JSON_TOP_CLIP_TAG, 0.0 }, { JsonTagConstants::JSON_BOTTOM_CLIP_TAG, 0.0 }, @@ -115,7 +114,6 @@ void ServiceTestCommon::BuildSaveComponentJson(nlohmann::json& jsonComponent) }; jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json { { JsonTagConstants::JSON_PARENT_EFFECT_TAG, false }, - { JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, false }, { JsonTagConstants::JSON_IS_CLIPPED_TAG, false }, { JsonTagConstants::JSON_TOP_CLIP_TAG, 0.0 }, { JsonTagConstants::JSON_BOTTOM_CLIP_TAG, 0.0 }, @@ -172,7 +170,6 @@ void ServiceTestCommon::BuildPasteComponentJson(nlohmann::json& jsonComponent) }; jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json { { JsonTagConstants::JSON_PARENT_EFFECT_TAG, false }, - { JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, false }, { JsonTagConstants::JSON_IS_CLIPPED_TAG, false }, { JsonTagConstants::JSON_TOP_CLIP_TAG, 0.0 }, { JsonTagConstants::JSON_BOTTOM_CLIP_TAG, 0.0 }, diff --git a/test/fuzztest/security_component/common/fuzz_common.cpp b/test/fuzztest/security_component/common/fuzz_common.cpp index def10eb..d591bee 100644 --- a/test/fuzztest/security_component/common/fuzz_common.cpp +++ b/test/fuzztest/security_component/common/fuzz_common.cpp @@ -93,7 +93,6 @@ std::string CompoRandomGenerator::ConstructLocationJson() // set default val jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json { { JsonTagConstants::JSON_PARENT_EFFECT_TAG, GetData() }, - { JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, GetData() }, { JsonTagConstants::JSON_IS_CLIPPED_TAG, GetData() }, { JsonTagConstants::JSON_TOP_CLIP_TAG, GetData() }, { JsonTagConstants::JSON_BOTTOM_CLIP_TAG, GetData() }, @@ -136,7 +135,6 @@ std::string CompoRandomGenerator::ConstructSaveJson() // set default val jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json { { JsonTagConstants::JSON_PARENT_EFFECT_TAG, GetData() }, - { JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, GetData() }, { JsonTagConstants::JSON_IS_CLIPPED_TAG, GetData() }, { JsonTagConstants::JSON_TOP_CLIP_TAG, GetData() }, { JsonTagConstants::JSON_BOTTOM_CLIP_TAG, GetData() }, @@ -178,7 +176,6 @@ std::string CompoRandomGenerator::ConstructPasteJson() // set default val jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json { { JsonTagConstants::JSON_PARENT_EFFECT_TAG, GetData() }, - { JsonTagConstants::JSON_PARENT_CHECK_FAILED_TAG, GetData() }, { JsonTagConstants::JSON_IS_CLIPPED_TAG, GetData() }, { JsonTagConstants::JSON_TOP_CLIP_TAG, GetData() }, { JsonTagConstants::JSON_BOTTOM_CLIP_TAG, GetData() }, -- Gitee