Skip to content

Commit 692be0e

Browse files
author
luzhongyang
committed
Merge branch 'main' into feature/issue/319
2 parents d30bbaa + 7ee24c1 commit 692be0e

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed

.github/workflows/build_and_upload_package.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ name: Build DongTai Core Package and push to Ali OSS
22

33
on:
44
pull_request:
5-
branches: [ develop ]
6-
5+
branches: [ main ]
6+
push:
7+
branches: [ main ]
78
jobs:
89
build:
10+
if: ${{ github.event_name == 'push' }}
911
runs-on: ubuntu-latest
1012
strategy:
1113
max-parallel: 4

dongtai/engine/vul_engine.py

+32-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def __init__(self):
3535
self.taint_link_size = 0
3636
self.edge_code = 1
3737
self.taint_value = ''
38+
self.vul_type = None
3839

3940
@property
4041
def method_pool(self):
@@ -103,7 +104,8 @@ def method_pool_signatures(self):
103104
signatures.add(f"{method.get('className').replace('/', '.')}.{method.get('methodName')}")
104105
return signatures
105106

106-
def search(self, method_pool, vul_method_signature):
107+
def search(self, method_pool, vul_method_signature, vul_type=None):
108+
self.vul_type = vul_type
107109
self.prepare(method_pool, vul_method_signature)
108110
size = len(self.method_pool)
109111
for index in range(size):
@@ -122,6 +124,35 @@ def search(self, method_pool, vul_method_signature):
122124
logger.info(f'==> current taint hash: {self.pool_value}')
123125
if self.loop(index, size, current_link):
124126
break
127+
self.vul_filter()
128+
129+
def vul_filter(self):
130+
# 分析是否存在过滤条件,排除误报
131+
# 根据漏洞类型,查询filter方法
132+
# 检查vul_
133+
if self.vul_source_signature:
134+
# mark there has a vul
135+
# if vul_type has filter, do escape
136+
stack_count = len(self.vul_stack)
137+
for index in range(0, stack_count):
138+
stack = self.vul_stack[index]
139+
for item in stack:
140+
if 'java.net.URL.<init>' == item["signature"]:
141+
url = item['sourceValues']
142+
origin_source = stack[0]['targetValues']
143+
from urllib.parse import urlparse
144+
o = urlparse(url)
145+
if origin_source not in f'{o.scheme}://{o.netloc}{o.path}':
146+
print(origin_source, url)
147+
self.vul_stack[index] = []
148+
break
149+
vul_source_signature = self.vul_source_signature
150+
self.vul_source_signature = None
151+
for index in range(0, stack_count):
152+
if self.vul_stack[index]:
153+
self.vul_source_signature = vul_source_signature
154+
else:
155+
continue
125156

126157
@staticmethod
127158
def copy_method(method_detail, sink=False, source=False, propagator=False, filter=False):

dongtai/models/agent.py

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class IastAgent(models.Model):
2323
related_query_name='agent',
2424
verbose_name=_('server'),
2525
)
26+
is_audit = models.IntegerField(blank=True, null=True)
2627
is_running = models.IntegerField(blank=True, null=True)
2728
is_core_running = models.IntegerField(blank=True, null=True)
2829
control = models.IntegerField(blank=True, null=True)

0 commit comments

Comments
 (0)