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

update reupload #1

Merged
merged 1 commit into from
Dec 4, 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
46 changes: 39 additions & 7 deletions defectdojo_api/defectdojo_apiv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1711,30 +1711,62 @@ def upload_scan(self, engagement_id, scan_type, active, verified, close_old_find

##### Re-upload API #####

def reupload_scan(self, test_id, scan_type, active, verified, scan_date, file=None, close_old_findings=True, do_not_reactivate=False, deduplication_on_engagement=True, tags=None, build=None, minimum_severity="Low"):
def reupload_scan(self, file, scan_type, test= None, active=None, scan_date=None, tags=None, verified=None, do_not_reactivate=None,
endpoint_to_add=None, product_type_name=None, product_name=None, engagement_name=None, engagement_end_date=None, source_code_management_uri=None,
test_title=None, auto_create_context=None, deduplication_on_engagement=None, push_to_jira=None, close_old_findings=None,
close_old_findings_product_scope=None, build_id=None, api_scan_configuration=None, service=None,
lead=None, group_by=None, create_finding_groups_for_all_findings=None, engagement_id=None, product_id=None, product_type_id=None,
build=None, version=None, branch_tag=None, commit_hash=None,
minimum_severity="Info", auto_group_by=None, environment=None):
"""Re-uploads and processes a scan file.

:param test_id: Test identifier.
:param file: Path to the scan file to be uploaded.

"""

if build is None:
build = ''

data = {
'test': ('', test_id),
'test': ('', test),
'file': open(file, 'rb'),
'scan_type': ('', scan_type),
'active': ('', active),
'scan_date': ('', scan_date),
'tags': ('', tags),
'commit_hash': ('', commit_hash),
'minimum_severity': ('', minimum_severity),
'verified': ('', verified),
'do_not_reactivate': ('', do_not_reactivate),
'endpoint_to_add': ('', endpoint_to_add),
'product_type_name': ('', product_type_name),
'product_name': ('', product_name),
'engagement_name': ('', engagement_name),
'engagement_end_date': ('', engagement_end_date),
'source_code_management_uri': ('', source_code_management_uri),
'test_title': ('', test_title),
'auto_create_context': ('', auto_create_context),
'deduplication_on_engagement': ('', deduplication_on_engagement),
'push_to_jira': ('', push_to_jira),
'close_old_findings': ('', close_old_findings),
'scan_date': ('', scan_date),
'build_id': ('', build),
'minimum_severity': ('', minimum_severity)
'close_old_findings_product_scope': ('', close_old_findings_product_scope),
'version': ('', version),
'build_id': ('', build_id),
'branch_tag': ('', branch_tag),
'api_scan_configuration': ('', api_scan_configuration),
'service': ('', service),
'environment': ('', environment),
'lead': ('', lead),
'group_by': ('', group_by),
'create_finding_groups_for_all_findings': ('', create_finding_groups_for_all_findings),
'engagement_id': ('', engagement_id),
'product_id': ('', product_id),
'product_type_id': ('', product_type_id),
}

if auto_group_by:
data['auto_group_by'] = (auto_group_by, '')

if tags != None:
data["tags"] = tags

Expand All @@ -1746,7 +1778,7 @@ def reupload_scan(self, test_id, scan_type, active, verified, scan_date, file=No
return self._request(
'POST', 'reimport-scan/',
files=data
)
)

##### Credential API #####

Expand Down