Skip to content

Add "First Seen" Parser Flag#9361

Merged
Maffooch merged 3 commits into
DefectDojo:bugfixfrom
Maffooch:first
Jan 22, 2024
Merged

Add "First Seen" Parser Flag#9361
Maffooch merged 3 commits into
DefectDojo:bugfixfrom
Maffooch:first

Conversation

@Maffooch
Copy link
Copy Markdown
Contributor

Adds a "First Seen" parser flag to select parsers for users wanting the finding date to be reflected as the first time a vulnerability's detected rather then the last time

[sc-3965]

@github-actions github-actions Bot added settings_changes Needs changes to settings.py based on changes in settings.dist.py included in this PR unittests parser labels Jan 18, 2024
@dryrunsecurity
Copy link
Copy Markdown

dryrunsecurity Bot commented Jan 18, 2024

Contextual Security Analysis

As DryRun Security performs checks, we’ll summarize them here. You can always dive into the detailed results in the section below for checks.

Status DryRun Security Check
AI-powered Sensitive Function Check
Configured Sensitive Files Check
AI-powered Sensitive Files Check

Chat with your AI-powered Security Buddy by typing @dryrunsecurity followed by your question into a comment.
Example: @dryrunsecurity What are common security issues with web application cookies?

Install and configure more repositories at DryRun Security

Copy link
Copy Markdown
Contributor

@mtesauro mtesauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

Comment on lines +58 to +60
date = parser.parse(issue.get("created_date"))
else:
date = parser.parse(issue.get("created_date"))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These looks same for me

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are the same, but this time it is intentional. In the unit test reports for this parser, there is not any available data in the report to satisfy the notion of a "last seen" date. Before this change, the created_date field was used, so it seemed appropriate to maintain that same behavior for both cases.

I am open to any suggestions that could make more sense though!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, is it necessary to replace the original implementation if there is no change in behavior?

Comment on lines +182 to +186
row.get("Issue opened: Scan date"), "%d %b %Y %H:%M%p %Z"
)
else:
date = datetime.strptime(
row.get("Issue opened: Scan date"), "%d %b %Y %H:%M%p %Z"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are the same, but this time it is intentional. In the unit test reports for this parser, there is not any available data in the report to satisfy the notion of a "last seen" date. Before this change, the Issue opened: Scan date field was used, so it seemed appropriate to maintain that same behavior for both cases.

I am open to any suggestions that could make more sense though!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kiblik
Copy link
Copy Markdown
Contributor

kiblik commented Jan 19, 2024

One more parser ;) Maffooch#2

@Maffooch
Copy link
Copy Markdown
Contributor Author

Thanks @kiblik

@Maffooch Maffooch merged commit 32669e0 into DefectDojo:bugfix Jan 22, 2024
@Maffooch Maffooch deleted the first branch January 22, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parser settings_changes Needs changes to settings.py based on changes in settings.dist.py included in this PR unittests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants