Skip to content

Commit

Permalink
Fix response integrity check bug (#23) and fix missing tests data (#25)
Browse files Browse the repository at this point in the history
* Remove response integrity check of config.json and layer

This change is being made because the `Docker-Content-Digest` value
sent back by docker distribution is a hash digest from the image
manifest list when only the image manifest is accepted by the client.

This issue on docker distribution tracks the regression:
distribution/distribution#2395

Fixes #23

Issue #24 tracks reverting this change when the docker distribution
issue is resolved.

* Add the hocker tests data files

This fixes a test failure caused by the tests data dir not being
included in the cabal source distribution.
  • Loading branch information
ixmatus authored Dec 1, 2017
1 parent 9e10392 commit 63129b1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 3 additions & 0 deletions hocker.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ extra-source-files:
README.md
CHANGELOG.md

data-dir:
test/data

source-repository head
type: git
location: https://github.com/awakesecurity/hocker.git
Expand Down
3 changes: 1 addition & 2 deletions src/Network/Wreq/Docker/Image.hs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ fetchLayer =
writeC <- liftIO $ getConcurrentOutputter
liftIO . writeC . Text.unpack $ "Downloading layer: " <> shortRef

fetchedImageLayer <- checkResponseIntegrity' =<< Docker.Registry.fetchLayer ("sha256:" <> layerDigest)
fetchedImageLayer <- Docker.Registry.fetchLayer ("sha256:" <> layerDigest)
layerPath <- writeRespBody layerOut layerDigest fetchedImageLayer

liftIO . writeC $ Text.unpack ("=> wrote " <> shortRef)
Expand All @@ -125,7 +125,6 @@ fetchConfig =
runHocker $ ask >>= \HockerMeta{..} -> do
configDigest <-
fetchManifest
>>= checkResponseIntegrity'
>>= getConfigDigest . view Wreq.responseBody

fetchImageConfig configDigest
Expand Down

0 comments on commit 63129b1

Please sign in to comment.