Skip to content

Commit 62b8d96

Browse files
committed
feat: trivy OS detection workaround
1 parent 19c046f commit 62b8d96

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

stack_scanner/main.py

+6
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ def scan_image(
142142
cosign_output = json.loads(result.stdout.decode("utf-8"))
143143
payload = base64.b64decode(cosign_output["payload"]).decode("utf-8")
144144
sbom = json.loads(payload)["predicate"]
145+
146+
# Required workaround for Trivy to recognize the OS
147+
for component in sbom.get("components", []):
148+
if component.get("type") == "operating-system" and component.get("name") == "rhel":
149+
component["name"] = "redhat"
150+
145151
with open("/tmp/stackable/bom.json", "w") as f:
146152
json.dump(sbom, f)
147153
else:

0 commit comments

Comments
 (0)