schema1: Validate descriptors in AppendReference
If the digest is malformed, it will cause a panic when building the manifest. Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>master
							parent
							
								
									bf27f260cd
								
							
						
					
					
						commit
						ec5fa1f9d6
					
				|  | @ -240,8 +240,13 @@ func (mb *configManifestBuilder) emptyTar(ctx context.Context) (digest.Digest, e | |||
| 
 | ||||
| // AppendReference adds a reference to the current ManifestBuilder
 | ||||
| func (mb *configManifestBuilder) AppendReference(d distribution.Describable) error { | ||||
| 	// todo: verification here?
 | ||||
| 	mb.descriptors = append(mb.descriptors, d.Descriptor()) | ||||
| 	descriptor := d.Descriptor() | ||||
| 
 | ||||
| 	if err := descriptor.Digest.Validate(); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 
 | ||||
| 	mb.descriptors = append(mb.descriptors, descriptor) | ||||
| 	return nil | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue