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

Commit 9b8313f

Browse files
exexuteowefsad
andauthored
Close ISSUE #92 (Increase the judgment of whether prompt vulnerabilities are enabled) (#93)
Co-authored-by: owefsad <dongzhiyong@secnium.cn>
1 parent f52ad70 commit 9b8313f

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

core/plugins/__init__.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,30 @@
33
# author: owefsad@huoxian.cn
44
# datetime: 2021/10/22 下午2:26
55
# project: DongTai-engine
6+
7+
from dongtai.models.project import IastProject
8+
from dongtai.models.strategy import IastStrategyModel
9+
from dongtai.utils import const
10+
11+
12+
def is_strategy_enable(vul_type, method_pool):
13+
try:
14+
vul_strategy = IastStrategyModel.objects.filter(
15+
vul_type=vul_type,
16+
state=const.STRATEGY_ENABLE,
17+
user_id__in=(1, method_pool.agent.user.id)
18+
).first()
19+
if vul_strategy is None:
20+
return False
21+
project_id = method_pool.agent.bind_project_id
22+
project = IastProject.objects.filter(id=project_id).first()
23+
if project is None:
24+
return False
25+
strategy_ids = project.scan.content
26+
if strategy_ids is None:
27+
return False
28+
if str(vul_strategy.id) in strategy_ids.split(','):
29+
return True
30+
return False
31+
except Exception as e:
32+
return False

core/plugins/strategy_headers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
from dongtai.models.vulnerablity import IastVulnerabilityModel
1414
from dongtai.utils import const
1515

16+
from core.plugins import is_strategy_enable
17+
1618

1719
class FakeSocket():
1820
def __init__(self, response_str):
@@ -82,6 +84,8 @@ def check_response_header(method_pool):
8284

8385

8486
def save_vul(vul_type, method_pool, position=None, data=None):
87+
if is_strategy_enable(vul_type, method_pool) is False:
88+
return None
8589
vul_strategy = IastStrategyModel.objects.filter(
8690
vul_type=vul_type,
8791
state=const.STRATEGY_ENABLE,

0 commit comments

Comments
 (0)