-
Notifications
You must be signed in to change notification settings - Fork 172
Description
Repro steps:
reg vulns --clair ubuntu:latest
Actual Result:
2018/12/14 14:17:10 clair.layers.post url=http://127.0.0.1:6050/v1/layers name=
2018/12/14 14:17:10 clair.layers.post req.Body={"Layer":{"Path":"https://quay.io/v2/chris_ricci/wordpress-nginx-php5/blobs/","Format":"Docker"}}
2018/12/14 14:17:10 clair.layers.post resp.Status=400 Bad Request
clair error: could not process a layer which does not have a name
Root cause:
Given that ubuntu:latest has empty layers,
https://github.com/genuinetools/reg/blob/master/clair/vulns.go#L34
filteredLayers is a dictionary map[int]distribution.Descriptor, but here, it's being used as a list.
When calling NewClairLayer, some indexes are missing because we skipped the empty layers, but since go map defaults to construct the default distribution.Descriptor, the name is empty.