Skip to content
This repository was archived by the owner on Apr 20, 2022. It is now read-only.

Commit 3b213c6

Browse files
authored
Merge pull request #47 from HXSecurity/feature/issue-103
enhance release action
2 parents ba5885f + 565dc9e commit 3b213c6

File tree

6 files changed

+16
-13
lines changed

6 files changed

+16
-13
lines changed

.github/workflows/deploy_engine_to_aws.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,9 @@ jobs:
4545
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
4646
4747
- name: Django Testing project
48-
env:
49-
DATABASE_URL: ${{ secrets.DATABASE_URL }}
5048
run: |
5149
cp conf/config.ini.example conf/config.ini
50+
python3 manage.py migrate
5251
python3 manage.py test
5352
5453
- name: Checkout

.github/workflows/deploy_engine_to_aws_test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,9 @@ jobs:
4545
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
4646
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
4747
- name: Django Testing project
48-
env:
49-
DATABASE_URL: ${{ secrets.DATABASE_URL }}
5048
run: |
5149
cp conf/config.ini.example conf/config.ini
50+
python3 manage.py migrate
5251
python3 manage.py test
5352
- name: Checkout
5453
uses: actions/checkout@v2

.github/workflows/release_engine.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,17 @@ jobs:
6060
username: ${{ secrets.ALIYUN_DOCKERHUB_USER }}
6161
password: ${{ secrets.ALIYUN_DOCKERHUB_PASSWORD }}
6262

63+
- id: release
64+
run: |
65+
VERSION=`echo ${GITHUB_REF##*/} | awk -F'-' '{print $2}'`
66+
echo "::set-output name=version::$VERSION"
67+
6368
- name: Build and push
6469
uses: docker/build-push-action@v2
6570
with:
6671
context: .
6772
push: true
68-
tags: "registry.cn-beijing.aliyuncs.com/huoxian_pub/dongtai-engine:1.0.0,"
73+
tags: "registry.cn-beijing.aliyuncs.com/huoxian_pub/dongtai-engine:${{ steps.release.outputs.version }},"
6974

7075
- name: finish build
7176
uses: joelwmale/webhook-action@master

core/tasks.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,16 +235,16 @@ def search_vul_from_method_pool(method_pool_id):
235235
search_and_save_vul(engine, method_pool_model, method_pool, strategy)
236236
logger.info(f'漏洞检测成功')
237237
except Exception as e:
238-
logger.error(f'漏洞检测出错,错误原因:{e}')
238+
logger.error(f'漏洞检测出错,方法池 {method_pool_id}. 错误原因:{e}')
239239

240240

241241
@shared_task(queue='dongtai-replay-vul-scan')
242242
def search_vul_from_replay_method_pool(method_pool_id):
243-
logger.info(f'漏洞检测开始,方法池 {method_pool_id}')
243+
logger.info(f'重放数据漏洞检测开始,方法池 {method_pool_id}')
244244
try:
245245
method_pool_model = IastAgentMethodPoolReplay.objects.filter(id=method_pool_id).first()
246246
if method_pool_model is None:
247-
logger.warn(f'漏洞检测终止,方法池 {method_pool_id} 不存在')
247+
logger.warn(f'重放数据漏洞检测终止,方法池 {method_pool_id} 不存在')
248248
strategies = load_sink_strategy(method_pool_model.agent.user)
249249
engine = VulEngine()
250250

@@ -258,9 +258,9 @@ def search_vul_from_replay_method_pool(method_pool_id):
258258
continue
259259

260260
search_and_save_vul(engine, method_pool_model, method_pool, strategy)
261-
logger.info(f'漏洞检测成功')
261+
logger.info(f'重放数据漏洞检测成功')
262262
except Exception as e:
263-
logger.error(f'漏洞检测出错,错误原因:{e}')
263+
logger.error(f'重放数据漏洞检测出错,方法池 {method_pool_id}. 错误原因:{e}')
264264

265265

266266
@shared_task(queue='dongtai-strategy-scan')
@@ -583,7 +583,7 @@ def vul_recheck():
583583
try:
584584
headers = base64.b64encode('\n'.join(header_raw))
585585
except Exception as e:
586-
logger.error(f'请求头解析失败,漏洞ID: {vulnerability.id}')
586+
logger.error(f'请求头解析失败,漏洞ID: {vulnerability["id"]}')
587587
elif position == 'COOKIE':
588588
import base64
589589
header_raw = base64.b64decode(headers).decode('utf-8').split('\n')
@@ -610,7 +610,7 @@ def vul_recheck():
610610
try:
611611
headers = base64.b64encode('\n'.join(header_raw))
612612
except Exception as e:
613-
logger.error(f'请求头解析失败,漏洞ID: {vulnerability.id}')
613+
logger.error(f'请求头解析失败,漏洞ID: {vulnerability["id"]}')
614614

615615
elif position == 'PATH':
616616
# 检查path,替换

db.sqlite3

160 KB
Binary file not shown.

lingzhi_engine/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
# Database
9090
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
9191

92-
if len(sys.argv) > 1 and sys.argv[1] == 'test':
92+
if len(sys.argv) > 1 and sys.argv[1] in ('test', 'migrate', 'makemigrations'):
9393
DATABASES = {
9494
'default': {
9595
'ENGINE': 'django.db.backends.sqlite3',

0 commit comments

Comments
 (0)