1# Copyright (c) 2023-2024 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/config/features.gni") 15import("//build/ohos.gni") 16import("//build/test.gni") 17import("../../../common/config/common.gni") 18module_output_path = "enterprise_device_management/enterprise_device_management" 19 20config("module_private_config") { 21 visibility = [ ":*" ] 22 include_dirs = [ "../" ] 23} 24 25config("edm_config") { 26 visibility = [ ":*" ] 27 include_dirs = [ 28 "../../../services/edm/include", 29 "../../../services/edm/include/connection", 30 "../../../services/edm/include/database", 31 "../../../services/edm/include/strategy", 32 "../../../services/edm_plugin/include/utils", 33 "../../../framework/extension/include", 34 "../../../services/edm_plugin/include", 35 "../../../services/edm_plugin/include/network", 36 "../../../services/edm_plugin/include/network/executer", 37 "../../../services/edm_plugin/include/network/rule", 38 "../../../services/edm_plugin/include/utils", 39 ] 40} 41 42ohos_static_library("edmservice_fuzz_static") { 43 testonly = true 44 sources = [ 45 "../../../services/edm/src/admin.cpp", 46 "../../../services/edm/src/admin_manager.cpp", 47 "../../../services/edm/src/admin_policies_storage_rdb.cpp", 48 "../../../services/edm/src/application_state_observer.cpp", 49 "../../../services/edm/src/connection/enterprise_admin_connection.cpp", 50 "../../../services/edm/src/connection/enterprise_admin_proxy.cpp", 51 "../../../services/edm/src/connection/enterprise_bundle_connection.cpp", 52 "../../../services/edm/src/connection/enterprise_conn_manager.cpp", 53 "../../../services/edm/src/connection/enterprise_update_connection.cpp", 54 "../../../services/edm/src/database/edm_rdb_data_manager.cpp", 55 "../../../services/edm/src/database/edm_rdb_open_callback.cpp", 56 "../../../services/edm/src/device_policies_storage_rdb.cpp", 57 "../../../services/edm/src/enterprise_device_mgr_ability.cpp", 58 "../../../services/edm/src/enterprise_device_mgr_stub.cpp", 59 "../../../services/edm/src/permission_manager.cpp", 60 "../../../services/edm/src/plugin_manager.cpp", 61 "../../../services/edm/src/policy_manager.cpp", 62 "../../../services/edm/src/strategy/enhance_execute_strategy.cpp", 63 "../../../services/edm/src/strategy/replace_execute_strategy.cpp", 64 "../../../services/edm/src/strategy/single_execute_strategy.cpp", 65 "../../../services/edm/src/super_admin.cpp", 66 "../../../services/edm/src/user_policy_manager.cpp", 67 "../../../services/edm_plugin/src/utils/install_param_serializer.cpp", 68 "../../../services/edm_plugin/src/utils/installer_callback.cpp", 69 "../../../services/edm_plugin/src/utils/operate_device_param_serializer.cpp", 70 "../../../services/edm_plugin/src/utils/uninstall_param_serializer.cpp", 71 ] 72 73 public_configs = [ 74 ":edm_config", 75 "../../../common/config:coverage_flags", 76 ] 77 78 defines = [] 79 80 if (target_cpu == "arm64") { 81 defines += [ "_ARM64_" ] 82 print("defines _ARM64_") 83 } 84 85 if (target_cpu == "x86_64") { 86 defines += [ "_X86_64_" ] 87 print("defines _X86_64_") 88 } 89 90 defines += [ "EDM_FUZZ_TEST" ] 91 defines += [ "COMMON_EVENT_SERVICE_EDM_ENABLE" ] 92 93 public_external_deps = [ 94 "ability_base:want", 95 "ability_runtime:app_manager", 96 "ability_runtime:extension_manager", 97 "ability_runtime:wantagent_innerkits", 98 "access_token:libaccesstoken_sdk", 99 "access_token:libtokenid_sdk", 100 "bundle_framework:appexecfwk_base", 101 "bundle_framework:appexecfwk_core", 102 "cJSON:cjson", 103 "c_utils:utils", 104 "hilog:libhilog", 105 "init:libbegetutil", 106 "ipc:ipc_core", 107 "jsoncpp:jsoncpp", 108 "relational_store:native_rdb", 109 "safwk:system_ability_fwk", 110 "window_manager:libwm", 111 ] 112 113 external_deps = [ 114 "ability_base:want", 115 "ability_runtime:app_manager", 116 "ability_runtime:extension_manager", 117 "access_token:libaccesstoken_sdk", 118 "access_token:libtokenid_sdk", 119 "bundle_framework:appexecfwk_base", 120 "cJSON:cjson", 121 "c_utils:utils", 122 "common_event_service:cesfwk_innerkits", 123 "hilog:libhilog", 124 "init:libbegetutil", 125 "ipc:ipc_core", 126 "jsoncpp:jsoncpp", 127 "netmanager_base:net_native_manager_if", 128 "relational_store:native_rdb", 129 "safwk:system_ability_fwk", 130 "window_manager:sms", 131 ] 132 133 deps = [ 134 "../../../common/external:edm_external_adapters", 135 "../../../common/native:edm_commom", 136 "../../../interfaces/inner_api:edmservice_kits", 137 "../../../interfaces/inner_api/plugin_kits:plugin_kits", 138 ] 139 140 if (enterprise_device_management_support_all) { 141 defines += [ "EDM_SUPPORT_ALL_ENABLE" ] 142 sources += [ 143 "../../../services/edm_plugin/src/allowed_install_bundles_plugin.cpp", 144 "../../../services/edm_plugin/src/bundle_install_plugin.cpp", 145 "../../../services/edm_plugin/src/disallow_modify_datetime_plugin.cpp", 146 "../../../services/edm_plugin/src/disallowed_install_bundles_plugin.cpp", 147 "../../../services/edm_plugin/src/disallowed_uninstall_bundles_plugin.cpp", 148 "../../../services/edm_plugin/src/get_device_encryption_status_plugin.cpp", 149 "../../../services/edm_plugin/src/get_device_info_plugin.cpp", 150 "../../../services/edm_plugin/src/get_display_version_plugin.cpp", 151 "../../../services/edm_plugin/src/get_security_patch_tag_plugin.cpp", 152 "../../../services/edm_plugin/src/install_plugin.cpp", 153 "../../../services/edm_plugin/src/ntp_server_plugin.cpp", 154 "../../../services/edm_plugin/src/operate_device_plugin.cpp", 155 "../../../services/edm_plugin/src/power_policy_plugin.cpp", 156 "../../../services/edm_plugin/src/screen_off_time_plugin.cpp", 157 "../../../services/edm_plugin/src/uninstall_plugin.cpp", 158 ] 159 160 if (os_account_edm_enable) { 161 external_deps += [ 162 "os_account:libaccountkits", 163 "os_account:os_account_innerkits", 164 ] 165 public_external_deps += [ 166 "os_account:libaccountkits", 167 "os_account:os_account_innerkits", 168 ] 169 sources += [ 170 "../../../services/edm_plugin/src/add_os_account_plugin.cpp", 171 "../../../services/edm_plugin/src/disallow_add_local_account_plugin.cpp", 172 "../../../services/edm_plugin/src/disallow_add_os_account_by_user_plugin.cpp", 173 ] 174 defines += [ "OS_ACCOUNT_EDM_ENABLE" ] 175 } 176 177 if (screenlock_mgr_edm_enable) { 178 external_deps += [ "screenlock_mgr:screenlock_client" ] 179 public_external_deps += [ "screenlock_mgr:screenlock_client" ] 180 sources += [ "../../../services/edm_plugin/src/lock_screen_plugin.cpp" ] 181 } 182 183 if (power_manager_edm_enable && screenlock_mgr_edm_enable) { 184 external_deps += [ "power_manager:powermgr_client" ] 185 public_external_deps += [ "power_manager:powermgr_client" ] 186 sources += [ 187 "../../../services/edm_plugin/src/reboot_plugin.cpp", 188 "../../../services/edm_plugin/src/shutdown_plugin.cpp", 189 ] 190 } 191 192 if (update_service_edm_enable) { 193 external_deps += [ "update_service:updateservicekits" ] 194 public_external_deps += [ "update_service:updateservicekits" ] 195 sources += [ "../../../services/edm_plugin/src/reset_factory_plugin.cpp" ] 196 } 197 198 if (wifi_edm_enable) { 199 external_deps += [ "wifi:wifi_sdk" ] 200 public_external_deps += [ "wifi:wifi_sdk" ] 201 sources += [ 202 "../../../services/edm_plugin/src/is_wifi_active_plugin.cpp", 203 "../../../services/edm_plugin/src/set_wifi_disabled_plugin.cpp", 204 "../../../services/edm_plugin/src/set_wifi_profile_plugin.cpp", 205 "../../../services/edm_plugin/src/utils/wifi_device_config_serializer.cpp", 206 ] 207 defines += [ "WIFI_EDM_ENABLE" ] 208 } 209 210 if (netmanager_base_edm_enable && netmanager_ext_edm_enable) { 211 external_deps += [ 212 "netmanager_base:net_conn_manager_if", 213 "netmanager_base:net_policy_manager_if", 214 "netmanager_base:netsys_controller", 215 "netmanager_ext:ethernet_manager_if", 216 ] 217 public_external_deps += [ 218 "netmanager_base:net_conn_manager_if", 219 "netmanager_base:netsys_controller", 220 "netmanager_ext:ethernet_manager_if", 221 ] 222 sources += [ 223 "../../../services/edm_plugin/src/disabled_network_interface_plugin.cpp", 224 "../../../services/edm_plugin/src/domain_filter_rule_plugin.cpp", 225 "../../../services/edm_plugin/src/firewall_rule_plugin.cpp", 226 "../../../services/edm_plugin/src/get_all_network_interfaces_plugin.cpp", 227 "../../../services/edm_plugin/src/get_ip_address_plugin.cpp", 228 "../../../services/edm_plugin/src/get_mac_plugin.cpp", 229 "../../../services/edm_plugin/src/global_proxy_plugin.cpp", 230 "../../../services/edm_plugin/src/iptables_rule_plugin.cpp", 231 "../../../services/edm_plugin/src/network/executer/domain_executer.cpp", 232 "../../../services/edm_plugin/src/network/executer/executer_factory.cpp", 233 "../../../services/edm_plugin/src/network/executer/executer_utils.cpp", 234 "../../../services/edm_plugin/src/network/executer/firewall_executer.cpp", 235 "../../../services/edm_plugin/src/network/executer/iexecuter.cpp", 236 "../../../services/edm_plugin/src/network/iptables_manager.cpp", 237 "../../../services/edm_plugin/src/network/rule/chain_rule.cpp", 238 "../../../services/edm_plugin/src/network/rule/domain_chain_rule.cpp", 239 "../../../services/edm_plugin/src/network/rule/firewall_chain_rule.cpp", 240 "../../../services/edm_plugin/src/network/rule/rule_utils.cpp", 241 "../../../services/edm_plugin/src/utils/domain_filter_rule_serializer.cpp", 242 "../../../services/edm_plugin/src/utils/firewall_rule_serializer.cpp", 243 "../../../services/edm_plugin/src/utils/http_proxy_serializer.cpp", 244 ] 245 } 246 247 if (ability_runtime_edm_enable) { 248 external_deps += [ "ability_runtime:ability_manager" ] 249 public_external_deps += [ "ability_runtime:ability_manager" ] 250 sources += [ 251 "../../../services/edm_plugin/src/disallowed_running_bundles_plugin.cpp", 252 "../../../services/edm_plugin/src/manage_auto_start_apps_plugin.cpp", 253 ] 254 } 255 256 if (certificate_manager_edm_enable) { 257 external_deps += [ "certificate_manager:cert_manager_sdk" ] 258 public_external_deps += [ "certificate_manager:cert_manager_sdk" ] 259 sources += [ "../../../services/edm_plugin/src/user_cert_plugin.cpp" ] 260 } 261 262 if (drivers_interface_usb_edm_enable && usb_manager_edm_enable) { 263 external_deps += [ "usb_manager:usbsrv_client" ] 264 public_external_deps += [ "usb_manager:usbsrv_client" ] 265 sources += [ 266 "../../../services/edm_plugin/src/allowed_usb_devices_plugin.cpp", 267 "../../../services/edm_plugin/src/disable_usb_plugin.cpp", 268 "../../../services/edm_plugin/src/utils/array_usb_device_id_serializer.cpp", 269 "../../../services/edm_plugin/src/utils/array_usb_device_type_serializer.cpp", 270 ] 271 } 272 273 if (drivers_interface_usb_edm_enable && storage_service_edm_enable && 274 usb_manager_edm_enable) { 275 external_deps += [ "storage_service:storage_manager_sa_proxy" ] 276 public_external_deps += [ "storage_service:storage_manager_sa_proxy" ] 277 sources += [ "../../../services/edm_plugin/src/usb_read_only_plugin.cpp" ] 278 } 279 280 if (audio_framework_edm_enable) { 281 external_deps += [ "audio_framework:audio_client" ] 282 public_external_deps += [ "audio_framework:audio_client" ] 283 sources += [ 284 "../../../services/edm_plugin/src/disable_hdc_plugin.cpp", 285 "../../../services/edm_plugin/src/disable_microphone_plugin.cpp", 286 "../../../services/edm_plugin/src/disable_printer_plugin.cpp", 287 ] 288 } 289 290 if (common_event_service_edm_enable) { 291 external_deps += [ "common_event_service:cesfwk_innerkits" ] 292 public_external_deps += [ "common_event_service:cesfwk_innerkits" ] 293 sources += 294 [ "../../../services/edm_plugin/src/set_browser_policies_plugin.cpp" ] 295 defines += [ "COMMON_EVENT_SERVICE_EDM_ENABLE" ] 296 } 297 298 if (bluetooth_edm_enable) { 299 external_deps += [ "bluetooth:btframework" ] 300 public_external_deps += [ "bluetooth:btframework" ] 301 sources += [ 302 "../../../services/edm_plugin/src/allowed_bluetooth_devices_plugin.cpp", 303 "../../../services/edm_plugin/src/disable_bluetooth_plugin.cpp", 304 "../../../services/edm_plugin/src/get_bluetooth_info_plugin.cpp", 305 ] 306 } 307 308 if (location_edm_enable) { 309 external_deps += [ "location:locator_sdk" ] 310 public_external_deps += [ "location:locator_sdk" ] 311 sources += 312 [ "../../../services/edm_plugin/src/location_policy_plugin.cpp" ] 313 } 314 315 if (telephony_core_edm_enable) { 316 external_deps += [ "core_service:tel_core_service_api" ] 317 public_external_deps += [ "core_service:tel_core_service_api" ] 318 defines += [ "TELEPHONY_CORE_EDM_ENABLE" ] 319 } 320 } 321 322 if (pasteboard_edm_enable) { 323 external_deps += [ "pasteboard:pasteboard_client" ] 324 sources += [ 325 "../../../services/edm_plugin/src/utils/clipboard_policy_serializer.cpp", 326 "../../../services/edm_plugin/src/utils/clipboard_utils.cpp", 327 ] 328 } 329 330 if (useriam_edm_enable) { 331 external_deps += [ "user_auth_framework:userauth_client" ] 332 defines += [ "USERIAM_EDM_ENABLE" ] 333 sources += [ 334 "../../../services/edm_plugin/src/fingerprint_auth_plugin.cpp", 335 "../../../services/edm_plugin/src/password_policy_plugin.cpp", 336 "../../../services/edm_plugin/src/utils/fingerprint_policy_serializer.cpp", 337 "../../../services/edm_plugin/src/utils/password_policy_serializer.cpp", 338 ] 339 } 340 341 sanitize = { 342 boundary_sanitize = true 343 cfi = true 344 cfi_cross_dso = true 345 debug = false 346 integer_overflow = true 347 ubsan = true 348 } 349 branch_protector_ret = "pac_ret" 350 subsystem_name = "customization" 351 part_name = "enterprise_device_management" 352} 353 354ohos_fuzztest("EnterpriseDeviceMgrStubMockFuzzTest") { 355 module_out_path = module_output_path 356 357 fuzz_config_file = "." 358 359 cflags = [ 360 "-g", 361 "-fno-omit-frame-pointer", 362 ] 363 364 include_dirs = [ 365 "../common/include", 366 "../../unittest/utils/include", 367 "../../../interfaces/inner_api/common/include", 368 "../../../interfaces/inner_api/device_settings/include", 369 ] 370 371 sources = [ 372 "../common/src/common_fuzzer.cpp", 373 "enterprise_device_mgr_stub_mock_fuzzer.cpp", 374 ] 375 376 configs = [ "../../../common/config:coverage_flags" ] 377 378 deps = [ 379 ":edmservice_fuzz_static", 380 "../../../common/external:edm_external_adapters", 381 "../../../common/native:edm_commom", 382 "../../../interfaces/inner_api/plugin_kits:plugin_kits", 383 "../../unittest/utils:edm_unittest_utils", 384 ] 385 386 external_deps = [ 387 "ability_base:want", 388 "ability_runtime:app_manager", 389 "access_token:libaccesstoken_sdk", 390 "access_token:libnativetoken", 391 "access_token:libtoken_setproc", 392 "bundle_framework:appexecfwk_base", 393 "bundle_framework:appexecfwk_core", 394 "c_utils:utils", 395 "hilog:libhilog", 396 "init:libbegetutil", 397 "ipc:ipc_core", 398 "relational_store:native_rdb", 399 "safwk:system_ability_fwk", 400 "samgr:samgr_proxy", 401 ] 402 403 subsystem_name = "customization" 404 part_name = "enterprise_device_management" 405} 406