Skip to content

Commit

Permalink
clairctl: add support for s3 registries using V4
Browse files Browse the repository at this point in the history
S3 signature V4 includes the http method on the signature. To create
URLs that clair can use to fetch layers, clairctl needs to make GET
calls instead of HEAD ones

Fixes #1264

Signed-off-by: Hector Huertas <hectorhuertas@gmail.com>
  • Loading branch information
hectorhuertas authored and hdonnay committed Jun 1, 2021
1 parent 8bcbbf1 commit 343e7da
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/clairctl/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,19 @@ func Inspect(ctx context.Context, r string) (*claircore.Manifest, error) {
if err != nil {
return nil, err
}
req, err := http.NewRequestWithContext(ctx, http.MethodHead, u.String(), nil)
req, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)
if err != nil {
return nil, err
}
req.Header.Add("Range", "bytes=0-0")
res, err := c.Do(req)
if err != nil {
return nil, err
}
res.Body.Close()

res.Request.Header.Del("User-Agent")
res.Request.Header.Del("Range")
out.Layers = append(out.Layers, &claircore.Layer{
Hash: ccd,
URI: res.Request.URL.String(),
Expand Down

0 comments on commit 343e7da

Please sign in to comment.