| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
cli不支持发布自定义通知类型 Co-Authored-By:Agent Signed-off-by: xdongs2009 <xdongs@163.com> | 28 天前 | |
cli工具问题单修复 Co-Authored-By:Agent Signed-off-by: xdongs2009 <xdongs@163.com> | 30 天前 | |
!4873 merge Step-JsonExceptionHandle into master fix: harden JSON parsing with type validation to prevent crashes from invalid data Created-by: stepend98 Commit-by: stepend98 Merged-by: openharmony_ci Description: ## 变更说明 通知子系统在多处 JSON 解析路径中,直接使用 nlohmann::json::get<T>() 提取值而未预先校验类型,或使用抛异常版本的 json::parse()。当传入非法/畸形 JSON 数据时,会触发异常导致服务崩溃。 本次变更全面加固 JSON 解析的健壮性,防止非法数据导致崩溃。 ## 变更范围 ### 框架层 (frameworks/ans/src/) - notification_basic_content.cpp:structuredText 数组元素增加 is_string() 校验 - notification_check_info.cpp:改用非抛异常 json::parse + is_discarded() 校验,增加空串/非对象校验 - notification_content.cpp:增加 contentType/content 字段 contains() 校验 - notification_disable.cpp:bundleList 逐元素 is_string() 校验 - notification_distributed_options.cpp:devicesSupportDisplay/Operate 逐元素校验 - notification_icon_button.cpp:iconResource/iconImage 增加 is_string() 校验 - notification_live_view_content.cpp:pictureArray 逐元素 is_string() 校验 - notification_local_live_view_button.cpp:names 逐元素 is_string() 校验 - notification_local_live_view_content.cpp:flags 逐元素 is_number_integer() 校验 - notification_media_content.cpp:sequenceNumbers 逐元素校验 - notification_multiline_content.cpp:allLines/lineWantAgents 逐元素校验 - notification_user_input.cpp:options/permitMimeTypes 逐元素校验 ### 公共接口 (interfaces/inner_api/) - notification_json_convert.h:改用非抛异常 json::parse + is_discarded() 校验 ### 服务端 (services/ans/src/) - notification_config_parse.cpp:所有 get<uint32_t>()/get<bool>() 增加类型校验;notificationService 字段增加 is_object() 校验;数组解析改为逐元素校验 - notification_preferences.cpp:bundleNames/kioskAppTrustList/trustList/deviceTypes 逐元素 is_string() 校验 - notification_preferences_database.cpp:trustList 逐元素校验 - notification_rdb_data_mgr.cpp:UpdateContentByJsonObject 修正字段访问顺序,增加 is_object() 校验;json::parse 改用非抛异常版本 + is_discarded() 校验 - smart_reminder_center.cpp:notificationService 字段增加 is_object() 校验 ### 领域层 (services/domain/) - on_rdb_upgrade_liveview_migrate.cpp:liveviewObj 增加 is_object() 校验 ### 工具 (tools/) - command_output.cpp:json::dump() 使用 error_handler_t::replace 容错模式 - notification_shell_command.cpp:json::parse 改用非抛异常版本 + is_discarded() 校验;字段取值增加类型校验 ### 测试 - 为以上所有场景补充单元测试,覆盖非法 JSON、类型不匹配、字段缺失等场景 - 配置解析测试中将 auto* 改为 auto,匹配 GetInstance() 返回类型 ## 验证 - 构建目标:distributed_notification_service - 单元测试:distributed_notification_service_unit_test Fixes #4219 See merge request: openharmony/notification_distributed_notification_service!4873 | 24 天前 | |
cli工具问题单修复 Co-Authored-By:Agent Signed-off-by: xdongs2009 <xdongs@163.com> | 30 天前 | |
update: 更新文件 BUILD.gn Signed-off-by: hanwenhui <hanwenhui2@h-partners.com> | 2 天前 | |
cli不支持发布自定义通知类型 Co-Authored-By:Agent Signed-off-by: xdongs2009 <xdongs@163.com> | 28 天前 |