-
Notifications
You must be signed in to change notification settings - Fork 66
add chainguard osv feed #1205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add chainguard osv feed #1205
Changes from 11 commits
23f58ab
f23b0d4
f891e06
cc4f1ba
e66814d
3c57a24
018b3b0
0dc4a64
39b57d5
85d0924
fdba76e
ac09f22
0cd4493
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ | |
| from vunnel import provider, result, schema | ||
| from vunnel.utils import timer | ||
|
|
||
| from .parser import Parser | ||
| from .parser import SecDBParser | ||
|
|
||
| if TYPE_CHECKING: | ||
| import datetime | ||
|
|
@@ -24,7 +24,9 @@ class Config: | |
| request_timeout: int = 125 | ||
| # Override with VUNNEL_PROVIDERS_WOLFI_SECDB_URL | ||
| secdb_url: str = "https://packages.wolfi.dev/os/security.json" | ||
|
|
||
| # Override with VUNNEL_PROVIDERS_WOLFI_ENABLE | ||
| # Enable allows us to switch to an OSV feed in the future if/when one becomes available | ||
| enable: bool = True | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does this have a different name for Wolfi than for Chainguard?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because the Wolfi information is in the same OSV feed as the chainguard info, so to have wolfi use the chainguard information it would be
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What should the distro field be? I think some images have
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My understanding is this: at some point, Wolfi will stop being it's own namespace (all the data will be in the chainguard feed), and this gives us a config-only switch to turn off the wolfi feed when that happens. makes sense and looks good.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We still have both. If you look at https://packages.cgr.dev/chainguard/v3/osv/CGA-27xx-xp52-rjpm.json as an example, we have two affected entries: one for Chainguard and one for Wolfi |
||
|
|
||
| class Provider(provider.Provider): | ||
| __schema__ = schema.OSSchema() | ||
|
|
@@ -40,12 +42,13 @@ def __init__(self, root: str, config: Config | None = None): | |
|
|
||
| self.logger.debug(f"config: {config}") | ||
|
|
||
| self.parser = Parser( | ||
| self.parser = SecDBParser( | ||
| workspace=self.workspace, | ||
| url=config.secdb_url, | ||
| namespace=self._namespace, | ||
| download_timeout=self.config.request_timeout, | ||
| logger=self.logger, | ||
| skip_download=self.config.runtime.skip_download, | ||
| ) | ||
|
|
||
| # this provider requires the previous state from former runs | ||
|
|
@@ -59,7 +62,15 @@ def name(cls) -> str: | |
| def tags(cls) -> list[str]: | ||
| return ["vulnerability", "os"] | ||
|
|
||
| @classmethod | ||
| def supports_skip_download(cls) -> bool: | ||
| return True | ||
|
|
||
| def update(self, last_updated: datetime.datetime | None) -> tuple[list[str], int]: | ||
| if not self.config.enable: | ||
|
willmurphyscode marked this conversation as resolved.
|
||
| self.logger.info("Provider is disabled via config, skipping update") | ||
| return [], 0 | ||
|
|
||
| with timer(self.name(), self.logger): | ||
| with self.results_writer() as writer, self.parser: | ||
| # TODO: tech debt: on subsequent runs, we should only write new vulns (this currently re-writes all) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a problem if this always reports OSSchema? I ensured the argument to
writer.writebelow is the actual, correct schema