From d1d1cf858dc1b27eced2a6be04c2e6bf041356e0 Mon Sep 17 00:00:00 2001 From: wkl505997900 <2313665567@qq.com> Date: Wed, 18 Oct 2023 17:00:48 +0800 Subject: [PATCH] update 20.03 SP4 code --- ...f-leaving-the-page-polling-interface.patch | 155 +++++++ ...olving-the-problem-of-cve-fix-params.patch | 25 + ...login-key-to-asset-management-module.patch | 427 ++++++++++++++++++ ...-plugin-and-fingerprint-waveform-bar.patch | 34 ++ 0007-Fix-five-issues.patch | 99 ++++ ...with-polling-and-refreshing-displays.patch | 98 ++++ ...-Correction-of-copyright-information.patch | 28 ++ ...Optimize-host-scanning-polling-logic.patch | 42 ++ ...nt-for-generating-cve-and-repo-tasks.patch | 74 +++ 0012-Fix-Upload-host-logic.patch | 278 ++++++++++++ ...Fix-the-issue-of-incorrect-parameter.patch | 29 ++ aops-hermes.spec | 40 +- 12 files changed, 1327 insertions(+), 2 deletions(-) create mode 100644 0003-Solving-the-query-problem-of-leaving-the-page-polling-interface.patch create mode 100644 0004-Solving-the-problem-of-cve-fix-params.patch create mode 100644 0005-Add-login-key-to-asset-management-module.patch create mode 100644 0006-Temporarily-hide-the-plugin-and-fingerprint-waveform-bar.patch create mode 100644 0007-Fix-five-issues.patch create mode 100644 0008-Fix-issues-with-polling-and-refreshing-displays.patch create mode 100644 0009-Correction-of-copyright-information.patch create mode 100644 0010-Optimize-host-scanning-polling-logic.patch create mode 100644 0011-Add-null-judgment-for-generating-cve-and-repo-tasks.patch create mode 100644 0012-Fix-Upload-host-logic.patch create mode 100644 0013-Fix-the-issue-of-incorrect-parameter.patch diff --git a/0003-Solving-the-query-problem-of-leaving-the-page-polling-interface.patch b/0003-Solving-the-query-problem-of-leaving-the-page-polling-interface.patch new file mode 100644 index 0000000..5b5c41a --- /dev/null +++ b/0003-Solving-the-query-problem-of-leaving-the-page-polling-interface.patch @@ -0,0 +1,155 @@ +From c8f6d03755791bea887cc915099344df1c16d19b Mon Sep 17 00:00:00 2001 +From: wkl505997900 <2313665567@qq.com> +Date: Thu, 21 Sep 2023 14:33:45 +0800 +Subject: [PATCH] fix an polling issue + +--- + src/views/leaks/HostLeakDetail.vue | 7 +++++++ + src/views/leaks/LeakTaskDetail.vue | 21 +++++++++++++-------- + src/views/leaks/LeakTaskList.vue | 7 +++++++ + src/views/leaks/components/CvesTable.vue | 6 ------ + src/views/leaks/components/HostTable.vue | 5 ++--- + 5 files changed, 29 insertions(+), 17 deletions(-) + +diff --git a/src/views/leaks/HostLeakDetail.vue b/src/views/leaks/HostLeakDetail.vue +index 477df57..3327f80 100644 +--- a/src/views/leaks/HostLeakDetail.vue ++++ b/src/views/leaks/HostLeakDetail.vue +@@ -257,6 +257,13 @@ export default { + mounted: function () { + this.getDetail(); + this.getScanStatue(); ++ }, ++ beforeDestroy() { ++ // 离开页面前,若当前存在轮询,清除轮询 ++ if (this.getScanStatusTimeout) { ++ clearInterval(this.getScanStatusTimeout); ++ this.getScanStatusTimeout = null; ++ } + } + }; + +diff --git a/src/views/leaks/LeakTaskDetail.vue b/src/views/leaks/LeakTaskDetail.vue +index 28b7272..f4c84c6 100644 +--- a/src/views/leaks/LeakTaskDetail.vue ++++ b/src/views/leaks/LeakTaskDetail.vue +@@ -285,6 +285,8 @@ export default { + expandedRowKeys: [], + rpmrecord: {}, + propType: '', ++ // 轮询计时器 ++ CveScanStatueTimeout: null, + progressUpdateCaller: null, + reportvisible: false, + runningCveIds: [], +@@ -544,6 +546,7 @@ export default { + updateProgress(taskList) { + const _this = this; + this.progressLoading = true; ++ clearTimeout(this.progressUpdateCaller); + getTaskProgress({taskList}) + .then(function (res) { + _this.detail.statuses = res.data.result && res.data.result[_this.taskId]; +@@ -628,6 +631,7 @@ export default { + updateCveProgress(taskId, cveList) { + const _this = this; + this.cveProgressIsLoading = true; ++ clearTimeout(this.CveScanStatueTimeout); + getCveProgressUnderCveTask({ + taskId, + cveList +@@ -637,7 +641,7 @@ export default { + _this.runningCveIds = _this.getRunningCve(res.data.result); + _this.reportvisible = _this.getReportVisible(res.data.result); + if (_this.runningCveIds.length > 0) { +- setTimeout(function () { ++ _this.CveScanStatueTimeout = setTimeout(function () { + _this.updateCveProgress(taskId, cveList); + }, configs.taskProgressUpdateInterval); + } else { +@@ -860,16 +864,17 @@ export default { + }); + } + }, +- beforeRouteLeave(to, from, next) { +- // 路由跳转前,清除轮询 +- if (this.progressUpdateCaller) { ++ mounted: function () { ++ this.getInitalData(); ++ }, ++ beforeDestroy() { ++ // 离开页面前,若当前存在轮询,清除轮询 ++ if (this.progressUpdateCaller || this.CveScanStatueTimeout) { + clearInterval(this.progressUpdateCaller); ++ clearInterval(this.CveScanStatueTimeout); + this.progressUpdateCaller = null; ++ this.CveScanStatueTimeout = null; + } +- next(); +- }, +- mounted: function () { +- this.getInitalData(); + } + }; + +diff --git a/src/views/leaks/LeakTaskList.vue b/src/views/leaks/LeakTaskList.vue +index 262fa42..df8869a 100644 +--- a/src/views/leaks/LeakTaskList.vue ++++ b/src/views/leaks/LeakTaskList.vue +@@ -419,6 +419,13 @@ export default { + }, + mounted: function () { + this.getTaskList(); ++ }, ++ beforeDestroy() { ++ // 离开页面前,若当前存在轮询,清除轮询 ++ if (this.progressUpdateCaller) { ++ clearInterval(this.progressUpdateCaller); ++ this.progressUpdateCaller = null; ++ } + } + }; + +diff --git a/src/views/leaks/components/CvesTable.vue b/src/views/leaks/components/CvesTable.vue +index 47eed62..84e23fb 100644 +--- a/src/views/leaks/components/CvesTable.vue ++++ b/src/views/leaks/components/CvesTable.vue +@@ -146,7 +146,6 @@ + :row-key="innerrecord => fixed ? record.cve_id + innerrecord.installed_rpm : record.cve_id + innerrecord.available_rpm + innerrecord.installed_rpm" + :columns="fixed ? (standalone ? ainnerColumns : binnerColumns) : (standalone ? aloneinnerColumns : innerColumns)" + :data-source="record.rpms || []" +- :locale="tablenodata" + :rowSelection="innerRowSelection" + :pagination="false"> +
{{ getFixedWay(fixed_way, innerrecord) }}
+@@ -491,11 +490,6 @@ export default { + }, + data() { + return { +- tablenodata: {emptyText: () => ( +-
暂无可修复的rpm包, 可能原因为:
+-
1. 界面未刷新
+-
2. 冷补丁修复kernel后界面未重启
+- )}, + selectedRows: [], // 选中行的row + searchKey: '', + innerCveList: [], +diff --git a/src/views/leaks/components/HostTable.vue b/src/views/leaks/components/HostTable.vue +index 0302e0f..327a4a9 100644 +--- a/src/views/leaks/components/HostTable.vue ++++ b/src/views/leaks/components/HostTable.vue +@@ -974,9 +974,8 @@ export default { + this.getRepoList(); + } + }, +- beforeRouteLeave(to, from, next) { +- next(); +- // 路由跳转前,清除轮询 ++ beforeDestroy() { ++ // 离开页面前,若当前存在轮询,清除轮询 + if (this.scanStatueAllTimeout) { + clearInterval(this.scanStatueAllTimeout); + this.scanStatueAllTimeout = null; +-- +Gitee + diff --git a/0004-Solving-the-problem-of-cve-fix-params.patch b/0004-Solving-the-problem-of-cve-fix-params.patch new file mode 100644 index 0000000..6de47a9 --- /dev/null +++ b/0004-Solving-the-problem-of-cve-fix-params.patch @@ -0,0 +1,25 @@ +From e85c02c4300dcea0b0546c1a18b83a1c99f617d9 Mon Sep 17 00:00:00 2001 +From: wkl505997900 <2313665567@qq.com> +Date: Tue, 26 Sep 2023 10:27:14 +0800 +Subject: [PATCH] fix issue + +--- + src/views/leaks/components/CvesTable.vue | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/views/leaks/components/CvesTable.vue b/src/views/leaks/components/CvesTable.vue +index 84e23fb..24245d9 100644 +--- a/src/views/leaks/components/CvesTable.vue ++++ b/src/views/leaks/components/CvesTable.vue +@@ -864,7 +864,7 @@ export default { + } + this.selectedRowsAll = getSelectedRow(this.selectedRowKeys, this.selectedRowsAll, this.standalone ? this.tableData : this.propData, 'cve_id'); + } else { +- const index = target.rpms.findIndex(item => item.installed_rpm === record.installed_rpm) ++ const index = target.rpms.findIndex(item => item.installed_rpm === record.installed_rpm && item.available_rpm === record.available_rpm) + target.rpms.splice(index, 1) + if (target.rpms.length === 0) { + const dindex = this.innerCveList.findIndex(it => it.cve_id === record.cve_id) +-- +Gitee + diff --git a/0005-Add-login-key-to-asset-management-module.patch b/0005-Add-login-key-to-asset-management-module.patch new file mode 100644 index 0000000..f147fc7 --- /dev/null +++ b/0005-Add-login-key-to-asset-management-module.patch @@ -0,0 +1,427 @@ +From c5a59c0e103a711ce5377a24554ac7c79e2fae54 Mon Sep 17 00:00:00 2001 +From: wkl505997900 <2313665567@qq.com> +Date: Tue, 17 Oct 2023 16:59:32 +0800 +Subject: [PATCH] update code + +--- + src/api/assest.js | 3 +- + src/api/leaks.js | 1 - + src/views/assests/HostEdition.vue | 41 ++++++++++++++-- + src/views/assests/components/EditableCell.vue | 5 +- + src/views/assests/components/addMoreHost.vue | 25 ++++++++-- + .../components/CreateRepairTaskDrawer.vue | 3 -- + src/views/leaks/components/CvesTable.vue | 48 ++++--------------- + src/views/leaks/components/HostTable.vue | 5 +- + vue.config.js | 14 +++--- + 9 files changed, 81 insertions(+), 64 deletions(-) + +diff --git a/src/api/assest.js b/src/api/assest.js +index af1b125..69b12e2 100644 +--- a/src/api/assest.js ++++ b/src/api/assest.js +@@ -124,7 +124,8 @@ export function addHost(parameter) { + ssh_port: parameter.ssh_port, + management: parameter.management, + ssh_user: parameter.ssh_user, +- password: parameter.password ++ password: parameter.password === undefined ? '' : parameter.password, ++ ssh_pkey: parameter.ssh_pkey === undefined ? '' : parameter.ssh_pkey + } + }); + } +diff --git a/src/api/leaks.js b/src/api/leaks.js +index cd59dda..097d790 100644 +--- a/src/api/leaks.js ++++ b/src/api/leaks.js +@@ -4,7 +4,6 @@ + + import request from '@/vendor/ant-design-pro/utils/request'; + // import { getNotEmptyObjectOrNull } from '@/vendor/ant-design-pro/utils/util'; +- + const api = { + getCveOverview: '/vulnerability/cve/overview', + getCveList: '/vulnerability/cve/list/get', +diff --git a/src/views/assests/HostEdition.vue b/src/views/assests/HostEdition.vue +index db6a7ee..de6253e 100644 +--- a/src/views/assests/HostEdition.vue ++++ b/src/views/assests/HostEdition.vue +@@ -93,13 +93,39 @@ + + + +- +- ++ ++ ++ 主机登录密码 ++ ++ ++ 主机登录公钥 ++ ++ ++ ++ ++ ++ ++ + + + 取消 +@@ -133,10 +159,13 @@ import {PageHeaderWrapper} from '@ant-design-vue/pro-layout'; + import AddHostGroupModal from './components/AddHostGroupModal'; + + import {hostGroupList, addHost, getHostDetail, editHost} from '@/api/assest'; ++import DescriptionTips from '@/components/DescriptionTips'; ++ + export default { + components: { + PageHeaderWrapper, +- AddHostGroupModal ++ AddHostGroupModal, ++ DescriptionTips + }, + data() { + return { +@@ -148,7 +177,8 @@ export default { + form: this.$form.createForm(this), + submitLoading: false, + PortRequired: false, +- UserRequired: false ++ UserRequired: false, ++ identificaWay: 1 // 认证方式, + }; + }, + computed: { +@@ -194,6 +224,9 @@ export default { + } + }, + methods: { ++ onChange(e) { ++ this.identificaWay = e.target.value; ++ }, + handleUserChange(value) { + if (this.pageType === 'edit') { + value.target.value === this.basicHostInfo.ssh_user ? this.UserRequired = false : this.UserRequired = true +diff --git a/src/views/assests/components/EditableCell.vue b/src/views/assests/components/EditableCell.vue +index 282ba8c..28f0f62 100644 +--- a/src/views/assests/components/EditableCell.vue ++++ b/src/views/assests/components/EditableCell.vue +@@ -8,7 +8,7 @@ +
+ + +- ++ + + +
+ +- {{ countStar(form[formkey]) }} ++ {{ countStar(form[formkey]) }} + {{ value || ' ' }} +
+ +@@ -97,6 +97,7 @@ export default { + ssh_port: [{required: true, message: '请输入端口'}, {validator: checkSSHPort}], + ssh_user: [{ validator: validateUser, trigger: 'change' }], + password: [{ required: true, message: 'password不能为空', trigger: 'change' }], ++ ssh_pkey: [{ required: true, message: 'ssh_pkey不能为空', trigger: 'change' }], + host_name: [{ validator: checkNameInput, trigger: 'change' }], + host_group_name: [{ required: true, message: 'host_group_name不能为空', trigger: 'change' }], + management: [{ validator: checkmanagement, trigger: 'change' }] +diff --git a/src/views/assests/components/addMoreHost.vue b/src/views/assests/components/addMoreHost.vue +index 055f1b9..818ffa6 100644 +--- a/src/views/assests/components/addMoreHost.vue ++++ b/src/views/assests/components/addMoreHost.vue +@@ -1,7 +1,7 @@ + ++ + + +-- +Gitee + diff --git a/0007-Fix-five-issues.patch b/0007-Fix-five-issues.patch new file mode 100644 index 0000000..966908e --- /dev/null +++ b/0007-Fix-five-issues.patch @@ -0,0 +1,99 @@ +From 8719f563108c3f82edebf7f0c8b1f947f878f842 Mon Sep 17 00:00:00 2001 +From: wkl505997900 <2313665567@qq.com> +Date: Fri, 20 Oct 2023 21:15:29 +0800 +Subject: [PATCH] fix bug + +--- + src/api/assest.js | 3 ++- + src/views/assests/HostEdition.vue | 16 ++++++++-------- + src/views/leaks/components/HostTable.vue | 2 +- + 3 files changed, 11 insertions(+), 10 deletions(-) + +diff --git a/src/api/assest.js b/src/api/assest.js +index 69b12e2..095a943 100644 +--- a/src/api/assest.js ++++ b/src/api/assest.js +@@ -142,7 +142,8 @@ export function editHost(parameter, id) { + ssh_port: parameter.ssh_port, + management: parameter.management, + ssh_user: parameter.ssh_user, +- password: parameter.password ++ password: parameter.password, ++ ssh_pkey: parameter.ssh_pkey + } + }); + } +diff --git a/src/views/assests/HostEdition.vue b/src/views/assests/HostEdition.vue +index de6253e..962c2d1 100644 +--- a/src/views/assests/HostEdition.vue ++++ b/src/views/assests/HostEdition.vue +@@ -99,7 +99,7 @@ + 主机登录密码 + + +- 主机登录公钥 ++ 主机登录密钥 + + + +@@ -107,9 +107,9 @@ + +@@ -119,13 +119,13 @@ + {rules: [{required: pageType === 'create' ? true : requiredRules, message: '请输入主机登录密码'}]} + ]" + :placeholder="pageType === 'create' ? '请设置主机登录密码' : '请输入主机登录密码, 若未修改主机用户名或端口可以为空'">
+- ++ :placeholder="pageType === 'create' ? '请设置主机登录密钥' : '请输入主机登录密钥, 若未修改主机用户名或端口可以为空'"> + + + 取消 +@@ -271,9 +271,9 @@ export default { + if (tableParams[key] === this.basicHostInfo[key]) { + delete tableParams[key] // 删除未修改数据 + } +- if (key === 'password') { ++ if (key === 'password' || key === 'ssh_pkey') { + if (tableParams[key].length === 0) { +- delete tableParams[key] // password为空不传 ++ delete tableParams[key] // password或密钥为空不传 + } + } + } +diff --git a/src/views/leaks/components/HostTable.vue b/src/views/leaks/components/HostTable.vue +index 63dc4f2..950097f 100644 +--- a/src/views/leaks/components/HostTable.vue ++++ b/src/views/leaks/components/HostTable.vue +@@ -964,11 +964,11 @@ export default { + }, + mounted: function () { + this.getHostGroup(); ++ this.getHostList(); + if (this.standalone) { + // 主机列表页面中要自行获取全量主机和扫描状态 + this.getScanStatusAll([]); + } else { +- this.getHostList(); + // 主机详情页面中要自行获取repo列表 + this.getRepoList(); + } +-- +Gitee + diff --git a/0008-Fix-issues-with-polling-and-refreshing-displays.patch b/0008-Fix-issues-with-polling-and-refreshing-displays.patch new file mode 100644 index 0000000..b1913fa --- /dev/null +++ b/0008-Fix-issues-with-polling-and-refreshing-displays.patch @@ -0,0 +1,98 @@ +From 60cc53b9c422f7000747cd842e7ea1503fbe7f9d Mon Sep 17 00:00:00 2001 +From: wkl505997900 <2313665567@qq.com> +Date: Mon, 23 Oct 2023 15:13:56 +0800 +Subject: [PATCH] fix two issue + +--- + src/views/leaks/LeakTaskDetail.vue | 20 ++++++++++++++++---- + src/views/leaks/components/CvesTable.vue | 1 + + 2 files changed, 17 insertions(+), 4 deletions(-) + +diff --git a/src/views/leaks/LeakTaskDetail.vue b/src/views/leaks/LeakTaskDetail.vue +index f4c84c6..cbb3369 100644 +--- a/src/views/leaks/LeakTaskDetail.vue ++++ b/src/views/leaks/LeakTaskDetail.vue +@@ -286,12 +286,13 @@ export default { + rpmrecord: {}, + propType: '', + // 轮询计时器 ++ repoInfoTimeout: null, + CveScanStatueTimeout: null, + progressUpdateCaller: null, + reportvisible: false, + runningCveIds: [], + timer: '', +- taskId: this.$route.params.taskId, ++ taskId: '', + taskType: this.$route.params.taskType, + detail: {statuses: {}}, + infoLoading: false, +@@ -476,7 +477,7 @@ export default { + const _this = this + const Params = { + cve_id: record.cve_id, +- task_id: this.$route.query.task_id ++ task_id: this.taskId + } + getCvefixLeakRpm(Params) + .then(function (res) { +@@ -688,6 +689,7 @@ export default { + this.tableIsLoading = true; + const pagination = this.pagination || {}; + const filters = this.filters || {}; ++ clearTimeout(this.repoInfoTimeout); + getHostUnderRepoTask({ + taskId: this.taskId, + tableInfo: { +@@ -712,7 +714,7 @@ export default { + }; + _this.reportvisible = !_this.hostRepostatusCheck(res.data.result); + if (_this.hostRepostatusCheck(res.data.result)) { +- setTimeout(function () { ++ _this.repoInfoTimeout = setTimeout(function () { + _this.getHostList(); + }, configs.taskProgressUpdateInterval); + } +@@ -864,16 +866,26 @@ export default { + }); + } + }, ++ created() { ++ // 防止页面刷新后query参数丢失,将任务ID存储在内存中 ++ if (localStorage.getItem('taskId')) { ++ this.taskId = localStorage.getItem('taskId') ++ } ++ this.taskId = this.$route.params.taskId || this.taskId ++ localStorage.setItem('taskId', this.taskId) ++ }, + mounted: function () { + this.getInitalData(); + }, + beforeDestroy() { + // 离开页面前,若当前存在轮询,清除轮询 +- if (this.progressUpdateCaller || this.CveScanStatueTimeout) { ++ if (this.progressUpdateCaller || this.CveScanStatueTimeout || this.repoInfoTimeout) { + clearInterval(this.progressUpdateCaller); + clearInterval(this.CveScanStatueTimeout); ++ clearInterval(this.repoInfoTimeout); + this.progressUpdateCaller = null; + this.CveScanStatueTimeout = null; ++ this.repoInfoTimeout = null; + } + } + }; +diff --git a/src/views/leaks/components/CvesTable.vue b/src/views/leaks/components/CvesTable.vue +index d12931e..a49aaa3 100644 +--- a/src/views/leaks/components/CvesTable.vue ++++ b/src/views/leaks/components/CvesTable.vue +@@ -1022,6 +1022,7 @@ export default { + this.expandedRowKeys = []; + this.selectedRowKeys = []; + this.selectedRowsAll = []; ++ this.innerselectedRowKeys = []; + this.innerCveList = []; + this.getCves(); + }, +-- +Gitee + diff --git a/0009-Correction-of-copyright-information.patch b/0009-Correction-of-copyright-information.patch new file mode 100644 index 0000000..4124f34 --- /dev/null +++ b/0009-Correction-of-copyright-information.patch @@ -0,0 +1,28 @@ +From 85d60738d27f7f9367d8f025c23b5847a0b9f410 Mon Sep 17 00:00:00 2001 +From: zhangdaolong +Date: Thu, 12 Oct 2023 10:31:13 +0800 +Subject: [PATCH] Correction of copyright information +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + src/vendor/ant-design-pro/components/GlobalFooter/index.vue | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/vendor/ant-design-pro/components/GlobalFooter/index.vue b/src/vendor/ant-design-pro/components/GlobalFooter/index.vue +index 0296066..1b86a61 100644 +--- a/src/vendor/ant-design-pro/components/GlobalFooter/index.vue ++++ b/src/vendor/ant-design-pro/components/GlobalFooter/index.vue +@@ -7,7 +7,7 @@ + 关于我们 --> +
+
+- 版权所有 ©华为技术有限公司 1998-2023。 保留一切权利。 粤A2-20044005号 ++ 版权所有 © 2023 openEuler 保留一切权利 +
+ +