Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
  • Loading branch information
TG1999 committed Jan 5, 2023
1 parent 0853bdb commit 5fcf2b7
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions vulnerabilities/importers/elixir_security.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from vulnerabilities.importer import Importer
from vulnerabilities.importer import Reference
from vulnerabilities.utils import load_yaml
from vulnerabilities.utils import is_cve

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -46,15 +47,18 @@ def process_file(self, path):
cve_id = ""
summary = yaml_file.get("description") or ""
pkg_name = yaml_file.get("package") or ""
if not pkg_name:
return []

cve = yaml_file.get("cve") or ""

if cve and not cve.startswith("CVE-"):
cve = yaml_file["cve"]
cve_id = f"CVE-{cve}"

if not cve_id:
return []

if not is_cve(cve_id):
return []

references = []
link = yaml_file.get("link") or ""
if link:
Expand Down Expand Up @@ -82,18 +86,16 @@ def process_file(self, path):
VersionConstraint.from_string(version_class=vrc, string=version).invert()
)

affected_packages.append(
AffectedPackage(
package=PackageURL(
type="hex",
name=pkg_name,
),
affected_version_range=HexVersionRange(constraints=constraints),
if pkg_name:
affected_packages.append(
AffectedPackage(
package=PackageURL(
type="hex",
name=pkg_name,
),
affected_version_range=HexVersionRange(constraints=constraints),
)
)
)

if not cve_id:
return []

yield AdvisoryData(
aliases=[cve_id],
Expand Down

0 comments on commit 5fcf2b7

Please sign in to comment.