Skip to content
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

Possiblity to run Syft on a Dockerfile #1074

Open
vargenau opened this issue Jun 29, 2022 · 6 comments
Open

Possiblity to run Syft on a Dockerfile #1074

vargenau opened this issue Jun 29, 2022 · 6 comments
Labels

Comments

@vargenau
Copy link
Contributor

What would you like to be added:

It would be nice to be able to run Syft on a Dockerfile.

Why is this needed:

Additional context:

Tern allows this.

@vargenau vargenau added the enhancement New feature or request label Jun 29, 2022
@joshbressers
Copy link
Contributor

@vargenau Do you know how tern accomplishes this?

@bureado
Copy link
Contributor

bureado commented Jul 6, 2022

In case it helps, https://github.com/tern-tools/tern/blob/main/tern/analyze/default/dockerfile/run.py

But also see moby/buildkit#2773

I would love to hear more about the use cases here. Is this something that should sit between hadolint and docker sbom? If so, why? Build tool independence? Fast inner loop? Honestly interested.

@vargenau
Copy link
Contributor Author

vargenau commented Jul 6, 2022

@vargenau Do you know how tern accomplishes this?

I do not really know. I am testing both Syft and Tern and comparing features and results.

@joshbressers
Copy link
Contributor

In case it helps, https://github.com/tern-tools/tern/blob/main/tern/analyze/default/dockerfile/run.py

That process looks very heavy and error prone. I think it would make more sense given the state of all tooling to just build a dockerfile then scan it rather than having Syft try to untangle the layers

@bureado
Copy link
Contributor

bureado commented Jul 18, 2022

In case it helps, https://github.com/tern-tools/tern/blob/main/tern/analyze/default/dockerfile/run.py

That process looks very heavy and error prone. I think it would make more sense given the state of all tooling to just build a dockerfile then scan it rather than having Syft try to untangle the layers

I tend to agree.

I'm still curious about the use cases but IMHO static analysis will be extremely limited for the SBOM use case, and anything related to packages/dependencies at that level can probably be handled (if it isn't already) by linters.

There's a spectrum of dynamic analysis options (like the buildkit one mentioned above, another one that comes to mind is docker-slim) that all basically involve building the image anyway at which point running syft over the built image yields the best results.

In general, I think trying to produce an SBOM from an otherwise non-annotated Dockerfile can only yield an "envelope" SBOM, e.g., reference the base file, reference it's part of a larger codebase but not actually get into component substance without dynamic introspection at which point the OCI image has already materialized somewhere syft can catalog it.

@bureado
Copy link
Contributor

bureado commented Jul 20, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

4 participants