-
Notifications
You must be signed in to change notification settings - Fork 201
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
Add weakness in unique content ID in advisories #1245
Add weakness in unique content ID in advisories #1245
Conversation
19f28e8
to
0b83e49
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks... some minor nits for your consideration! You can apply or ignore.
vulnerabilities/import_runner.py
Outdated
}, | ||
) | ||
except Exception as e: | ||
logger.error(f"Error while processing {data!r} with aliases {data.aliases!r}: {e}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you getting every data you need to debug with this message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for pointing this, I missed the representation for error message.
@@ -836,7 +836,7 @@ class Meta: | |||
|
|||
def save(self, *args, **kwargs): | |||
checksum = hashlib.md5() | |||
for field in (self.summary, self.affected_packages, self.references): | |||
for field in (self.summary, self.affected_packages, self.references, self.weaknesses): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not dumping only once?
key_data = [self.summary, self.affected_packages, self.references, self.weaknesses]
dumped = json.dumps(key_data, separators=(",", ":")).encode("utf-8")
checksum = hashlib.md5(dumped)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will change the checksum IMO, we should do it separately as a migration first and then change the function on models.
Signed-off-by: Tushar Goel <[email protected]>
0b83e49
to
ef42bde
Compare
The NVD importer is failing to import due to this problem, since all other data is identical except weaknesses which is a new field on advisory, NVD importer is not able to create advisories.