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

Don't crash on custom cleanser or messy histories. #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
20 changes: 14 additions & 6 deletions MitigationCopier.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,21 @@ def update_mitigation_info_rest(to_app_guid,flaw_id,action,comment,sandbox_guid=
log.info('propose_only set to True; skipping applying approval for flaw_id {}'.format(flaw_id))
return
action = Constants.ANNOT_TYPE[action]
elif action == 'CUSTOMCLEANSERPROPOSED' or action == 'CUSTOMCLEANSERUSERCOMMENT':
log.warning(f"""Cannot copy '{action}' mitigation for Flaw ID {flaw_id} in {to_app_guid}""")
return

flaw_id_list = [flaw_id]
if sandbox_guid==None:
Findings().add_annotation(to_app_guid,flaw_id_list,comment,action)
else:
Findings().add_annotation(to_app_guid,flaw_id_list,comment,action,sandbox=sandbox_guid)
log.info(
'Updated mitigation information to {} for Flaw ID {} in {}'.format(action, str(flaw_id_list), to_app_guid))
try:
if sandbox_guid==None:
Findings().add_annotation(to_app_guid,flaw_id_list,comment,action)
else:
Findings().add_annotation(to_app_guid,flaw_id_list,comment,action,sandbox=sandbox_guid)
log.info(
'Updated mitigation information to {} for Flaw ID {} in {}'.format(action, str(flaw_id_list), to_app_guid))
except requests.exceptions.RequestException as e:
logprint(f"""WARNING: Unable to apply annotation '{action}' for Flaw ID {flaw_id_list} in {to_app_guid}""")
log.exception('Ignoring request exception')

def set_in_memory_flaw_to_approved(findings_to,to_id):
# use this function to update the status of target findings in memory, so that, if it is found
Expand Down