@@ -242,6 +242,7 @@ type BlobInfoCache interface {
242242//
243243// WARNING: Various methods which return an object identified by digest generally do not
244244// validate that the returned data actually matches that digest; this is the caller’s responsibility.
245+ // See the individual methods’ documentation for potentially more details.
245246type ImageSource interface {
246247 // Reference returns the reference used to set up this source, _as specified by the user_
247248 // (not as the image itself, or its underlying storage, claims). This can be used e.g. to determine which public keys are trusted for this image.
@@ -252,10 +253,17 @@ type ImageSource interface {
252253 // It may use a remote (= slow) service.
253254 // If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve (when the primary manifest is a manifest list);
254255 // this never happens if the primary manifest is not a manifest list (e.g. if the source never returns manifest lists).
256+ //
257+ // WARNING: This is a raw access to the data as provided by the source; if the reference contains a digest, or instanceDigest is set,
258+ // callers must enforce the digest match themselves, typically by using image.UnparsedInstance to access the manifest instead
259+ // of calling this directly. (Compare the generic warning applicable to all of the [ImageSource] interface.)
255260 GetManifest (ctx context.Context , instanceDigest * digest.Digest ) ([]byte , string , error )
256261 // GetBlob returns a stream for the specified blob, and the blob’s size (or -1 if unknown).
257262 // The Digest field in BlobInfo is guaranteed to be provided, Size may be -1 and MediaType may be optionally provided.
258263 // May update BlobInfoCache, preferably after it knows for certain that a blob truly exists at a specific location.
264+ //
265+ // WARNING: This is a raw access to the data as provided by the source; callers must validate the contents
266+ // against the blob’s digest themselves. (Compare the generic warning applicable to all of the [ImageSource] interface.)
259267 GetBlob (context.Context , BlobInfo , BlobInfoCache ) (io.ReadCloser , int64 , error )
260268 // HasThreadSafeGetBlob indicates whether GetBlob can be executed concurrently.
261269 HasThreadSafeGetBlob () bool
0 commit comments