Skip to content

Commit

Permalink
Merge pull request #103 from exasol/kaklakariada/issue102
Browse files Browse the repository at this point in the history
  • Loading branch information
kaklakariada authored Nov 13, 2023
2 parents ef2fffa + 65b93ce commit e19f1b4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
Unreleased
==========

🐞 Fixed
--------
* Fix failing vulnerability issue creator when Maven report does not contain "vulnerable" entry

🔧 Changed
----------

Expand Down
2 changes: 1 addition & 1 deletion exasol/toolbox/tools/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def gh_security_issues() -> Generator[Tuple[str, str], None, None]:
def from_maven(report: str) -> Iterable[Issue]:
# Note: Consider adding warnings if there is the same cve with multiple coordinates
report = json.loads(report)
dependencies = report["vulnerable"] # type: ignore
dependencies = report.get("vulnerable", {}) # type: ignore
for _, dependency in dependencies.items(): # type: ignore
for v in dependency["vulnerabilities"]: # type: ignore
references = [v["reference"]] + v["externalReferences"]
Expand Down
5 changes: 5 additions & 0 deletions test/unit/security_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,3 +354,8 @@ def test_convert_maven_input(maven_report): # pylint: disable=redefined-outer-n
}
actual = set(security.from_maven(maven_report))
assert actual == expected


def test_convert_maven_input_no_vulnerable(): # pylint: disable=redefined-outer-name
actual = set(security.from_maven("{}"))
assert len(actual) == 0

0 comments on commit e19f1b4

Please sign in to comment.