From c89d4274129ca4b7a3e54e3baf09a472deff7f8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=9B=E4=B8=9C=E4=BA=9A?= Date: Mon, 5 Jun 2023 17:33:51 +0800 Subject: [PATCH 01/33] success scadetail --- .env | 2 + src/config/lang/en.ts | 1 + src/config/lang/zh_cn.ts | 1 + src/router/routes.ts | 27 + src/services/sca.ts | 76 ++- src/views/project/ProjectDetail.vue | 2 +- src/views/project/VulListComponent.vue | 4 +- src/views/sca/ScaDetail_tab.vue | 743 +++++++++++++++++++++++++ src/views/sca/ScaDialog copy.vue | 288 ++++++++++ src/views/sca/ScaDialog.vue | 492 ++++++++++++++-- src/views/sca/ScaList.vue | 93 ++-- src/views/vuln/VulnDetail.vue | 13 +- src/views/vuln/VulnList.vue | 4 +- vue.config.js | 8 + 14 files changed, 1627 insertions(+), 127 deletions(-) create mode 100644 src/views/sca/ScaDetail_tab.vue create mode 100644 src/views/sca/ScaDialog copy.vue diff --git a/.env b/.env index 46ee672a..53c6cb97 100644 --- a/.env +++ b/.env @@ -2,6 +2,8 @@ # base api VUE_APP_BASE_API = '/api/v1' VUE_APP_BASE_API_V2 = '/api/v2' +VUE_APP_BASE_SCA_V2 = '/api/sca/v2' +VUE_APP_BASE_SCA_V1 = '/api/sca/v1' VUE_APP_UPLOAD = '/upload' VUE_APP_OPEN_API = '/openapi' VUE_APP_ATOM_API = '/atom-webapi' diff --git a/src/config/lang/en.ts b/src/config/lang/en.ts index de2fbe9f..c7c71a86 100644 --- a/src/config/lang/en.ts +++ b/src/config/lang/en.ts @@ -101,6 +101,7 @@ export default { scaList: 'Component management list', scaDetail: 'Component management details', scanDetail: 'Scan vulnerability details', + scalistDetail: 'Scan details', changeLogo: 'Site Identity', setting: 'Settings', agentManage: 'Agent', diff --git a/src/config/lang/zh_cn.ts b/src/config/lang/zh_cn.ts index a766bc96..6e07a070 100644 --- a/src/config/lang/zh_cn.ts +++ b/src/config/lang/zh_cn.ts @@ -95,6 +95,7 @@ export default { vulnDetail: '应用漏洞详情', sca: '组件', scaList: '组件管理列表', + scalistDetail: '组件详情', scaDetail: '组件管理详情', scanDetail: '扫描漏洞详情', setting: '系统配置', diff --git a/src/router/routes.ts b/src/router/routes.ts index c0cfbf5f..5480f214 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -190,6 +190,15 @@ const routes: Array = [ }, component: () => import('@/views/sca/ScaList.vue'), }, + { + path: 'scalistDetail/:page/:id', + name: 'scalistDetail/:page/:id', + meta: { + i18n: 'menu.scalistDetail', + name: i18n.t('menu.vulnDetail'), + }, + component: () => import('@/views/sca/ScaDialog.vue'), + }, ], }, { @@ -561,6 +570,15 @@ const adminRoutes: Array = [ }, component: () => import('@/views/sca/ScaList.vue'), }, + { + path: 'scalistDetail/:page/:id', + name: 'scalistDetail/:page/:id', + meta: { + i18n: 'menu.scalistDetail', + name: i18n.t('menu.vulnDetail'), + }, + component: () => import('@/views/sca/ScaDialog.vue'), + }, ], }, { @@ -965,6 +983,15 @@ const userRoutes: Array = [ }, component: () => import('@/views/sca/ScaList.vue'), }, + { + path: 'scalistDetail/:page/:id', + name: 'scalistDetail/:page/:id', + meta: { + i18n: 'menu.scalistDetail', + name: i18n.t('menu.scalistDetail'), + }, + component: () => import('@/views/sca/ScaDialog.vue'), + }, ], }, { diff --git a/src/services/sca.ts b/src/services/sca.ts index 1e12e7bc..413336f0 100644 --- a/src/services/sca.ts +++ b/src/services/sca.ts @@ -29,29 +29,81 @@ export default () => }) } - assetVuls(aggr_id: any): Promise { - return request.get('/asset_vuls/' + aggr_id, { - baseURL: '/openapi/sca/v1', - }) + assetVuls(row: any): Promise { + return request.get( + `/package_vuls/${row.language_id}/${row.package_name}/${row.package_version}?page=${row.page}&page_size=${row.page_size}`, + { + baseURL: '/api/sca/v2', + } + ) } - assetProjects(aggr_id: any): Promise { - return request.get('/asset_projects/' + aggr_id, { - baseURL: '/openapi/sca/v1', + assetProjects(row: any): Promise { + if (row.project_id) { + return request.get( + `/package/${row.language_id}/${row.package_name}/${row.package_version}/relation_projects?page=${row.page}&page_size=${row.page_size}&project_id=${row.project_id}`, + { + baseURL: '/api/sca/v2', + } + ) + } + return request.get( + `/package/${row.language_id}/${row.package_name}/${row.package_version}/relation_projects?page=${row.page}&page_size=${row.page_size}`, + { + baseURL: '/api/sca/v2', + } + ) + } + assetProjectId(row: any): Promise { + return request.get( + `/package/${row.language_id}/${row.package_name}/${row.package_version}/relation_project/${row.project_id}`, + { + baseURL: '/api/sca/v2', + } + ) + } + vulPackId(row: any): Promise { + return request.get(`/package_vul/${row.vul_id}`, { + baseURL: '/api/sca/v2', }) } - // scaList + // scaList /api/sca/v2/package + // scaList(data: any): Promise { + // return request.post('/scas', data) + // } scaList(data: any): Promise { - return request.post('/scas', data) + return request.post('/package/', data, { + baseURL: '/api/sca/v2', + }) } // scaSummary + // scaSummary(data: any): Promise { + // return request.post('/sca/summary', data) + // } scaSummary(data: any): Promise { - return request.post('/sca/summary', data) + if (data.project_id) { + return request.get( + `/package_summary?project_id=${data.project_id}&project_version_id=${data.version_id}&keyword=${data.keyword}`, + { + baseURL: '/api/sca/v2', + // baseURL: '/openapi/sca/v2', + } + ) + } + return request.get(`/package_summary?keyword=${data.keyword}`, { + baseURL: '/api/sca/v2', + // baseURL: '/openapi/sca/v2', + }) } // getScaDetail - getScaDetail(id: number): Promise { - return request.get(`/sca/${id}`) + getScaDetail(row: any): Promise { + return request.get( + `/package/${row.language_id}/${row.package_name}/${row.package_version}/detail`, + { + baseURL: '/api/sca/v2', + } + ) } })() diff --git a/src/views/project/ProjectDetail.vue b/src/views/project/ProjectDetail.vue index cbd1c3e3..aaab3f3a 100644 --- a/src/views/project/ProjectDetail.vue +++ b/src/views/project/ProjectDetail.vue @@ -3,7 +3,7 @@
- 返回列表 + 返回项目列表
diff --git a/src/views/project/VulListComponent.vue b/src/views/project/VulListComponent.vue index 5fd95470..18a3176a 100644 --- a/src/views/project/VulListComponent.vue +++ b/src/views/project/VulListComponent.vue @@ -239,12 +239,12 @@ > 应用漏洞
-
组件漏洞 -
+
-->
+
+
+ +
+ + +
+

+ {{ $t('views.vulnDetail.deleteVulnInfo') }} +

+

+ {{ $t('views.vulnDetail.deleteVulnDesc') }} +

+
+
+ + {{ $t('views.vulnDetail.deleteVulnEnter') }} + + + {{ $t('views.vulnDetail.cancel') }} + +
+
+ + +
+
+
{{ log.msg }}
+
+ {{ fmtTime(log.datetime * 1000 * 1000) }} +
+
+
+
+
+ + + + + + + + + diff --git a/src/views/sca/ScaDialog copy.vue b/src/views/sca/ScaDialog copy.vue new file mode 100644 index 00000000..3fed3afa --- /dev/null +++ b/src/views/sca/ScaDialog copy.vue @@ -0,0 +1,288 @@ + + + + + diff --git a/src/views/sca/ScaDialog.vue b/src/views/sca/ScaDialog.vue index 3fed3afa..16c3c7b0 100644 --- a/src/views/sca/ScaDialog.vue +++ b/src/views/sca/ScaDialog.vue @@ -1,12 +1,70 @@ +
+ + + + + @@ -89,49 +225,166 @@ import { Component, Prop } from 'vue-property-decorator' import VueBase from '@/VueBase' import Distribution from '@/views/project/components/distribution.vue' -@Component({ name: 'ScaDialog', components: { Distribution } }) +import ScaDetail from '@/views/sca/ScaDetail_tab.vue' + +@Component({ name: 'ScaDialog', components: { Distribution, ScaDetail } }) export default class ScaDialog extends VueBase { - @Prop() dialogInfo: any + private dialogInfo: any = {} + private detailInfo: any = {} private tableLoading = false private tableData: any = [] + private activeName: any = [] + private dialogFlag = false + async getAssetVuls() { this.tableLoading = true - const res = await this.services.sca.assetVuls(this.dialogInfo.id) + const res = await this.services.sca.assetVuls({ + package_name: this.$route.query.package_name, + package_version: this.$route.query.package_version, + language_id: this.$route.query.language_id, + page: this.page, + page_size: this.pageSize, + }) this.tableLoading = false this.tableData.push(...res.data) + this.total = res.page.alltotal } private projects: any = [] + private projects_total = 0 + private projects_pageSize = 10 + private projects_page = 1 + private total = 0 + private pageSize = 10 + private page = 1 async getProjects() { - const res = await this.services.sca.assetProjects(this.dialogInfo.id) + let params: any = { + package_name: this.$route.query.package_name, + package_version: this.$route.query.package_version, + language_id: this.$route.query.language_id, + page: this.projects_page, + page_size: this.projects_pageSize, + } + if (this.$route.query.projectId) { + params.project_id = this.$route.query.projectId + } + const res = await this.services.sca.assetProjects(params) this.projects.push(...res.data) + this.projects_total = res.page.alltotal + } + tableSizeChange(val: number) { + this.pageSize = val + this.getAssetVuls() + } + tableCurrentChange(val: number) { + this.page = val + this.getAssetVuls() + } + handleSizeChange(val: number) { + this.projects_pageSize = val + this.getProjects() + } + handleCurrentChange(val: number) { + this.projects_page = val + this.getProjects() + } + async handleChange(val: any) { + if (val) { + console.log('val', val) + const res = await this.services.sca.assetProjectId({ + package_name: this.$route.query.package_name, + package_version: this.$route.query.package_version, + language_id: this.$route.query.language_id, + project_id: val, + }) + this.projects = this.projects.map((item: any) => { + if (item.project === val) { + this.$set(item, 'content', res.data) + } + return item + }) + } } - private toVulnD(item: any) { - this.$router.push( - `/vuln/scaDetail/${item.asset_vul_id}/1?status=1&id=${item.asset_vul_id}` - ) + this.dialogFlag = true + this.dialogInfo = item + // this.$router.push( + // `/vuln/scaDetail/${item.asset_vul_id}/1?status=1&id=${item.asset_vul_id}` + // ) } - toProject(id: any) { + toProject(id: any, index: any) { + if (index === 0 && this.$route.query.projectId) { + return + } this.$router.push('/project/projectDetail/' + id) } + goBack = () => { + this.$router.go(-1) + } created() { + this.getDetail() this.getAssetVuls() this.getProjects() } - + private level_data: any = [] + async getDetail() { + const res = await this.services.sca.getScaDetail({ + package_name: this.$route.query.package_name, + package_version: this.$route.query.package_version, + language_id: this.$route.query.language_id, + }) + if (res.status !== 201) { + this.$message.error(res.msg) + return + } + this.detailInfo = res.data + this.level_data = [ + { + level_id: 1, + level_name: '高危', + num: res.data.vul_high_count, + }, + { + level_id: 2, + level_name: '中危', + num: res.data.vul_medium_count, + }, + { level_id: 3, level_name: '低危', num: res.data.vul_low_count }, + { + level_id: 4, + level_name: '无风险', + num: res.data.vul_info_count, + }, + ] + } + private getTagColoe(language: string) { + switch (language) { + case 'Java': + return 'danger' + case 'PYTHON': + return '' + default: + return '' + } + } + private levelObj = { + 1: '高危', + 2: '中危', + 3: '低危', + 4: '无风险', + } private levelColor(level: any) { switch (level) { - case '高危': + case 1: return { label: '高', color: '#E56363', bg: 'rgba(229, 99, 99, 0.1)' } - case '中危': + case 2: return { label: '中', color: '#F49E0B', bg: 'rgba(244, 158, 11, 0.1)' } - case '低危': + case 3: return { label: '低', color: '#2F90EA', bg: 'rgba(47, 144, 234, 0.1)' } - case '无风险': + case 4: return { label: '无', color: '#ABB2C0', bg: 'rgba(172, 180, 196, 0.1)' } } } @@ -152,26 +405,73 @@ export default class ScaDialog extends VueBase { } } } - - private level_data: any = [ - { - level_id: 1, - level_name: '高危', - num: this.dialogInfo.vul_high_count, - }, - { level_id: 2, level_name: '中危', num: this.dialogInfo.vul_medium_count }, - { level_id: 3, level_name: '低危', num: this.dialogInfo.vul_low_count }, - { - level_id: 4, - level_name: '无风险', - num: this.dialogInfo.vul_info_count, - }, - ] } + diff --git a/src/views/sca/ScaList.vue b/src/views/sca/ScaList.vue index 494a85b8..93792c9f 100644 --- a/src/views/sca/ScaList.vue +++ b/src/views/sca/ScaList.vue @@ -128,40 +128,13 @@ label="组件名称" prop="package_name" fixed="left" - width="240" + min-width="240" > - - - - + - - -
@@ -74,66 +38,6 @@ :placeholder="$t('views.projectEdit.namePlaceholder')" > - -
- - - - - {{ $t('views.projectEdit.scanAdd') }} - -
-
- -
- - - -
-
- - - - - - -
- - - - - {{ $t('views.projectEdit.scanAdd') }} - -
-
- -
- - - -
-
- - - - - - scanId: number | undefined version_name: string description: string vul_validation: number base_url: string test_req_header_key: string test_req_header_value: string - department_id: any - template_id: any log_level: any enable_log: any } = { name: '', mode: this.$t('views.projectEdit.mode1') as string, agentIdList: [], - scanId: undefined, version_name: '', description: '', vul_validation: 0, base_url: '', test_req_header_key: '', test_req_header_value: '', - department_id: '', - template_id: '', log_level: '', enable_log: '', } @@ -659,27 +497,6 @@ export default class ProjectEdit extends VueBase { trigger: 'blur', }, ], - scanId: [ - { - required: true, - message: this.$t('views.projectEdit.scanPlaceholder'), - trigger: 'change', - }, - ], - department_id: [ - { - required: true, - message: this.$t('views.projectEdit.departmentPlaceholder'), - trigger: 'change', - }, - ], - template_id: [ - { - required: true, - message: this.$t('views.projectEdit.templatePlaceholder'), - trigger: 'change', - }, - ], } private scanAddDialogOpen = false @@ -771,15 +588,12 @@ export default class ProjectEdit extends VueBase { this.submitForm.agentIdList = data.agents.map((item: { id: any }) => { return item.id }) - this.submitForm.scanId = data.scan_id this.submitForm.version_name = data.versionData?.version_name this.submitForm.description = data.versionData?.description this.submitForm.vul_validation = data.vul_validation this.submitForm.base_url = data.base_url this.submitForm.test_req_header_key = data.test_req_header_key this.submitForm.test_req_header_value = data.test_req_header_value - this.submitForm.department_id = data.department_id - this.submitForm.template_id = data.template_id this.submitForm.enable_log = data.enable_log this.submitForm.log_level = data.log_level this.agentChange() @@ -933,7 +747,6 @@ export default class ProjectEdit extends VueBase { } this.scanAddDialogOpen = false this.strategyUserList() - this.submitForm.scanId = data.id } private agentChange() { @@ -966,7 +779,6 @@ export default class ProjectEdit extends VueBase { name: string mode: string | any agent_ids: string - scan_id: number pid?: string version_name: string | undefined description: string | undefined @@ -974,15 +786,12 @@ export default class ProjectEdit extends VueBase { base_url: string test_req_header_key: string test_req_header_value: string - department_id: any - template_id: any enable_log: any log_level: any } = { name: this.submitForm.name, mode: this.submitForm.mode, agent_ids: this.submitForm.agentIdList.join(','), - scan_id: this.submitForm.scanId as number, version_name: this.submitForm.version_name ? this.submitForm.version_name : undefined, @@ -993,8 +802,6 @@ export default class ProjectEdit extends VueBase { base_url: this.submitForm.base_url, test_req_header_key: this.submitForm.test_req_header_key, test_req_header_value: this.submitForm.test_req_header_value, - department_id: this.submitForm.department_id, - template_id: this.submitForm.template_id, enable_log: this.submitForm.enable_log, log_level: this.submitForm.log_level, } diff --git a/src/views/project/VulListComponent.vue b/src/views/project/VulListComponent.vue index bce56d04..fdfded95 100644 --- a/src/views/project/VulListComponent.vue +++ b/src/views/project/VulListComponent.vue @@ -32,31 +32,6 @@
-
- 关联项目 -
-
- -
-
- {{ item.name || item.project__name }} -
-
- {{ item.num || item.total }} -
-
-
-
-
- 语言 -
- -
-
- {{ item.name }} -
-
- {{ item.num }} -
-
-
@@ -245,12 +197,12 @@ > 组件漏洞
--> -
扫描漏洞 -
+ -->
@@ -285,7 +237,7 @@ :label="status.label" > -
- + --> {{ detailInfo.version || '-' }}
-
+ + diff --git a/src/views/setting/Index.vue b/src/views/setting/Index.vue index a07c30b1..af9faf52 100644 --- a/src/views/setting/Index.vue +++ b/src/views/setting/Index.vue @@ -87,17 +87,17 @@ export default class SettingIndex extends VueBase { menuGroup = { 策略管理: [ 'strategyManage', - 'templateManage', + // 'templateManage', 'hookRule', 'sensitiveManage', // 'scaManage', ], - 项目模版: ['projectTemplate'], + // 项目模版: ['projectTemplate'], 密码修改: ['changePassword'], 品牌配置: ['changeLogo'], // 状态监控: ['StatusMonitoring'], - 系统配置: ['SystemSettings'], - 操作日志: ['logManage'], + // 系统配置: ['SystemSettings'], + // 操作日志: ['logManage'], 关于洞态: ['about'], } private curModule(path: string) { diff --git a/src/views/setting/components/agentSetting.vue b/src/views/setting/components/agentSetting.vue index c4d8c711..2bd2f852 100644 --- a/src/views/setting/components/agentSetting.vue +++ b/src/views/setting/components/agentSetting.vue @@ -17,7 +17,7 @@ >
-
+
diff --git a/src/views/vuln/VulnDetail.vue b/src/views/vuln/VulnDetail.vue index 3cad6d12..a638bcf9 100644 --- a/src/views/vuln/VulnDetail.vue +++ b/src/views/vuln/VulnDetail.vue @@ -47,7 +47,7 @@ > - - + --> - - + --> -
-
-
关联漏洞{{item.dastvul_count}}个
-
- {{vultype}} - 详情 -
-
-
-
添加关联
- - - - - - - - -
- - -
-
-
Date: Thu, 6 Jul 2023 14:38:35 +0800 Subject: [PATCH 23/33] =?UTF-8?q?feat:=20=E5=BC=80=E6=BA=90=E7=89=88?= =?UTF-8?q?=E4=B8=BB=E5=8A=A8=E9=AA=8C=E8=AF=81=E5=BC=95=E5=AF=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/setting/components/agentSetting.vue | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/views/setting/components/agentSetting.vue b/src/views/setting/components/agentSetting.vue index 2bd2f852..2c418d74 100644 --- a/src/views/setting/components/agentSetting.vue +++ b/src/views/setting/components/agentSetting.vue @@ -57,7 +57,6 @@ import { Component } from 'vue-property-decorator' export default class AgentSetting extends VueBase { private form = { vul_verifiy: '0', - circuit_break: '0', } async getInfo() { @@ -77,7 +76,30 @@ export default class AgentSetting extends VueBase { } } - async profileModified() { + async profileModified(val: any) { + if(val == 1) { + const { status, msg, data } = + await this.services.setting.vulRecheckPayload({ + page: 1, + page_size: 20, + language_id: 1, + }) + + if (status !== 201) { + this.$message.error(msg) + return + } + if (data?.length < 1) { + this.$confirm('暂无可用规则,请点击跳转至规则配置', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }).then(async () => { + this.$router.push('/setting/hookRule') + }) + return + } + } const data = [] for (let key in this.form) { data.push({ From a0cf53f1f00a883463e27530f6fdcf8fb163b710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E8=89=AF=E8=89=AF?= <330441606@qq.com> Date: Wed, 12 Jul 2023 15:28:50 +0800 Subject: [PATCH 24/33] fix --- src/views/project/ProjectEdit.vue | 13 ------- src/views/project/VulListComponent.vue | 47 +++++++++++++------------- 2 files changed, 24 insertions(+), 36 deletions(-) diff --git a/src/views/project/ProjectEdit.vue b/src/views/project/ProjectEdit.vue index dd7a6119..7fee88e2 100644 --- a/src/views/project/ProjectEdit.vue +++ b/src/views/project/ProjectEdit.vue @@ -442,7 +442,6 @@ export default class ProjectEdit extends VueBase { private type = '1' private advanced = false private departmentList = [] - private projectList = [] private radio = '' private submitForm: { name: string @@ -530,24 +529,12 @@ export default class ProjectEdit extends VueBase { } this.$message.error(res.msg) } - private async getListProjecttemplat() { - const res = await this.services.setting.listProjecttemplat({ - page: 1, - page_size: 100, - }) - if (res.status === 201) { - this.projectList = res.data - return - } - this.$message.error(res.msg) - } async created() { if (this.$route.params.pid) { this.newEdit = true } await this.getEngineList() await this.getListDepartment() - await this.getListProjecttemplat() await this.strategyUserList() if (this.$route.params.pid) { await this.projectDetail() diff --git a/src/views/project/VulListComponent.vue b/src/views/project/VulListComponent.vue index fdfded95..6a5737fb 100644 --- a/src/views/project/VulListComponent.vue +++ b/src/views/project/VulListComponent.vue @@ -32,6 +32,30 @@ + +
+ 漏洞状态 +
+ +
+
+ {{ item.name }} +
+
+ {{ item.num }} +
+
+
From 71ad521ef854a207a1c1d7f56d067a92a949c84a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E8=89=AF=E8=89=AF?= <330441606@qq.com> Date: Wed, 12 Jul 2023 15:51:33 +0800 Subject: [PATCH 25/33] fix: delete --- src/views/vuln/VulnList.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/vuln/VulnList.vue b/src/views/vuln/VulnList.vue index 66bc41c7..909a765b 100644 --- a/src/views/vuln/VulnList.vue +++ b/src/views/vuln/VulnList.vue @@ -246,12 +246,12 @@ > 组件漏洞
--> -
漏洞扫描 -
+ -->
From 3103c82a1cc1b633e351864e4e8d54ef1d45a672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E8=89=AF=E8=89=AF?= <330441606@qq.com> Date: Wed, 12 Jul 2023 16:32:24 +0800 Subject: [PATCH 26/33] fix: pointer --- src/views/project/ProjectDetail.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/project/ProjectDetail.vue b/src/views/project/ProjectDetail.vue index 0ce1d361..7d7e6b66 100644 --- a/src/views/project/ProjectDetail.vue +++ b/src/views/project/ProjectDetail.vue @@ -179,7 +179,7 @@ :show-close="false" >
- + {{ $t('views.projectDetail.add_version') }} From 23f7aaa680effbadb50e4ddb6c39c705afbf3492 Mon Sep 17 00:00:00 2001 From: Tscuite <64051240+tscuite@users.noreply.github.com> Date: Wed, 12 Jul 2023 19:00:30 +0800 Subject: [PATCH 27/33] Update deploy-to-test.yml --- .github/workflows/deploy-to-test.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy-to-test.yml b/.github/workflows/deploy-to-test.yml index ae8a9cbc..71fcaeea 100644 --- a/.github/workflows/deploy-to-test.yml +++ b/.github/workflows/deploy-to-test.yml @@ -71,8 +71,8 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: | - registry.cn-hongkong.aliyuncs.com/huoxian_pub/dongtai-web-test:1.0.${{github.run_number}}-${{ steps.version.outputs.GITHUB_REF }} - registry.cn-hongkong.aliyuncs.com/huoxian_pub/dongtai-web-test:latest-${{ steps.version.outputs.GITHUB_REF }} + registry.cn-hongkong.aliyuncs.com/secnium/dongtai-web:${{ steps.version.outputs.GITHUB_REF }}-latest + registry.cn-hongkong.aliyuncs.com/secnium/dongtai-web:${{ steps.version.outputs.GITHUB_REF }}-1.0.${{github.run_number}} - uses: actions/checkout@master - name: deploy to cluster @@ -81,11 +81,14 @@ jobs: KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_TEST_DATA }} with: args: | - if [ ${{ steps.version.outputs.GITHUB_REF }} = beta ] ; then find deploy/deploy-eks-iast-saas-web-test.yml -type f -exec sed -i 's/iast-test/iast-beta/g' {} \; - elif [ ${{ steps.version.outputs.GITHUB_REF }} = develop ] ; then echo 'testing !!!' - else find deploy/deploy-eks-iast-saas-web-test.yml -type f -exec sed -i 's/iast-test/iast-main/g' {} \; ;fi - find deploy/deploy-eks-iast-saas-web-test.yml -type f -exec sed -i 's/VERSION/1.0.${{github.run_number}}-${{ steps.version.outputs.GITHUB_REF }}/g' {} \; - ls deploy/deploy-eks-iast-saas-web-test.yml | xargs -I {} kubectl apply -f {} + git clone https://github.com/HXSecurity/DongTai.git + if [ ${{ steps.version.outputs.GITHUB_REF }} = develop ]; + then helm upgrade --install huoxian --create-namespace -n iast-test ./DongTai/deploy/kubernetes/helm/ --set mysql.host=iast-mysql-test.huoxian.cn \ + --set tag=${{ steps.version.outputs.GITHUB_REF }}-latest --set build.web_number=iast${{github.run_number}} --values https://charts.dongtai.io/devops.yaml + else + helm upgrade --install huoxian --create-namespace -n iast-${{ steps.version.outputs.GITHUB_REF }} ./DongTai/deploy/kubernetes/helm/ --set mysql.host=iast-mysql-test.huoxian.cn \ + --set tag=${{ steps.version.outputs.GITHUB_REF }}-latest --set build.web_number=iast${{github.run_number}} --values https://charts.dongtai.io/devops.yaml + fi - name: finish build uses: joelwmale/webhook-action@master From cead12a1189de423dbba9e8891001fb8a11c691d Mon Sep 17 00:00:00 2001 From: tscuite Date: Thu, 13 Jul 2023 10:48:56 +0800 Subject: [PATCH 28/33] feat: add ci --- .../{deploy-to-test.yml => deploy-dev.yml} | 20 +++++---- deploy/deploy-eks-iast-saas-web-dev.yml | 34 -------------- deploy/deploy-eks-iast-saas-web-prod.yml | 38 ---------------- deploy/deploy-eks-iast-saas-web-test.yml | 44 ------------------- 4 files changed, 11 insertions(+), 125 deletions(-) rename .github/workflows/{deploy-to-test.yml => deploy-dev.yml} (83%) delete mode 100644 deploy/deploy-eks-iast-saas-web-dev.yml delete mode 100644 deploy/deploy-eks-iast-saas-web-prod.yml delete mode 100644 deploy/deploy-eks-iast-saas-web-test.yml diff --git a/.github/workflows/deploy-to-test.yml b/.github/workflows/deploy-dev.yml similarity index 83% rename from .github/workflows/deploy-to-test.yml rename to .github/workflows/deploy-dev.yml index 71fcaeea..b804a388 100644 --- a/.github/workflows/deploy-to-test.yml +++ b/.github/workflows/deploy-dev.yml @@ -74,7 +74,13 @@ jobs: registry.cn-hongkong.aliyuncs.com/secnium/dongtai-web:${{ steps.version.outputs.GITHUB_REF }}-latest registry.cn-hongkong.aliyuncs.com/secnium/dongtai-web:${{ steps.version.outputs.GITHUB_REF }}-1.0.${{github.run_number}} - - uses: actions/checkout@master + - name: Set the value + id: release + run: | + if [ ${{ steps.version.outputs.GITHUB_REF }} = develop ] ; then echo "helm_ns=test" >> $GITHUB_ENV + elif [ ${{ steps.version.outputs.GITHUB_REF }} = beta ] ; then echo "helm_ns=beta" >> $GITHUB_ENV + else echo "helm_ns=main" >> $GITHUB_ENV ;fi + - name: deploy to cluster uses: wahyd4/kubectl-helm-action@master env: @@ -82,14 +88,10 @@ jobs: with: args: | git clone https://github.com/HXSecurity/DongTai.git - if [ ${{ steps.version.outputs.GITHUB_REF }} = develop ]; - then helm upgrade --install huoxian --create-namespace -n iast-test ./DongTai/deploy/kubernetes/helm/ --set mysql.host=iast-mysql-test.huoxian.cn \ - --set tag=${{ steps.version.outputs.GITHUB_REF }}-latest --set build.web_number=iast${{github.run_number}} --values https://charts.dongtai.io/devops.yaml - else - helm upgrade --install huoxian --create-namespace -n iast-${{ steps.version.outputs.GITHUB_REF }} ./DongTai/deploy/kubernetes/helm/ --set mysql.host=iast-mysql-test.huoxian.cn \ - --set tag=${{ steps.version.outputs.GITHUB_REF }}-latest --set build.web_number=iast${{github.run_number}} --values https://charts.dongtai.io/devops.yaml - fi - + helm upgrade --install huoxian --create-namespace -n iast-${{ env.helm_ns }} ./DongTai/deploy/kubernetes/helm/ \ + --set sca.sca_token=${{ secrets.TOKEN_SCA }} --set usb.usb_token=${{ secrets.TOKEN_SCA }} --set mysql.host=iast-mysql-test.huoxian.cn \ + --set tag=${{ steps.version.outputs.GITHUB_REF }}-latest --set build.server_number=iast${{github.run_number}} --values https://charts.dongtai.io/devops.yaml + - name: finish build uses: joelwmale/webhook-action@master with: diff --git a/deploy/deploy-eks-iast-saas-web-dev.yml b/deploy/deploy-eks-iast-saas-web-dev.yml deleted file mode 100644 index a0fce693..00000000 --- a/deploy/deploy-eks-iast-saas-web-dev.yml +++ /dev/null @@ -1,34 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: dongtai-web - namespace: iast-dev - annotations: - kubesphere.io/description: dongtai前端项目 - labels: - app: dongtai-web -spec: - replicas: 1 - selector: - matchLabels: - app: dongtai-web - template: - metadata: - labels: - app: dongtai-web - spec: - containers: - - name: dongtai-web-container - image: registry.cn-beijing.aliyuncs.com/secnium/iast-saas-web-dev:VERSION - imagePullPolicy: Always - - resources: - limits: - cpu: "500m" - memory: 1000Mi - requests: - cpu: "500m" - memory: 1000Mi - imagePullSecrets: - - name: aliyun-registry-secret - diff --git a/deploy/deploy-eks-iast-saas-web-prod.yml b/deploy/deploy-eks-iast-saas-web-prod.yml deleted file mode 100644 index 01f08a19..00000000 --- a/deploy/deploy-eks-iast-saas-web-prod.yml +++ /dev/null @@ -1,38 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: dongtai-web - namespace: iast-prod - annotations: - kubesphere.io/description: dongtai前端项目 - labels: - app: dongtai-web -spec: - replicas: 1 - selector: - matchLabels: - app: dongtai-web - template: - metadata: - labels: - app: dongtai-web - spec: - containers: - - name: dongtai-web-container - image: dongtai/dongtai-web:VERSION - imagePullPolicy: Always - volumeMounts: - - name: configfile - mountPath: /etc/nginx/nginx.conf - subPath: nginx.conf - resources: - limits: - cpu: "500m" - memory: 1000Mi - requests: - cpu: "500m" - memory: 1000Mi - volumes: - - name: configfile - configMap: - name: dongtai-web-nginx-conf diff --git a/deploy/deploy-eks-iast-saas-web-test.yml b/deploy/deploy-eks-iast-saas-web-test.yml deleted file mode 100644 index b9432213..00000000 --- a/deploy/deploy-eks-iast-saas-web-test.yml +++ /dev/null @@ -1,44 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: dongtai-web - namespace: iast-test - annotations: - kubesphere.io/description: dongtai前端项目 - labels: - app: dongtai-web - version: v1 -spec: - replicas: 1 - selector: - matchLabels: - app: dongtai-web - template: - metadata: - annotations: - sidecar.istio.io/inject: "true" - labels: - app: dongtai-web - version: v1 - spec: - containers: - - name: dongtai-web-container - image: registry.cn-hongkong.aliyuncs.com/huoxian_pub/dongtai-web-test:VERSION - imagePullPolicy: Always - volumeMounts: - - name: configfile - mountPath: /etc/nginx/nginx.conf - subPath: nginx.conf - resources: - limits: - cpu: "500m" - memory: 1000Mi - requests: - cpu: "500m" - memory: 1000Mi - volumes: - - name: configfile - configMap: - name: dongtai-web-nginx-conf - imagePullSecrets: - - name: aliyun-registry-secret From 4b1980291608d1eaa8c05245e0e5afa560c8f76d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E8=89=AF=E8=89=AF?= <330441606@qq.com> Date: Thu, 13 Jul 2023 10:55:00 +0800 Subject: [PATCH 29/33] fix: delete api --- src/views/deploy/Deploy.vue | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/views/deploy/Deploy.vue b/src/views/deploy/Deploy.vue index b575fd2e..dad6cdde 100644 --- a/src/views/deploy/Deploy.vue +++ b/src/views/deploy/Deploy.vue @@ -807,19 +807,6 @@ export default class Deploy extends VueBase { } } - private async getListProjecttemplat() { - const res = await this.services.setting.listProjecttemplat({ - page: 1, - page_size: 100, - }) - if (res.status === 201) { - this.projectList = res.data - this.defaultTemplate = res.data[res.data.length - 1]?.id || '' - this.agentForm.projectTemplate = this.defaultTemplate - return - } - this.$message.error(res.msg) - } private async getListDepartment() { // 部门list const res = await this.services.deploy.getDepartment({}) @@ -832,7 +819,6 @@ export default class Deploy extends VueBase { this.$message.error(res.msg) } private async created() { - await this.getListProjecttemplat() await this.getListDepartment() this.agentForm.entryName = 'Demo Project' this.agentForm.version = 'V1.0' From 5aeed26f20647de0a90cf746aecc1856e14204ef Mon Sep 17 00:00:00 2001 From: Tscuite <64051240+tscuite@users.noreply.github.com> Date: Thu, 13 Jul 2023 11:00:23 +0800 Subject: [PATCH 30/33] Update deploy-dev.yml --- .github/workflows/deploy-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index b804a388..48c58c7f 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -90,7 +90,7 @@ jobs: git clone https://github.com/HXSecurity/DongTai.git helm upgrade --install huoxian --create-namespace -n iast-${{ env.helm_ns }} ./DongTai/deploy/kubernetes/helm/ \ --set sca.sca_token=${{ secrets.TOKEN_SCA }} --set usb.usb_token=${{ secrets.TOKEN_SCA }} --set mysql.host=iast-mysql-test.huoxian.cn \ - --set tag=${{ steps.version.outputs.GITHUB_REF }}-latest --set build.server_number=iast${{github.run_number}} --values https://charts.dongtai.io/devops.yaml + --set tag=${{ steps.version.outputs.GITHUB_REF }}-latest --set build.web_number=iast${{github.run_number}} --values https://charts.dongtai.io/devops.yaml - name: finish build uses: joelwmale/webhook-action@master From d31140b8402da7ee99172f7dcec04b048afa2c03 Mon Sep 17 00:00:00 2001 From: tscuite Date: Thu, 13 Jul 2023 13:27:27 +0800 Subject: [PATCH 31/33] feat: update ci --- .github/workflows/deploy-dev.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index b804a388..242e7dc6 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -77,9 +77,9 @@ jobs: - name: Set the value id: release run: | - if [ ${{ steps.version.outputs.GITHUB_REF }} = develop ] ; then echo "helm_ns=test" >> $GITHUB_ENV - elif [ ${{ steps.version.outputs.GITHUB_REF }} = beta ] ; then echo "helm_ns=beta" >> $GITHUB_ENV - else echo "helm_ns=main" >> $GITHUB_ENV ;fi + if [ ${{ steps.version.outputs.GITHUB_REF }} = develop ] ; then echo "helm_ns=test" >> $GITHUB_ENV; echo "helm_mysql=test" >> $GITHUB_ENV + elif [ ${{ steps.version.outputs.GITHUB_REF }} = beta ] ; then echo "helm_ns=beta" >> $GITHUB_ENV; echo "helm_mysql=beta" >> $GITHUB_ENV + else echo "helm_ns=main" >> $GITHUB_ENV ; echo "helm_mysql=temp" >> $GITHUB_ENV ;fi - name: deploy to cluster uses: wahyd4/kubectl-helm-action@master @@ -89,7 +89,7 @@ jobs: args: | git clone https://github.com/HXSecurity/DongTai.git helm upgrade --install huoxian --create-namespace -n iast-${{ env.helm_ns }} ./DongTai/deploy/kubernetes/helm/ \ - --set sca.sca_token=${{ secrets.TOKEN_SCA }} --set usb.usb_token=${{ secrets.TOKEN_SCA }} --set mysql.host=iast-mysql-test.huoxian.cn \ + --set sca.sca_token=${{ secrets.TOKEN_SCA }} --set usb.usb_token=${{ secrets.TOKEN_SCA }} --set mysql.host=iast-mysql-${{ env.helm_mysql }}.huoxian.cn \ --set tag=${{ steps.version.outputs.GITHUB_REF }}-latest --set build.server_number=iast${{github.run_number}} --values https://charts.dongtai.io/devops.yaml - name: finish build From d0be32f88992d6cf338ed4c9be83b8c0d1969b3d Mon Sep 17 00:00:00 2001 From: Tscuite <64051240+tscuite@users.noreply.github.com> Date: Thu, 13 Jul 2023 13:33:58 +0800 Subject: [PATCH 32/33] Update deploy-dev.yml --- .github/workflows/deploy-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index 242e7dc6..a0d47a1d 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -90,7 +90,7 @@ jobs: git clone https://github.com/HXSecurity/DongTai.git helm upgrade --install huoxian --create-namespace -n iast-${{ env.helm_ns }} ./DongTai/deploy/kubernetes/helm/ \ --set sca.sca_token=${{ secrets.TOKEN_SCA }} --set usb.usb_token=${{ secrets.TOKEN_SCA }} --set mysql.host=iast-mysql-${{ env.helm_mysql }}.huoxian.cn \ - --set tag=${{ steps.version.outputs.GITHUB_REF }}-latest --set build.server_number=iast${{github.run_number}} --values https://charts.dongtai.io/devops.yaml + --set tag=${{ steps.version.outputs.GITHUB_REF }}-latest --set build.web_number=iast${{github.run_number}} --values https://charts.dongtai.io/devops.yaml - name: finish build uses: joelwmale/webhook-action@master From e4b19f0e8c73210f44e3a3a2fb6e2ea394fa3650 Mon Sep 17 00:00:00 2001 From: Tscuite <64051240+tscuite@users.noreply.github.com> Date: Mon, 17 Jul 2023 12:01:46 +0800 Subject: [PATCH 33/33] Update deploy-dev.yml --- .github/workflows/deploy-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index a0d47a1d..f752b0ae 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -89,7 +89,7 @@ jobs: args: | git clone https://github.com/HXSecurity/DongTai.git helm upgrade --install huoxian --create-namespace -n iast-${{ env.helm_ns }} ./DongTai/deploy/kubernetes/helm/ \ - --set sca.sca_token=${{ secrets.TOKEN_SCA }} --set usb.usb_token=${{ secrets.TOKEN_SCA }} --set mysql.host=iast-mysql-${{ env.helm_mysql }}.huoxian.cn \ + --set develop.agentZip=${{ env.helm_ns }} --set sca.sca_token=${{ secrets.TOKEN_SCA }} --set usb.usb_token=${{ secrets.TOKEN_SCA }} --set mysql.host=iast-mysql-${{ env.helm_mysql }}.huoxian.cn \ --set tag=${{ steps.version.outputs.GITHUB_REF }}-latest --set build.web_number=iast${{github.run_number}} --values https://charts.dongtai.io/devops.yaml - name: finish build