testcontainers-rs icon indicating copy to clipboard operation
testcontainers-rs copied to clipboard

Support specifying images using sha256 digests

Open boazberman opened this issue 2 years ago • 4 comments

You can run docker images by specifying the sha256 digest of the designated image instead of using a specific version.

Using sha256 is somewhat more secure as it pins the exact image, thus not allowing possible overriding of a tag by a malicious actor.

Usage can be something along:

impl Image for SomeImage {
    type Args = ();

    fn name(&self) -> String {
        "some name"
    }

    fn sha256(&self) -> String {
       "a826cb8a6a0023..."
    }
}

boazberman avatar Oct 15 '22 13:10 boazberman

I intend on implementing it (as this can be useful for us), and it will be nice if the project can take part of the current hacktoberfest. Thanks!

boazberman avatar Oct 15 '22 13:10 boazberman

I am liking this idea. It would be well in line with the "Reliable" principle in our upcoming "Design principles" draft: https://github.com/testcontainers/testcontainers-rs/pull/420

We would probably have to make it an Option.

I intend on implementing it (as this can be useful for us), and it will be nice if the project can take part of the current hacktoberfest. Thanks!

I am sorry for getting back to you too late for this to make any sense.

thomaseizinger avatar Oct 31 '22 08:10 thomaseizinger

I am liking this idea. It would be well in line with the "Reliable" principle in our upcoming "Design principles" draft: #420

We would probably have to make it an Option.

I intend on implementing it (as this can be useful for us), and it will be nice if the project can take part of the current hacktoberfest. Thanks!

I am sorry for getting back to you too late for this to make any sense.

Cool, just now saw your comment, will try to implement that tomorrow!

boazberman avatar Dec 23 '22 15:12 boazberman

I had created a PR: https://github.com/testcontainers/testcontainers-rs/pull/446

boazberman avatar Dec 31 '22 11:12 boazberman