Add weakness in unique content ID in advisories - #1245
Merged
TG1999 merged 1 commit intoJul 24, 2023
Merged
Conversation
TG1999
force-pushed
the
add_weakness_in_models_unique_constraints
branch
2 times, most recently
from
July 24, 2023 05:05
19f28e8 to
0b83e49
Compare
pombredanne
approved these changes
Jul 24, 2023
pombredanne
left a comment
Member
There was a problem hiding this comment.
Thanks... some minor nits for your consideration! You can apply or ignore.
| }, | ||
| ) | ||
| except Exception as e: | ||
| logger.error(f"Error while processing {data!r} with aliases {data.aliases!r}: {e}") |
Member
There was a problem hiding this comment.
Are you getting every data you need to debug with this message?
Contributor
Author
There was a problem hiding this comment.
thanks for pointing this, I missed the representation for error message.
| 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): |
Member
There was a problem hiding this comment.
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)
Contributor
Author
There was a problem hiding this comment.
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 <tushar.goel.dav@gmail.com>
TG1999
force-pushed
the
add_weakness_in_models_unique_constraints
branch
from
July 24, 2023 18:05
0b83e49 to
ef42bde
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.