已合并
fix command injection vulnerability #516
starchen_创建于 5 天前
fix command injection vulnerability #516
已合并
Pull Request已成功合入, 合并人@CANN-robot
(感谢 starchen_ 的贡献)atomgit-bot
5 天前 评论:
5 天前 评论:
变更摘要
该 PR 为安全修复(关联 Issue #186/#187/#188),针对 asys 的 profiling、analyze、collect 三个功能在拼接 shell 命令时存在的命令注入风险,通过引入 shlex.quote() 对命令中涉及路径/参数的变量进行转义处理,防止恶意输入被解释为 shell 命令。
主要改动
asys_analyze.py命令注入修复:在AsysAnalyze构建msaicerr命令时,使用shlex.quote()包裹self.path、output_path及asys_collector.output_root_path(转为字符串后)等路径参数,避免路径内容被当作 shell 命令执行。asys_collect.py命令注入修复:在_device_file_export的run_msnpureport中,将cd命令的目标目录export_dir_path通过shlex.quote()转义,防止导出目录路径被注入恶意命令。asys_profiling.py命令注入修复:在AsysProfiling构建msprof命令时,使用shlex.quote()包裹self.output_path,防止输出路径参数被注入 shell 命令。


atomgit-bot
5 天前 评论:
5 天前 评论:
5 天前 添加了label:cann-cla/yes
CANN-robot
5 天前 评论:
5 天前 评论:
CANN-robot
5 天前 评论:
5 天前 评论:
Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-cann/oam-tools | ✅ zhuliangying, fujun19 (2/2) | ✅ zhuliangying (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


5 天前 将newstarzj,chenhao_1209,wulinyu,zhuliangying,yaoguangxiu,fujun19,jinyingqi,yuanjiang_设为评审人
5 天前 将newstarzj,chenhao_1209,wulinyu,zhuliangying,yaoguangxiu,fujun19,jinyingqi,yuanjiang_设为评审人
5 天前 将newstarzj,chenhao_1209,wulinyu,zhuliangying,yaoguangxiu,fujun19,jinyingqi,yuanjiang_设为审查人
5 天前 将newstarzj,chenhao_1209,wulinyu,zhuliangying,yaoguangxiu,fujun19,jinyingqi,yuanjiang_设为审查人
5 天前 添加了label:ci-pipeline-running
CANN-robot
5 天前 评论:
5 天前 评论:
流水线任务触发成功
任务链接 [5c81d18793cb4fffafc907bc0585eacd][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| Check_Pr | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| cocheck_codestyle | ✅ SUCCESS | ||
| precommit | ✅ SUCCESS | >>>>> | |
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| UT_Test_asys | ✅ SUCCESS | >>>>> | |
| UT_Test_msaicerr | ✅ SUCCESS | >>>>> | |
| UT_Test_msprof | ✅ SUCCESS | >>>>> | |
| API_Check | ✅ SUCCESS | >>>>> | |
| PreSmoke_A900 | ✅ SUCCESS | >>>>> |
[2026-08-19 17:55:35] CI执行结束


5 天前 添加了label:api-check-pass
5 天前 删除了label:ci-pipeline-running
5 天前 添加了label:ci-pipeline-passed
CANN-robot
5 天前 评论:
5 天前 评论:
流水线 PR-pipeline_cann_oam-tools#1717 [ commitID:65ab5159 ] 已完成


starchen_
4 天前 评论:
4 天前 评论:
starchen_
4 天前 评论:
4 天前 评论:
zhuliangying
4 天前 评论:
4 天前 评论:
starchen_
3 天前 评论:
3 天前 评论:
zhuliangying
3 天前 评论:
3 天前 评论:
/approve


3 天前 添加了label:lgtmapproved
3 天前 合入了pull request
描述
修复asys profiling/asys analyze/asys collect功能的shell命令注入风险
关联的Issue
关联Issue #186
关联Issue #187
关联Issue #188
测试
通过UT/ST/RDV测试
文档更新
无
类型标签