-
Notifications
You must be signed in to change notification settings - Fork 636
Default image source does not validate url when interpreting scheme as image #1695
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
Comments
Hi @xtreme-conor-nosal, if we're reading this right, "registry:" needs to be the very first part of the image source. If you put it after the https:// it will indeed be interpreted as a URL. Can you try this scheme instead?
Can you share the exact test command you are using? We might be misunderstanding the problem here. |
Looking at the above output:
This is a distraction:
If
|
Because of the ambiguity between scheme/image, syft doesn't know which of the two errors is "correct". However the presentation is confusing because one is labeled warning and the other error, effectively giving a priority to one by drawing the eye. Instead of making heuristics more clever, perhaps the better request is to have a non-ambiguous way to provide a scheme? |
This edge case has always been a problem. We've attempted to account for this, but this code path has gotten more complex over time. I've created #1783 to capture how this could be made better in the future. For now, there may be a way to capture all of the errors from these attempts and make the logging a little more apparent about what went wrong without needing debug level logging enabled. |
What happened:
Syft has a check to retry fetching an image if the docker: or registry: scheme was provided, in case of possible ambiguity and the user wants to scan the
docker
orregistry
image from dockerhub (or the environment's default search registry).If the first interpretation was correct, trying to reinterpret the scheme as image can lead to fetch attempts that can't succeed and misleading log messages.
e.g.
What you expected to happen:
Syft should validate if interpreting the scheme as image results in a valid image.
e.g. parsing
https://registry:myhost:5000/test/app:sha
is not a valid image url, so the potential ambiguity can be ruled out, and a second fetch does not need to be attempted.Steps to reproduce the issue:
Run syft with a
registry:
scheme specified and an image url that will fail.The text was updated successfully, but these errors were encountered: