Skip to content

Commit

Permalink
fix: skip malformed sboms (#2461)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jabolol authored Nov 10, 2024
1 parent 41b99cf commit d98bec5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion warehouse/oso_dagster/dlt_sources/github_repos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import dlt
from oso_dagster.factories.dlt import pydantic_to_dlt_nullable_columns
import polars as pl
from pydantic import BaseModel
from pydantic import BaseModel, ValidationError
from githubkit import GitHub
from githubkit.exception import RequestFailed
from githubkit.versions.latest.models import (
Expand Down Expand Up @@ -324,6 +324,16 @@ def get_sbom_for_repo(
else:
logger.warning("Error getting SBOM: %s", exception)
return []
except ValidationError as exception:
validation_errors = [
f"{error['loc'][0]}: {error['msg']}" for error in exception.errors()
]
logger.warning(
"Skipping %s, SBOM is malformed: %s",
f"{owner}/{name}",
", ".join(validation_errors),
)
return []

@staticmethod
def get_github_client(config: GithubClientConfig) -> GitHub:
Expand Down

0 comments on commit d98bec5

Please sign in to comment.