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

ContainerImage isn't validated in environments endpoints #551

Closed
Panaetius opened this issue Nov 29, 2024 · 3 comments · Fixed by #574
Closed

ContainerImage isn't validated in environments endpoints #551

Panaetius opened this issue Nov 29, 2024 · 3 comments · Fixed by #574

Comments

@Panaetius
Copy link
Member

Panaetius commented Nov 29, 2024

We should validate that the image name for an environment is actually a valid image identifier. Currently it accepts any character, including spaces. This then causes session launch to fail because it can't find the image, but is very difficult to spot that this happened in the input field. (so renku/myimage doesn't work where renku/myimage works).

ideally we'd also validate this in the UI.
For reference, one of these two won't launch(due to a space in the beginning):
image
image

@leafty
Copy link
Member

leafty commented Nov 29, 2024

Thanks @Panaetius, for the UI side, we could use trimming before sending. Is there a validation rule for container image references?

@Panaetius
Copy link
Member Author

Panaetius commented Nov 29, 2024

https://docs.docker.com/reference/cli/docker/image/tag/ describes it a bit, which refers to this spec: https://github.com/opencontainers/distribution-spec/blob/main/spec.md#pulling-manifests which has [a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*(\/[a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*)* for the image name/path and [a-zA-Z0-9_][a-zA-Z0-9._-]{0,127} for the tag, if I'm reading this correctly.

I don't think there's a ready made rule available for this in pydantic or similar.

@leafty
Copy link
Member

leafty commented Nov 29, 2024

OK, thanks! Not sure if this is usable at the moment since it does not seem to cover using a digest (which is valid).

Example: renku/renkulab-py@sha256:eceed25752d7544db159e4144a41ed6e96e667f39ff9fa18322d79c33729a18c. This uses the index digest, so is a reference to a multi-arch image. This works perfectly fine for a Renku 2.0 session.
Registry page: https://hub.docker.com/layers/renku/renkulab-py/3.11-6e408a8/images/sha256-9f3940e65bd1f30c8963a2ce501afa740dd151f7e19181d43ddd3d12c9934339

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants