You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The plugin can handle relative paths in different variants in a container tar file or produces an appropriate error message if input is unsupported. Please add documentation if the accepted input needs to meet special requirements which are not stated explicitly in the official spec(s): https://github.com/moby/moby/blob/master/image/spec/v1.md
Actual behaviour
Some form of relative paths are not handled correctly and produce an unexpected exception.
Steps to reproduce
Unpack the fixture archive: test/fixture/docker-archives/docker-save/nginx.tar into a subdirectory.
Repack the image in the subdirectory with: tar cf ../nginx.tar .
Run test/system/static.test.ts -> The test FAILS
Repack the image in the subdirectory with: tar cf ../nginx.tar *
Run test/system/static.test.ts -> The test PASSES
When the test fails the code produces an unexpected exception:
If the paths defined in manifest.json are not exactly like the paths in the .tar archive (check with tar -tf nginx.tar) then the plugin produces an exception.
node -v
: v12.17.0npm -v
: 6.14.4snyk -v
: 1.320.1Expected behaviour
The plugin can handle relative paths in different variants in a container tar file or produces an appropriate error message if input is unsupported. Please add documentation if the accepted input needs to meet special requirements which are not stated explicitly in the official spec(s): https://github.com/moby/moby/blob/master/image/spec/v1.md
Actual behaviour
Some form of relative paths are not handled correctly and produce an unexpected exception.
Steps to reproduce
When the test fails the code produces an unexpected exception:
The reason for the unexpected exception is that paths are used for computation in a not normalized form.
Header is stored in a Map
https://github.com/snyk/snyk-docker-plugin/blob/master/lib/extractor/layer.ts#L34
Layer are filtered from paths mentioned in manifest.json:
https://github.com/snyk/snyk-docker-plugin/blob/master/lib/extractor/layer.ts#L127
If the paths defined in manifest.json are not exactly like the paths in the .tar archive (check with tar -tf nginx.tar) then the plugin produces an exception.
Solution:
Please normalize paths before using them for any computation. (See: https://nodejs.org/api/path.html#path_path_normalize_path).
The text was updated successfully, but these errors were encountered: