Skip to content

Fix importer crash #1541 - #1542

Merged
TG1999 merged 4 commits into
mainfrom
1541-fix-importer-crash
Aug 16, 2024
Merged

Fix importer crash #1541#1542
TG1999 merged 4 commits into
mainfrom
1541-fix-importer-crash

Conversation

@pombredanne

@pombredanne pombredanne commented Aug 9, 2024

Copy link
Copy Markdown
Member

This PR is correction for the crash in #1541
The issue was introduced by this commit 0fe73ef#diff-11856d929972b1aa71dcd476298a831d6b598b291c0638057af6d62050ba4a15R192

We now check for empty published_at before using it. Otherwise the VulnerabilitySeverity.published_at data will be an invalid "None" string resulting from str(None).

Also improve logging.

@pombredanne
pombredanne requested review from TG1999 and ziadhany August 9, 2024 14:58
Reference: #1541
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Use the latest date file from nginx

Reference: #1541
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Otherwise the VulnerabilitySeverity.published_at data will be an invalid
"None" string.

Reference: #1541
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
@pombredanne
pombredanne force-pushed the 1541-fix-importer-crash branch from 3b5e5f6 to be28af3 Compare August 9, 2024 15:16
@pombredanne

Copy link
Copy Markdown
Member Author

@ziadhany @TG1999 FYI, review welcome

@ziadhany ziadhany left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, and I apologize for introducing this bug.

except Exception as e:
logger.info(f"Failed to process advisory: {advisory!r} with error {e!r}")
except Exception:
from pprint import pformat

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@pombredanne Would it be better to move the pprint library import to the top of the code?

@TG1999 TG1999 left a comment

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.

LGTM!

@TG1999
TG1999 merged commit b7a7237 into main Aug 16, 2024
@pombredanne
pombredanne deleted the 1541-fix-importer-crash branch September 24, 2024 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants