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

fix: normal vul handler. #1290

Merged
merged 1 commit into from
Feb 24, 2023
Merged
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
39 changes: 20 additions & 19 deletions dongtai_protocol/report/handler/narmal_vul_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,10 @@ def save(self):
iast_vul.agent.bind_project_id, iast_vul.id,
iast_vul.strategy.vul_name)
IastVulnerabilityModel.objects.filter(
strategy_id=strategy_id,
uri=self.http_uri,
http_method=self.http_method,
project_version_id=self.agent.project_version_id,
strategy_id=iast_vul.strategy_id,
uri=iast_vul.uri,
http_method=iast_vul.http_method,
project_version_id=iast_vul.agent.project_version_id,
pk__lt=iast_vul.id,
).delete()
header_vul = None
Expand All @@ -300,18 +300,19 @@ def save(self):
logger.debug("unique error stack: ", exc_info=True)
logger.info(
"unique error cause by concurrency insert,ignore it")
if header_vul and not IastHeaderVulnerabilityDetail.objects.filter(
agent_id=self.agent.id,
header_vul_id=header_vul.id,
).exists():
try:
IastHeaderVulnerabilityDetail.objects.create(
agent_id=self.agent.id,
method_pool_id=-1,
header_vul_id=header_vul.id,
req_header=self.req_header_for_search,
res_header=self.http_res_header)
except IntegrityError as e:
logger.debug("unique error stack: ", exc_info=True)
logger.info(
"unique error cause by concurrency insert,ignore it")
# disable when no req_header and res_header
# if header_vul and not IastHeaderVulnerabilityDetail.objects.filter(
# agent_id=self.agent.id,
# header_vul_id=header_vul.id,
# ).exists():
# try:
# IastHeaderVulnerabilityDetail.objects.create(
# agent_id=self.agent.id,
# method_pool_id=-1,
# header_vul_id=header_vul.id,
# req_header=self.req_header_for_search,
# res_header=self.http_res_header)
# except IntegrityError as e:
# logger.debug("unique error stack: ", exc_info=True)
# logger.info(
# "unique error cause by concurrency insert,ignore it")