distribution/registry/storage
Stephen J Day 29fa466deb
registry/{storage,handlers}: limit content sizes
Under certain circumstances, the use of `StorageDriver.GetContent` can
result in unbounded memory allocations. In particualr, this happens when
accessing a layer through the manifests endpoint.

This problem is mitigated by setting a 4MB limit when using to access
content that may have been accepted from a user. In practice, this means
setting the limit with the use of `BlobProvider.Get` by wrapping
`StorageDriver.GetContent` in a helper that uses `StorageDriver.Reader`
with a `limitReader` that returns an error.

When mitigating this security issue, we also noticed that the size of
manifests uploaded to the registry is also unlimited. We apply similar
logic to the request body of payloads that are full buffered.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
(cherry picked from commit 55ea440428)
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-07-20 13:37:43 -07:00
..
cache
driver
blob_test.go
blobcachemetrics.go
blobserver.go
blobstore.go
blobwriter.go
blobwriter_nonresumable.go
blobwriter_resumable.go
catalog.go
catalog_test.go
doc.go
filereader.go
filereader_test.go
garbagecollect.go
garbagecollect_test.go
io.go
linkedblobstore.go
linkedblobstore_test.go
manifestlisthandler.go
manifeststore.go
manifeststore_test.go
paths.go
paths_test.go
purgeuploads.go
purgeuploads_test.go
registry.go
schema2manifesthandler.go
schema2manifesthandler_test.go
signedmanifesthandler.go
tagstore.go
tagstore_test.go
util.go
vacuum.go
walk.go
walk_test.go