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

Add new content ID function #1766

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

TG1999
Copy link
Contributor

@TG1999 TG1999 commented Jan 29, 2025

No description provided.

Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
Copy link
Member

@keshav-space keshav-space left a comment

Choose a reason for hiding this comment

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

Thanks @TG1999, see some suggestions below.

# Normalize fields
normalized_data = {
"summary": normalize_text(advisory_data.summary),
"affected_packages": normalize_list(advisory_data.affected_packages),
Copy link
Member

@keshav-space keshav-space Jan 31, 2025

Choose a reason for hiding this comment

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

There is no certainty that this will work since we don't have a proper implementation for handling comparisons between AffectedPackage.

For example, this will not be able to normalize the list of affected_packages below:

affected_packages = [
    AffectedPackage(
        package=PackageURL(
            type="alpine",
            namespace=None,
            name="linux-lts",
            version=None,
            qualifiers={
                "arch": "aarch64",
                "distroversion": "v3.20",
                "reponame": "main",
            },
            subpath=None,
        ),
        affected_version_range=None,
        fixed_version="6.6.13-r1",
    ),
    AffectedPackage(
        package=PackageURL(
            type="alpine",
            namespace=None,
            name="linux-lts",
            version=None,
            qualifiers={"arch": "armhf", "distroversion": "v3.21", "reponame": "main"},
            subpath=None,
        ),
        affected_version_range=None,
        fixed_version="6.6.13-r1",
    ),
]

"summary": normalize_text(advisory_data.summary),
"affected_packages": normalize_list(advisory_data.affected_packages),
"references": normalize_list(advisory_data.references),
"weaknesses": normalize_list(advisory_data.weaknesses),
Copy link
Member

Choose a reason for hiding this comment

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

Similar to the above affected_packages list, this also won't work.

}

if include_metadata:
normalized_data["created_by"] = advisory_data.created_by
Copy link
Member

Choose a reason for hiding this comment

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

created_by is a model field, not an attribute of AdvisoryData.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants