Skip to content

Commit

Permalink
fix: cosign chaged error code
Browse files Browse the repository at this point in the history
Cosign changed its error code for non existant images and missing signatures in transparency logs, resulting connaisseur in throwing wrong errors as well. This has been fixed.
  • Loading branch information
phbelitz committed Nov 4, 2022
1 parent a7b100a commit b60de4e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions connaisseur/validators/cosign/cosign_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def __get_cosign_validated_digests(self, image: str, trust_root: dict):
trust_root=trust_root["name"],
)
elif (
"Error: no matching signatures:\nsignature not found in transparency log\n"
"Error: no matching signatures:\nsearching log query:"
in stderr
):
msg = "Failed to find signature in transparency log."
Expand All @@ -217,7 +217,7 @@ def __get_cosign_validated_digests(self, image: str, trust_root: dict):
image=str(image),
trust_root=trust_root["name"],
)
elif "Error: entity not found in registry\nmain.go:" in stderr:
elif "MANIFEST_UNKNOWN" in stderr:
msg = 'Image "{image}" does not exist.'
raise NotFoundException(
message=msg,
Expand Down
4 changes: 2 additions & 2 deletions tests/data/cosign/does_not_exist.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Error: entity not found in registry
main.go:46: error during command execution: entity not found in registry
Error: GET https://index.docker.io/v2/library/testimage/manifests/v1: MANIFEST_UNKNOWN: manifest unknown; unknown tag=v1
main.go:62: error during command execution: GET https://index.docker.io/v2/library/testimage/manifests/v1: MANIFEST_UNKNOWN: manifest unknown; unknown tag=v1
2 changes: 1 addition & 1 deletion tests/data/cosign/notfound_in_tl.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Error: no matching signatures:
signature not found in transparency log
searching log query:

0 comments on commit b60de4e

Please sign in to comment.