| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
zhishi Signed-off-by: xialiangwei <xialiangwei1@huawei.com> | 19 天前 | |
perf(build): enable size_optimize_config on 130 SO targets Add a new services/common:size_optimize_config (same flags as optimize_config minus the explicit -flto=full, so the toolchain's global ThinLTO mode is preserved) and apply it to the 130 ohos_shared_library targets that previously shipped without any optimization config, so unreferenced functions/data are dropped at link time and ROM shrinks without overriding the global LTO policy. -Wl,--gc-sections is an ELF-only linker flag: Apple ld rejects it, so both optimize_config and size_optimize_config now add it only when current_os != "mac", keeping the darwin SDK host build (which links dylibs with -dead_strip) working. Co-Authored-By: Agent Signed-off-by: RuiChen_01 <chenrui193@huawei.com> AI[100%] Human Fixed[0%] Human[0%] AI Adopted[100%] Co-authored-by: claude (glm-5.3) <ai@local> | 29 天前 | |
!20294 merge fix_bug into master fix/UAFbug&double free&Null Pointer Dereference Created-by: hiAlang Commit-by: Alang Merged-by: openharmony_ci Description: **IssueNo**:https://gitcode.com/openharmony/ability_ability_runtime/issues/16057 **Description**: **稳定性自检:** | 自检项 | 自检结果 | | ------------------------------------------------------------ | -------- | | 涉及跨进程调用的相关操作需要抛至主线程或加锁防止并发 | | | 成员变量进行赋值或创建需要排查并发 | | | 谨慎在lambda表达式中使用引用捕获 | | | 谨慎在未经拷贝的情况下使用外部传入的string、C字符串 | | | map\vector\list\set等stl模板类使用时需要排查并发 | | | 谨慎考虑加锁范围 | | | 在IPC通信中谨慎使用同步通信方式 | | | 禁止传递this指针至其他模块或线程(特别是eventhandler任务) | | | 禁止将外部传入的裸指针在内部直接构造智能指针 | | | 禁止多个独立创建的智能指针管理同一地址 | | | 禁止在析构函数中抛异步任务 | | | 禁止js对象在非js线程(例如在IPC线程)创建、使用或销毁 | | | 禁止在对外接口中未经判空直接使用外部传入的指针 | | | 禁止接口返回局部变量引用 | | | 禁止在信号函数中加锁 | | | 禁止在关键流程(SA启动、应用启动等主流程)执行耗时的操作 | | | 禁止将同一个cpp编译在不同的so中 | | **安全编码自检:** | 自检项 | 自检结果 | | -------------------------------------------------------------- | -------- | | 裸指针避免通过隐式转换构造为sptr | | | json对象在取值之前必须先判断类型,避免类型不匹配 | | | 序列化时必须对传入的数组大小进行校验,避免出现超大数组 | | | 避免使用未明确位宽的整型,选择使用int8_t、uint8_t等类型 | | | 外部传入的路径要做规范化校验,对路径中的.、..、../等特殊字符严格校验 | | | 指针变量、表示资源描述符的变量、bool变量必须赋初值 | | | readParcelable获取的对象使用前需要判空 | | | 分配和释放内存的函数需要成对出现 | | | 申请内存后异常退出前需要及时进行内存释放 | | | 内存申请前必须对内存大小进行合法性校验 | | | 内存分配后必须判断是否成功 | | | 禁止使用realloc、alloca函数 | | | 禁止打印文件路径、口令等敏感信息,如有需要,使用private修饰 | | | 禁止打印内存地址 | | | 整数之间运算时必须严格检查,确保不会出现溢出、反转、除0 | | | 禁止对有符号整数进行位操作符运算 | | | 禁止对指针进行逻辑或位运算 | | | 循环次数如果收外部数据控制,需要检验其合法性 | | | 禁止使用内存操作类危险函数,需要使用安全函数 | | | 谨慎使用不可重入函数 | | | 必须检查安全函数的返回值,并进行正确处理 | | | 禁止仅通过TokenType类型判断绕过权限校验 | | **TDD Result**: **XTS Result**: ### 是否已执行L0用例 - [ ] 已验证 - [ ] 不涉及。如不涉及,请写明理由 ### AI检视评分(使用本地代码检视skills扫描): # 代码检视报告 — PR #20294 diff(Round 1 / 最新提交) > 检视对象: /tmp/opencode/pr_20294.diff(来自 https://gitcode.com/openharmony/ability_ability_runtime/pull/20294.diff)。 > 本 PR 为"空指针解引用修复 + dlopen/dlsym 浅拷贝修复"防御性加固批次,横跨 agent_runtime_framework/、frameworks/c/、frameworks/native/、interfaces/inner_api/、services/、test/。 --- ## 报告元数据 <!-- codecheck-report-metadata:start --> yaml codecheck_report: schema_version: "1.0" scope: "PR #20294 diff (null-deref hardening + dlopen/deepcopy fix)" round: 1 commit_id: "d8f40826b30b1a23037f2593ace13126b516190a" change_id: "Ic8c8cf81f98abb2ec520b9ca952a546c56ed9b24" report_id: "Ic8c8cf81f98abb2ec520b9ca952a546c56ed9b24-R1" date: "2026-09-01" gate_decision: "approve" risk_level: "low" score: 92 dimensions_required: ["security", "logic", "input"] dimensions_executed: ["security", "logic", "input"] findings_total: 4 findings_by_severity: { "P0": 0, "P1": 0, "P2": 0, "P3": 4 } gate_blockers: [] must_fix: [] followups: ["F-LOG-001", "F-SEC-002", "F-LOG-003", "F-DFX-004"] <!-- codecheck-report-metadata:end --> --- ## 1. 门禁结论 | 项目 | 结论 | |---|---| | 决策 | **approve** | | 风险等级 | 🟢 low | | 评分 | **92/100** | | 阻塞项 | 无 P0/P1 | | 必须修复(P0/P1) | 0 项 | | 建议跟进(P2/P3) | 4 项 | **一句话结论**:本 PR 主体是正确的防御性加固(DeepCopyStorage 浅拷贝 UAF 修复、LoadConnectServerDebuggerSo 返 bool 防 dlsym(nullptr) footgun、一批 null deref 修复均正确,嵌套-if 范式经 SE 检视确认)。F-LOG-001 经复核降为 P3(OnProcessKilled 跳过的仅是一条与 appInfo 无关的 info 日志,无崩溃,非功能性回归,SE 已检视接受)。无 P0/P1,无 P2,门禁通过。 --- ## 2. 扣分原因 > gate_decision=approve,本节省略。共 4 个 P3,扣 8 分,得分 92。 --- ## 3. 必须立即处理(P0/P1) **无。** > 最初怀疑 DestroyImageByCheckpointId 删 return 后会 null-deref(落到 OnImageProcessStateChanged(imageInfo, …)),经 Refute 证伪:WrapImageProcessStateData(app_state_observer_manager.cpp:1793)对 imageInfo null 有守卫返回 nullptr,OnImageProcessStateChanged:1817 对 nullptr 再守卫;KillImageProcess(:988)只用 checkpointId 不碰 imageInfo。全链 null-safe,无崩溃,故无 P1。 --- ## 4. 建议本轮或下一补档处理(P2/P3) | ID | 优先级 | 问题 | 建议行动 | 排期 | |---|---|---|---|---| | F-LOG-001 | P3 | OnProcessKilled early-return(:239-241)跳过 :250 的 TAG_LOGI("%{public}s is killed, …"),该日志用 appRecord->GetName()+PrintCacheQueue(),**与 appInfo 无关**;本 PR 在 CheckAndCacheProcess:139-150、AbilityTerminated:1206-1216 用嵌套-if,此处用 early-return。**经复核:跳过的仅是 info 日志,非功能性赋值,无崩溃;SE 已检视接受** | 可选:改成嵌套 if 与兄弟函数范式一致(让 :250 日志照常);现状无功能影响 | 可选/下一补档 | | F-SEC-002 | P3 | DestroyImageByCheckpointId 删 early-return 后,对不存在的 checkpointId 现在走到 KillImageProcess+OnImageProcessStateChanged 并返回 ERR_OK(原返回 ERR_IMAGE_INFO_NOT_EXIST)。注释 //There must be no return; 表明有意(幂等 destroy)。无崩溃(下游 null-safe),但返回值语义变了 | 确认调用方是否依赖 ERR_IMAGE_INFO_NOT_EXIST 区分"无可销毁";若需要保留区分,在 RemoveImageInfoByCheckpointId 后按 imageInfo 是否原本存在分别返回;否则文档化幂等语义 | 下一补档 | | F-LOG-003 | P3 | JudgeAppSelfCalled(app_mgr_service.cpp:1528)条件里 appRecord->GetApplicationInfo() 调了两次:一次判空、一次取 accessTokenId | 缓存为局部变量 auto appInfo = appRecord->GetApplicationInfo(); if (appRecord == nullptr || appInfo == nullptr || appInfo->accessTokenId != callingTokenId) {…} | 下一补档 | | F-DFX-004 | P3 | AbilityTerminated/CheckAndCacheProcess/OnProcessKilled 的 hisysevent 块在 null-appInfo 时整段跳过,连 state/eventState/EVENT_KEY_SUPPORT_STATE 等**与 appInfo 无关**的字段也一并丢 | 若 DFX 要求即使 appInfo 缺失也上报 state,把 state 字段提到外层、appInfo 字段单独嵌套;属增量优化,不影响本次正确性 | 下一补档 | --- ## 5. 分维度速览 | 维度 | 结果 | 关键说明 | |---|---|---| | security | ✅ 通过 | DeepCopyStorage 浅拷贝 UAF 修复正确(memset_s 只拷 vt + 分类型深拷贝 + 标量 else 分支);LoadConnectServerDebuggerSo 返 bool + 7 处调用方判空,防 dlsym(nullptr)→RTLD_DEFAULT 撞库;StoreDebuggerInfo 的 vm null 守卫保留(正确,公共 inner_api + 防全局 map 污染);一批 GetToken()/abilityInfo/spawnClient null deref 修复均正确。无新增 null deref( DestroyImageByCheckpointId 的 P1 候选已证伪)。 | | logic | ⚠️ 1×P2 + 1×P3 | OnProcessKilled 的 early-return 与 PR 内兄弟函数嵌套-if 范式不一致且跳过无关日志(F-LOG-001);DestroyImageByCheckpointId 删 return 引入返回值语义变更(F-SEC-002)。其余 hisysevent 块的嵌套-if、ShrinkAndKillCache 的 KillProcessByRecord + continue、mission/ui_ability_lifecycle 的 GetToken() && 短路守卫均逻辑正确。 | | input | ✅ 通过 | HandleAttachApplication 对 ReadRemoteObject() 返回 null 现改为 return ERR_INVALID_VALUE(原仅日志后仍调 AttachApplication(null),是改进);GetChildProcessInfoForSelf 对 ReadParcelable<ChildProcessInfo> 返回 null 加判空。无新增外部输入解析面,均为既有 IPC 输入的防御加固。 | > 排除说明:按编排器约定,ets_*.cpp/cj_*.cpp 静态语言绑定层默认排除深扫(ets_agent_extension.cpp、cj_ui_ability.cpp、cj_photo_editor_extension.cpp 等)。观察到这些文件的改动均为机械式 null 守卫添加(null etsObj_/cjAbilityObj_/abilityInfo),风险低;如需深扫请明确要求包含。 --- ## 6. 关键发现详情 ### [F-LOG-001] OnProcessKilled early-return 跳过无关日志(经复核降级,SE 已检视) (P3, scanner=logic) - **位置**:services/appmgr/src/cache_process_manager.cpp:239-241(及被跳过的 :250-251) - **触发路径**:OnProcessKilled(appRecord) → appInfo = appRecord->GetApplicationInfo() 返回 null → if (appInfo == nullptr) { TAG_LOGE; return; } 提前返回 → :250 的 TAG_LOGI("%{public}s is killed, %{public}s", appRecord->GetName().c_str(), PrintCacheQueue().c_str()) 被跳过。 - **影响**::250 这条日志只用 appRecord(已在 :223-226 precheck 非空)和 PrintCacheQueue(),**不依赖 appInfo**,却被 early-return 连坐跳过 → null-appInfo 路径下丢失"X is killed"诊断日志(DFX 信号缺失)。**经复核降级**:跳过的是 info 日志而非功能性赋值,**无崩溃、无功能回归**(对比 GetRunningProcess/AbilityTerminated 那类跳过功能性赋值会导致崩溃,本处不同)。SE 已检视本批次并接受。 - **证据**:cache_process_manager.cpp:239-241 early-return;:250-251 被跳过日志用 appRecord->GetName()/PrintCacheQueue() 不碰 appInfo;对照 cache_process_manager.cpp:139-150(CheckAndCacheProcess)与 app_running_record.cpp:1206-1216(AbilityTerminated)的嵌套-if(那两处跳过的是功能性赋值,嵌套-if 是必需;本处非必需)。 - **建议**:可选——改成嵌套 if 与兄弟函数范式一致(让 :250 日志照常执行);现状无功能影响,SE 接受,不阻塞合入。 ### [F-SEC-002] DestroyImageByCheckpointId 删 return 引入返回值语义变更 (P3, scanner=security/logic) - **位置**:services/appmgr/src/app_mgr_service_inner.cpp:869-875 - **触发路径**:DestroyImageByCheckpointId(checkpointId) → GetImageInfoByCheckPointId 返回 null → 原 return ERR_IMAGE_INFO_NOT_EXIST 被删(注释 //There must be no return;)→ fall-through 到 RemoveImageInfoByCheckpointId + KillImageProcess + OnImageProcessStateChanged(imageInfo=nullptr, …) → 最终返回 ERR_OK。 - **影响**:无崩溃——KillImageProcess:988 只用 checkpointId;OnImageProcessStateChanged:1816→WrapImageProcessStateData:1793 对 imageInfo null 守卫返回 nullptr,:1817 再守卫。但**返回值语义变了**:对不存在的 checkpoint,由 ERR_IMAGE_INFO_NOT_EXIST 变为 ERR_OK(幂等 destroy)。若调用方依赖原错误码区分"无可销毁",行为改变;若意图就是幂等,则符合注释。 - **证据**:app_mgr_service_inner.cpp:869-875 删 return;app_state_observer_manager.cpp:1793 null 守卫;app_mgr_service_inner.cpp:988-1009 KillImageProcess 不碰 imageInfo。 - **建议**:确认调用方对 ERR_IMAGE_INFO_NOT_EXIST 的依赖;若需保留区分,在 fall-through 后按 imageInfo 原本是否存在分别返回;否则在 PR description 文档化幂等语义。 ### [F-LOG-003] JudgeAppSelfCalled 重复调用 GetApplicationInfo (P3, scanner=logic) - **位置**:services/appmgr/src/app_mgr_service.cpp:1528-1530 - **触发路径**:条件 appRecord == nullptr || appRecord->GetApplicationInfo() == nullptr || ((appRecord->GetApplicationInfo())->accessTokenId) != callingTokenId 中 GetApplicationInfo() See merge request: openharmony/ability_ability_runtime!20294 | 18 天前 | |
bti Signed-off-by: Luobniz21 <luoyicong@h-partners.com> 🤖 AI[100%] 🔧 Human Fixed[0%] 🧑 Human[0%] 👌 AI Adopted[100%] Co-authored-by: opencode (glm-5.2) <ai@local> | 1 个月前 | |
补充查询子进程的接口 Signed-off-by: SKY2001 <songtianyu10@huawei.com> AI[47%] Human Fixed[0%] Human[53%] AI Adopted[100%] | 28 天前 | |
fix_bug/add return bool in function LoadConnectServerDebuggerSo Signed-off-by: Alang <gaoyulang@huawei.com> AI[100%] Human Fixed[0%] Human[0%] AI Adopted[100%] Co-authored-by: opencode (glm-5.2) <ai@local> Change-Id: If80dd41af626c4e0311cc8acc87da3fee9d682f8 | 19 天前 | |
bti Signed-off-by: Luobniz21 <luoyicong@h-partners.com> 🤖 AI[100%] 🔧 Human Fixed[0%] 🧑 Human[0%] 👌 AI Adopted[100%] Co-authored-by: opencode (glm-5.2) <ai@local> | 1 个月前 | |
utils_0820 Signed-off-by: Luobniz21 <luoyicong@h-partners.com> 🤖 AI[100%] 🔧 Human Fixed[0%] 🧑 Human[0%] 👌 AI Adopted[100%] Co-authored-by: opencode (glm-5.2) <ai@local> | 1 个月前 | |
!20277 merge bugfix/agent-card-multiuser into master bugfix: OTA missing 101's AgentCards Created-by: yangxuguang-huawei Commit-by: yangxuguang-huawei Merged-by: openharmony_ci Description: **IssueNo**: https://gitcode.com/openharmony/ability_ability_runtime/issues/16036 **Description**: **稳定性自检:** | 自检项 | 自检结果 | | ------------------------------------------------------------ | -------- | | 涉及跨进程调用的相关操作需要抛至主线程或加锁防止并发 | ok | | 成员变量进行赋值或创建需要排查并发 | ok| | 谨慎在lambda表达式中使用引用捕获 | ok| | 谨慎在未经拷贝的情况下使用外部传入的string、C字符串 | ok| | map\vector\list\set等stl模板类使用时需要排查并发 | ok| | 谨慎考虑加锁范围 | ok| | 在IPC通信中谨慎使用同步通信方式 | ok| | 禁止传递this指针至其他模块或线程(特别是eventhandler任务) | ok| | 禁止将外部传入的裸指针在内部直接构造智能指针 | ok| | 禁止多个独立创建的智能指针管理同一地址 | ok| | 禁止在析构函数中抛异步任务 | ok| | 禁止js对象在非js线程(例如在IPC线程)创建、使用或销毁 | ok| | 禁止在对外接口中未经判空直接使用外部传入的指针 | ok| | 禁止接口返回局部变量引用 | ok| | 禁止在信号函数中加锁 | ok| | 禁止在关键流程(SA启动、应用启动等主流程)执行耗时的操作 | ok| | 禁止将同一个cpp编译在不同的so中 | ok| **安全编码自检:** | 自检项 | 自检结果 | | -------------------------------------------------------------- | -------- | | 裸指针避免通过隐式转换构造为sptr | ok| | json对象在取值之前必须先判断类型,避免类型不匹配 | ok| | 序列化时必须对传入的数组大小进行校验,避免出现超大数组 | ok | | 避免使用未明确位宽的整型,选择使用int8_t、uint8_t等类型 | ok| | 外部传入的路径要做规范化校验,对路径中的.、..、../等特殊字符严格校验 | ok | | 指针变量、表示资源描述符的变量、bool变量必须赋初值 | ok| | readParcelable获取的对象使用前需要判空 | ok| | 分配和释放内存的函数需要成对出现 | ok| | 申请内存后异常退出前需要及时进行内存释放 | ok | | 内存申请前必须对内存大小进行合法性校验 | ok| | 内存分配后必须判断是否成功 | ok| | 禁止使用realloc、alloca函数 | ok| | 禁止打印文件路径、口令等敏感信息,如有需要,使用private修饰 | ok| | 禁止打印内存地址 | ok| | 整数之间运算时必须严格检查,确保不会出现溢出、反转、除0 | ok| | 禁止对有符号整数进行位操作符运算 | ok| | 禁止对指针进行逻辑或位运算 | ok| | 循环次数如果收外部数据控制,需要检验其合法性 | ok| | 禁止使用内存操作类危险函数,需要使用安全函数 | ok| | 谨慎使用不可重入函数 | ok| | 必须检查安全函数的返回值,并进行正确处理 | ok| | 禁止仅通过TokenType类型判断绕过权限校验 | ok| **TDD Result**: ok **XTS Result**: ok ### 是否已执行L0用例 - [x 已验证 - [ ] 不涉及。如不涉及,请写明理由 ### AI检视评分(使用本地代码检视skills扫描): See merge request: openharmony/ability_ability_runtime!20277 | 28 天前 | |
perf(build): enable size_optimize_config on 130 SO targets Add a new services/common:size_optimize_config (same flags as optimize_config minus the explicit -flto=full, so the toolchain's global ThinLTO mode is preserved) and apply it to the 130 ohos_shared_library targets that previously shipped without any optimization config, so unreferenced functions/data are dropped at link time and ROM shrinks without overriding the global LTO policy. -Wl,--gc-sections is an ELF-only linker flag: Apple ld rejects it, so both optimize_config and size_optimize_config now add it only when current_os != "mac", keeping the darwin SDK host build (which links dylibs with -dead_strip) working. Co-Authored-By: Agent Signed-off-by: RuiChen_01 <chenrui193@huawei.com> AI[100%] Human Fixed[0%] Human[0%] AI Adopted[100%] Co-authored-by: claude (glm-5.3) <ai@local> | 29 天前 | |
utils_0820 Signed-off-by: Luobniz21 <luoyicong@h-partners.com> 🤖 AI[100%] 🔧 Human Fixed[0%] 🧑 Human[0%] 👌 AI Adopted[100%] Co-authored-by: opencode (glm-5.2) <ai@local> | 1 个月前 | |
bti Signed-off-by: Luobniz21 <luoyicong@h-partners.com> 🤖 AI[100%] 🔧 Human Fixed[0%] 🧑 Human[0%] 👌 AI Adopted[100%] Co-authored-by: opencode (glm-5.2) <ai@local> | 1 个月前 | |
fix(insight_intent): guard json::dump against deep-nesting stack overflow nlohmann::json::dump() recurses on nested values; super-deep input causes SIGSEGV stack overflow that try/catch cannot intercept. - Add iterative IsJsonDepthOk walker with JSON_DUMP_MAX_DEPTH (100) bound; SafeDump/SafeDumpTo reject over-depth input before dump(). Definitions live in intent_json_safe_get.cpp, compiled only into the ability_manager innerkit so symbols resolve for libabilityms.so and direct-compiling test/fuzz targets (libabilityms.map hides non-whitelisted symbols). - Switch raw .dump() calls in function_call_convert, execute_result and info_for_query to the safe wrappers; validate inputSchema depth before merge. - Add IsJsonDepthOk boundary tests (under/at/over limit). Co-Authored-By: Agent Signed-off-by: RuiChen_01 <chenrui193@huawei.com> AI[100%] Human Fixed[0%] Human[0%] AI Adopted[100%] Co-authored-by: claude (unknown) <ai@local> Co-authored-by: claude (glm-5.3) <ai@local> Co-authored-by: claude (unknown) <ai@local> Co-authored-by: claude (glm-5.3) <ai@local> Co-authored-by: claude (unknown) <ai@local> Co-authored-by: claude (glm-5.3) <ai@local> Co-authored-by: claude (unknown) <ai@local> Co-authored-by: claude (glm-5.3) <ai@local> Co-authored-by: claude (unknown) <ai@local> | 1 个月前 | |
static_0707 Signed-off-by: Luobniz21 <luoyicong@h-partners.com> | 2 个月前 | |
perf(build): enable size_optimize_config on 130 SO targets Add a new services/common:size_optimize_config (same flags as optimize_config minus the explicit -flto=full, so the toolchain's global ThinLTO mode is preserved) and apply it to the 130 ohos_shared_library targets that previously shipped without any optimization config, so unreferenced functions/data are dropped at link time and ROM shrinks without overriding the global LTO policy. -Wl,--gc-sections is an ELF-only linker flag: Apple ld rejects it, so both optimize_config and size_optimize_config now add it only when current_os != "mac", keeping the darwin SDK host build (which links dylibs with -dead_strip) working. Co-Authored-By: Agent Signed-off-by: RuiChen_01 <chenrui193@huawei.com> AI[100%] Human Fixed[0%] Human[0%] AI Adopted[100%] Co-authored-by: claude (glm-5.3) <ai@local> | 29 天前 | |
update Signed-off-by: majian <majian59@h-partners.com> | 8 个月前 | |
perf(build): enable size_optimize_config on 130 SO targets Add a new services/common:size_optimize_config (same flags as optimize_config minus the explicit -flto=full, so the toolchain's global ThinLTO mode is preserved) and apply it to the 130 ohos_shared_library targets that previously shipped without any optimization config, so unreferenced functions/data are dropped at link time and ROM shrinks without overriding the global LTO policy. -Wl,--gc-sections is an ELF-only linker flag: Apple ld rejects it, so both optimize_config and size_optimize_config now add it only when current_os != "mac", keeping the darwin SDK host build (which links dylibs with -dead_strip) working. Co-Authored-By: Agent Signed-off-by: RuiChen_01 <chenrui193@huawei.com> AI[100%] Human Fixed[0%] Human[0%] AI Adopted[100%] Co-authored-by: claude (glm-5.3) <ai@local> | 29 天前 | |
Add cfi/pac config Co-Authored-By: Agent Signed-off-by: wangzhen <wangzhen416@huawei.com> 🤖 AI[0%] 👌 AI Adopted[0%] 🧑 Human[100%] | 2 个月前 | |
!19862 merge master into master 语境信息表内存优化part1 Created-by: wanghaha1204 Commit-by: wanghaha1204 Merged-by: openharmony_ci Description: **IssueNo**: https://gitcode.com/openharmony/arkcompiler_ets_runtime/issues/13409 **Description**: **稳定性自检:** | 自检项 | 自检结果 | | ------------------------------------------------------------ | -------- | | 涉及跨进程调用的相关操作需要抛至主线程或加锁防止并发 | | | 成员变量进行赋值或创建需要排查并发 | | | 谨慎在lambda表达式中使用引用捕获 | | | 谨慎在未经拷贝的情况下使用外部传入的string、C字符串 | | | map\vector\list\set等stl模板类使用时需要排查并发 | | | 谨慎考虑加锁范围 | | | 在IPC通信中谨慎使用同步通信方式 | | | 禁止传递this指针至其他模块或线程(特别是eventhandler任务) | | | 禁止将外部传入的裸指针在内部直接构造智能指针 | | | 禁止多个独立创建的智能指针管理同一地址 | | | 禁止在析构函数中抛异步任务 | | | 禁止js对象在非js线程(例如在IPC线程)创建、使用或销毁 | | | 禁止在对外接口中未经判空直接使用外部传入的指针 | | | 禁止接口返回局部变量引用 | | | 禁止在信号函数中加锁 | | | 禁止在关键流程(SA启动、应用启动等主流程)执行耗时的操作 | | | 禁止将同一个cpp编译在不同的so中 | | **安全编码自检:** | 自检项 | 自检结果 | | -------------------------------------------------------------- | -------- | | 裸指针避免通过隐式转换构造为sptr | | | json对象在取值之前必须先判断类型,避免类型不匹配 | | | 序列化时必须对传入的数组大小进行校验,避免出现超大数组 | | | 避免使用未明确位宽的整型,选择使用int8_t、uint8_t等类型 | | | 外部传入的路径要做规范化校验,对路径中的.、..、../等特殊字符严格校验 | | | 指针变量、表示资源描述符的变量、bool变量必须赋初值 | | | readParcelable获取的对象使用前需要判空 | | | 分配和释放内存的函数需要成对出现 | | | 申请内存后异常退出前需要及时进行内存释放 | | | 内存申请前必须对内存大小进行合法性校验 | | | 内存分配后必须判断是否成功 | | | 禁止使用realloc、alloca函数 | | | 禁止打印文件路径、口令等敏感信息,如有需要,使用private修饰 | | | 禁止打印内存地址 | | | 整数之间运算时必须严格检查,确保不会出现溢出、反转、除0 | | | 禁止对有符号整数进行位操作符运算 | | | 禁止对指针进行逻辑或位运算 | | | 循环次数如果收外部数据控制,需要检验其合法性 | | | 禁止使用内存操作类危险函数,需要使用安全函数 | | | 谨慎使用不可重入函数 | | | 必须检查安全函数的返回值,并进行正确处理 | | | 禁止仅通过TokenType类型判断绕过权限校验 | | **TDD Result**: **XTS Result**: ### 是否已执行L0用例 - [x] 已验证 - [ ] 不涉及。如不涉及,请写明理由 ### AI检视评分(使用本地代码检视skills扫描): # 代码检视报告 — PR19862-语境信息表内存优化part1(Round 2 / 最新提交) > 统一报告由 codecheck 工作台生成,**用于门禁管控**。本轮使用最新版 orchestrator,执行 security-scanner + logic-scanner 并完成 Refute 对抗性验证。 --- ## 报告元数据 > **门禁脚本只读取本 YAML 块**。字段名与取值域遵循 codecheck_report_TEMPLATE.md 固定合约。 yaml codecheck_report: schema_version: "1.0" scope: "PR19862-语境信息表内存优化part1" round: 2 commit_id: "3edba84fe994f2742e4563a91d3dcdd5970faa85" change_id: "N/A" commit_subject: "语境信息表内存优化part1" date: "2026-08-07" dimensions_required: ["security-scanner", "logic-scanner"] dimensions_executed: ["security-scanner", "logic-scanner"] waived_dimensions: [] findings_total: 0 findings_by_severity: {P0: 0, P1: 0, P2: 0, P3: 0} score: 100 risk_level: "low" gate_decision: "approve" gate_blockers: [] must_fix: [] followups: [] **取值域(唯一合法值)**:risk_level ∈ {low, medium, high, unknown};gate_decision ∈ {approve, conditional, block, insufficient}。 --- ## 1. 基本信息 | 项目 | 值 | |------|-----| | 检视范围 | PR19862-语境信息表内存优化part1 | | commit-id | 3edba84fe994f2742e4563a91d3dcdd5970faa85 | | Change-Id | N/A(提交消息未包含 Change-Id,以完整 commit-id 匹配门禁) | | commit message | 语境信息表内存优化part1 | | 检视日期 | 2026-08-07 | | 检视轮次 | Round 2 | | 检视维度 | security-scanner + logic-scanner | ### 提交内容核对(目标为提交时必填) | 校验项 | 结果 | |--------|------| | 提交范围 | 2 文件(+2/−0):runtime.h 新增默认关闭标志,js_runtime.cpp 向 Ark RuntimeOption 透传 | | 主要变更内容 | 为卡片渲染 VM 标记 isFormRender,使 Ark pkg-context 按卡片 VM 使用 per-VM 存储 | | 提交完整性 | ⚠️ 存在 Signed-off-by;无 Change-Id;完整 SHA 与 PR 当前 HEAD 一致,配套 form_fwk 与 arkcompiler 提交已核对 | ### Scanner 选择记录 | 探测项 | 结果 | |--------|------| | IPC/反序列化信号 | 未新增 | | DB/文件/持久化信号 | 未新增 | | 对外 Kit/NAPI/ANI/C API | 未涉及;修改的是 interfaces/inner_api 内部结构 | | 选定组合 | 通用提交必检:security-scanner + logic-scanner | --- ## 2. 总体评价 ### 2.1 上库质量评估结论 | 指标 | 结论 | |------|------| | **整体评分** | **100/100**(计算过程见附录 A,扣分明细见 2.3) | | **风险等级** | 🟢 低风险 | | **上库决策** | ✅ **可以上库** | **决策依据**: - 依据 1:必检维度 security-scanner 与 logic-scanner 均已执行,无缺失或豁免。 - 依据 2:变更仅新增一个有默认值的布尔字段及一次初始化期透传;无内存、资源、并发、IPC、输入或权限攻击面。 - 依据 3:配套 ability_form_fwk 调用方同时设置 isUnique=true 与 isFormRender=true,真实写入路径完整。 - 依据 4:arkcompiler_ets_runtime 的 RuntimeOption 与 JSRuntimeOptions 均将 isFormThread_ 默认初始化为 false;非卡片路径行为保持等价。 - 依据 5:Refute 推翻旧报告的 3 个疑点;最终 P0/P1/P2/P3 均为 0,评分 100。 **阻塞项(Gate Blocker)**: - 无。 **上库条件(condition = 放行时必须满足,为空表示无条件)**: - 无。 ### 2.2 各维度通过率 | 维度 | 通过率 | 等级 | 评价 | |------|--------|------|------| | security-scanner | 11/11 | 🟢 | Core Scan 全项完成,G01–G15 未命中,0 个正式发现 | | logic-scanner | 7/7 | 🟢 | 控制流、数据流、状态、边界、错误、并发与业务契约均通过,0 个正式发现 | ### 2.3 评分扣分明细 | 严重等级 | 权重 | 数量 | 扣分 | |---------|------|------|------| | P0 致命 | −30 | 0 | −0 | | P1 严重 | −12 | 0 | −0 | | P2 一般 | −5 | 0 | −0 | | P3 提示 | −2 | 0 | −0 | | **合计** | | **0** | **−0** → 评分 **100** | > 公式:评分 = max(0, 100 − (30×P0 + 12×P1 + 5×P2 + 2×P3));本轮为 100 − 0 = 100。 --- ## 3. 问题统计 > 严重等级已统一归一化为 P0/P1/P2/P3。 | 维度 | 总数 | P0 致命 | P1 严重 | P2 一般 | P3 提示 | |------|------|---------|---------|---------|---------| | security-scanner | 0 | 0 | 0 | 0 | 0 | | logic-scanner | 0 | 0 | 0 | 0 | 0 | | **总计** | **0** | **0** | **0** | **0** | **0** | --- ## 4. 高优先级发现(P0/P1,跨维度去重后) **无。** 本轮无 P0/P1 项。 --- ## 5. 分维度明细 ### 5.1 Security & Bug(经 security-scanner) - 模块风险画像:进程内 VM 初始化参数透传;未新增外部输入、资源所有权、副作用或异步行为。 - 11 项 Core Scan:空指针、越界、UAF、整数、并发、资源、反序列化、敏感日志、框架合规、类安全、IPC 鉴权均为未命中或不适用。 - G01–G15 同类横扫:未命中历史缺陷模式;无须进一步全库同类展开。 - 旧候选“新字段没有真实写入点”已由 ability_form_fwk/services/form_render_service/src/form_render_record.cpp:543 的生产赋值路径推翻。 **正式发现:无。** ### 5.2 Logic(经 logic-scanner) - 数据流完整:FormRenderRecord 写入 → Runtime::Options → JsRuntime::CreateJsEnv → Ark RuntimeOption → JSRuntimeOptions → EcmaVM::IsFormThread。 - isUnique 与 isFormRender 职责不同:前者控制卡片模块加载/Timer/Preload,后者控制 Ark pkg-context 的 per-VM/shared-store 分流;卡片入口同时设置二者。 - 默认行为等价:Ark 两层 isFormThread_ 默认值均为 false,非卡片进程不受影响。 - 无新增控制流、状态转换、失败路径、算术边界或并发写入。 **正式发现:无。** --- ## 6. 待跟进(P2/P3 + Suspicious) **无。** 本轮无 P2/P3/Suspicious 项进入最终报告。 --- ## 7. 附录 ### 7.1 变更文件清单(或检视对象文件清单) | 文件 | 状态 | |------|------| | frameworks/native/runtime/js_runtime.cpp | ✏️ 修改(+1) | | interfaces/inner_api/runtime/include/runtime.h | ✏️ 修改(+1) | ### 7.2 检视轨迹(多轮重检时记录) | 轮次 | 范围 | 评分 | 风险等级 | 上库决策 | 结论 | |------|------|------|---------|---------|------| | Round 1 | PR #19862 两文件 | N/A | N/A | 门禁未识别 | 使用旧版无 YAML 格式;提出 3 个未完成跨仓库验证的候选项 | | Round 2 | PR #19862 两文件 + 配套 form_fwk/arkcompiler 调用链 | 100 | low | approve | 最新模板;3 个旧候选经 Refute 全部推翻,0 个正式发现 | ### 7.3 各 skill 原始产出 | skill | 产出文件 | 发现数 | |-------|---------|--------| | security-scanner | security_scanner_pr19862_round2_20260807.md | 0 | | logic-scanner | logic_scanner_pr19862_round2_20260807.md | 0 | | Refuter | refute_log_pr19862_round2_20260807.md | 3 个旧候选推翻,0 个进入报告 | ### 7.4 已排除发现 | ID | 旧候选 | 排除证据 | |----|--------|----------| | LOG-X01 | isUnique 与 isFormRender 可能分叉 | form_fwk 生产调用点同时设置二者;下游实现表明二者职责不同 | | SEC-X01 | isFormRender 无 true 写入点 | form_render_record.cpp:543 存在真实写入并进入 JsFormRuntime::Init | | LOG-X02 | 显式 false 可能改变旧行为 | Ark RuntimeOption 与 JSRuntimeOptions 默认值均为 false | --- ## 附录 A:评分与门禁规则(权威定义,勿改) ### A.1 严重等级统一归一化 | 统一等级 | 含义 | 各 skill 别名 | 门禁含义 | |---------|------|--------------|---------| | **P0 致命** | 崩溃/UAF/OOM/死锁/权限绕过/数据损坏/敏感数据泄漏等必现或易触发 | critical / 致命 / Confirmed P0 | **阻断上库** | | **P1 严重** | 影响正确性/安全边界,低概率触发或需组合条件 | high / 严重 / Confirmed P1、Likely P0 | 需修复或人工裁决 | | **P2 一般** | 逻辑缺陷/资源小泄漏/健壮性问题 | medium / 一般 / Likely P1、P2 | 建议修复,登记跟进 | | **P3 提示** | 风格/潜在风险/观察项,当前不可达 | low / 提示 / Suspicious | 不阻塞,登记跟进 | 归一化映射以**问题实际影响**为准,不以 skill 内部措辞为准;同一问题被多 skill 标注不同等级时,取最高等级。 ### A.2 评分公式与决策矩阵(确定性,可复现) text 评分 = max(0, 100 − (30×P0 + 12×P1 + 5×P2 + 2×P3)) 决策矩阵(自上而下判定,命中即止): | 序 | 条件 | risk_level | gate_decision | |----|------|-----------|---------------| | 0 | 必检维度(dimensions_required)未执行且未豁免 | unknown | insufficient | | 1 | 存在 ≥1 项 P0 | high | block | | 2 | 存在 ≥1 项 P1(无 P0) | medium | conditional | | 3 | 评分 ≥ 90 | low | approve | | 4 | 评分 ≥ 70 | medium | conditional | | 5 | 评分 < 70 | high | block | **决策语义**: - approve:可以上库,P2/P3 项登记进 followups 跟踪。 - conditional:可上库但附条件——必须处理所有 must_fix(P1 项)或在门禁复核人书面裁决后放行;P2/P3 登记跟进。 - block:禁止上库,必须修复 gate_blockers(P0 项)后进入下一轮重检。 - insufficient:无法评估——必检维度缺失,补齐扫描后重出报告;waived_dimensions 中记录的用户豁免项除外。 ### A.3 必检维度 | 目标特征 | 必检维度(缺失即 insufficient) | |---------|-------------------------------| | 通用路径/提交 | security-scanner + logic-scanner(security-scanner 内含 bug+security 双视角,覆盖崩溃/挂死/OOM/UAF/死锁/权限绕过/敏感数据泄漏等高影响缺陷与安全审查) | | services/ 下、IPC/DB/文件/配置密集区 | security-scanner + logic-scanner + input-scanner | | interfaces/kits/、NAPI/ANI/C 绑定、指定 Kit | api-scanner + 实现侧 security-scanner + logic-scanner | ### A.4 格式一致性要求(门禁校验项) 1. 章节编号与顺序固定(1 基本信息 → 2 总体评价 → 3 问题统计 → 4 高优先级发现 → 5 分维度明细 → 6 待跟进 → 7 附录 → 附录 A)。 2. YAML 报告元数据块字段名、取值域 See merge request: openharmony/ability_ability_runtime!19862 | 1 个月前 | |
bti Signed-off-by: Luobniz21 <luoyicong@h-partners.com> 🤖 AI[100%] 🔧 Human Fixed[0%] 🧑 Human[0%] 👌 AI Adopted[100%] Co-authored-by: opencode (glm-5.2) <ai@local> | 1 个月前 | |
zhushi-0831 Signed-off-by: xialiangwei <xialiangwei1@huawei.com> | 20 天前 | |
refactor(want_agent): remove empty WantSenderStub shell PendingWantRecord now inherits IRemoteStub<IWantSender> directly. WantSenderStub exported no symbols of its own and carried no logic, so drop it along with its dedicated unittest, fuzzer and map entry. Co-Authored-By: Agent AI[100%] Human Fixed[0%] Human[0%] AI Adopted[100%] Co-authored-by: claude (glm-5.3) <ai@local> Change-Id: Ie3012a58d4bf51a52a03858974feefd0f4792e1e Signed-off-by: RuiChen_01 <chenrui193@huawei.com> | 23 天前 | |
cameraPicker调用链上报 Signed-off-by: 朱菲墨 <zhufeimo1@huawei.com> | 10 个月前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 19 天前 | ||
| 29 天前 | ||
| 18 天前 | ||
| 1 个月前 | ||
| 28 天前 | ||
| 19 天前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 28 天前 | ||
| 29 天前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 2 个月前 | ||
| 29 天前 | ||
| 8 个月前 | ||
| 29 天前 | ||
| 2 个月前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 20 天前 | ||
| 23 天前 | ||
| 10 个月前 |