Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta #366

Merged
merged 6 commits into from
Aug 18, 2023
Merged

Beta #366

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +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}}

- name: Set the value
id: release
run: |
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
uses: tscuite/kubectl-helm-action@main
env:
MAX: false
PROJECT: web
TOKEN_SCA: ${{ secrets.TOKEN_SCA }}
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_TEST_DATA }}
with:
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 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
uses: joelwmale/webhook-action@master
Expand Down
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="zh">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
33 changes: 2 additions & 31 deletions src/services/setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,39 +234,10 @@ export default () =>
return request.post('/engine/hook/rule_type/add', params)
}

ruleAdd(params: {
rule_type_id: string
rule_value: string
rule_source: string
rule_target: string
inherit: string
track: string
language_id: number,
ignore_blacklist?: boolean,
ignore_internal?: boolean,
tags?: any,
untags?: any,
command?: any,
stack_blacklist?: any
}): Promise<iResponse> {
ruleAdd(params: any): Promise<iResponse> {
return request.post('/engine/hook/rule/add', params)
}
modifyAdd(params: {
rule_id: number
rule_type_id: string
rule_value: string
rule_source: string
rule_target: string
inherit: string
track: string
language_id: number,
ignore_blacklist?: boolean,
ignore_internal?: boolean,
tags?: any,
untags?: any,
command?: any,
stack_blacklist?: any
}): Promise<iResponse> {
modifyAdd(params: any): Promise<iResponse> {
return request.post('/engine/hook/rule/modify', params)
}

Expand Down
32 changes: 5 additions & 27 deletions src/views/deploy/Deploy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -155,24 +155,6 @@
></el-input>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item :label="$t('views.deploy.department')">
<el-select
v-model="agentForm.department"
class="addUserInput"
clearable
size="small"
style="width: 180px"
>
<el-option
v-for="(item, index) in departmentList"
:key="index"
:label="item.name"
:value="item.token"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
Expand Down Expand Up @@ -807,23 +789,19 @@ export default class Deploy extends VueBase {
}
}

private async getListDepartment() {
// 部门list
const res = await this.services.deploy.getDepartment({})
private async getUserToken() {
const res = await this.services.user.userToken()
if (res.status === 201) {
this.departmentList = res.data
this.token = res.data[res.data.length - 1]?.token || ''
this.agentForm.department = this.token
return
this.token = res.data.token
}
this.$message.error(res.msg)
}

private async created() {
await this.getListDepartment()
this.agentForm.entryName = 'Demo Project'
this.agentForm.version = 'V1.0'
await this.getMd()
await this.getDoc()
this.getUserToken()
}
}
</script>
Expand Down
52 changes: 29 additions & 23 deletions src/views/setting/components/hookTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
class="resetAllBtn"
@click="hookTypeDialog = true"
><i class="el-icon-plus"></i>
{{ $t('views.hookPage.addHookType') }}</el-button
添加规则类型</el-button
>
<el-button size="small" class="resetAllBtn" @click="hookDialog = true"
><i class="el-icon-plus"></i>
{{ $t('views.hookPage.addHook') }}</el-button
添加规则</el-button
>
</div>
</div>
Expand Down Expand Up @@ -212,17 +212,17 @@
</el-table-column>
</el-table>

<el-pagination
:current-page="currentPage"
:page-sizes="[10, 20, 30, 50]"
:page-size="pageSize"
background
layout=" prev, pager, next, jumper,total, sizes"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
</el-pagination>
<el-pagination
:current-page="currentPage"
:page-sizes="[10, 20, 30, 50]"
:page-size="pageSize"
background
layout=" prev, pager, next, jumper,total, sizes"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
</el-pagination>

<el-dialog :visible.sync="hookTypeDialog">
<el-form
Expand Down Expand Up @@ -275,7 +275,7 @@
size="small"
:label-width="$i18n.locale === 'en' ? '160px' : '100px'"
>
<el-form-item :label="$t('views.hookPage.hookType')">
<el-form-item label="规则集">
<span>{{ fmtType(hook.type) }}</span>
</el-form-item>
<el-form-item :label="$t('views.hookPage.hooksType')">
Expand Down Expand Up @@ -356,6 +356,7 @@
</div>
</el-form-item>
</template>
<template v-if="ruleType !== '3'">
<template v-for="(item, key) in hook.target">
<el-form-item
:key="'target' + key"
Expand Down Expand Up @@ -413,6 +414,7 @@
</div>
</el-form-item>
</template>
</template>
<el-form-item :label="$t('views.hookPage.hookTrack')">
<el-radio v-model="hook.inherit" selected label="false">{{
$t('views.hookPage.onlyNow')
Expand All @@ -424,7 +426,7 @@
$t('views.hookPage.nowChildren')
}}</el-radio>
</el-form-item>
<el-form-item :label="$t('views.hookPage.ignoreInternal')">
<el-form-item v-if="ruleType !== '3'" :label="$t('views.hookPage.ignoreInternal')">
<el-checkbox v-model="hook.ignore_internal"></el-checkbox>
</el-form-item>
<el-form-item :label="$t('views.hookPage.ignoreBlacklist')">
Expand Down Expand Up @@ -528,7 +530,7 @@ export default class HookTable extends VueBase {
ignore_blacklist: false,
tags: [],
untags: [],
command: ''
command: '',
}
relations = [
{ label: this.$t('views.hookPage.or'), value: '|' },
Expand Down Expand Up @@ -630,7 +632,7 @@ export default class HookTable extends VueBase {
this.hookDialog = true
this.hook.ignore_internal = row.ignore_internal
this.hook.ignore_blacklist = row.ignore_blacklist
this.hook.tags = row.tags
this.hook.tags = row.tags
this.hook.untags = row.untags
this.hook.command = row.command
}
Expand Down Expand Up @@ -862,21 +864,22 @@ export default class HookTable extends VueBase {
if (this.hook.id) {
this.loadingStart()
const rule_source = this.fmtParams(this.hook.source)
const rule_target = this.fmtParams(this.hook.target)
const rule_target: any = this.fmtParams(this.hook.target)
const { status, msg } = await this.services.setting.modifyAdd({
rule_id: this.hook.id,
rule_type_id: this.hook.rule_type_id,
rule_value: this.hook.rule_value,
rule_target: rule_target,
rule_target: rule_target || undefined,
rule_source: rule_source,
inherit: this.hook.inherit,
track: 'false',
language_id: this.activeLanguage,
ignore_internal: this.hook.ignore_internal,
ignore_internal: this.hook.ignore_internal || undefined,
ignore_blacklist: this.hook.ignore_blacklist,
tags: this.hook.tags,
untags: this.hook.untags,
command: this.hook.command,
type: Number(this.ruleType)
})

this.loadingDone()
Expand All @@ -888,26 +891,27 @@ export default class HookTable extends VueBase {
})
return
}
this.$message.success('操作成功')
await this.getTable()
this.clearHook()
} else {
this.loadingStart()
const rule_source = this.fmtParams(this.hook.source)
const rule_target = this.fmtParams(this.hook.target)

const { status, msg } = await this.services.setting.ruleAdd({
rule_type_id: this.hook.rule_type_id,
rule_value: this.hook.rule_value,
rule_target: rule_target,
rule_target: rule_target || undefined,
rule_source: rule_source,
inherit: this.hook.inherit,
track: 'false',
language_id: this.activeLanguage,
ignore_internal: this.hook.ignore_internal,
ignore_internal: this.hook.ignore_internal || undefined,
ignore_blacklist: this.hook.ignore_blacklist,
tags: this.hook.tags,
untags: this.hook.untags,
command: this.hook.command,
type: Number(this.ruleType)
})

this.loadingDone()
Expand All @@ -919,6 +923,8 @@ export default class HookTable extends VueBase {
})
return
}
console.log('操作成功')
this.$message.success('操作成功')
await this.getBase()
await this.getTable()
this.clearHook()
Expand Down
Loading