New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix docker cp issues BZ1723491 & BZ1717087 #348
Fix docker cp issues BZ1723491 & BZ1717087 #348
Conversation
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
|
This is a WIP until I can have @edsantiago run tests on it. Please review prior, I believe it's gtg. |
| // to the container.Basefs to get the full container target directory | ||
| // on the host. | ||
| if fileInfo.Mode()&os.ModeSymlink != 0 { | ||
| resolvedCtrDir = filepath.Join(container.BaseFS, resolvedCtrDir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we ensure that after the Join the path is still under container.BaseFS?
Could happen that resolvedCtrDir has .. components, so it can potentially point outside of the basefs once we do the join?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I played with it tonight, and excellent spot. I think I've a solution for that, testing now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I played more and add a symlink in the container like: ln -s /tmp ../../../../../../testy and that just resolved to the root directory of the container. However I did come up with a quick check that will make it completely safe, so I've added it.
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
|
@TomSweeneyRedHat I am confused by this, is this ready Now? |
|
@rhatdan yes, ready to go given LGTM's which I don't have any atm. |
|
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Commit cec24f5 is still marked as WIP though.
|
this was fixed by another PR. Let's close it |
|
@giuseppe So should we close this PR? |
Signed-off-by: TomSweeneyRedHat tsweeney@redhat.com
- What I did
There are two BZs https://bugzilla.redhat.com/show_bug.cgi?id=1723491 and https://bugzilla.redhat.com/show_bug.cgi?id=1717087 reporting an issue using
docker cpto a container. Upon testing, further issues were discovered if the target in the container was a symlink. This code finds the target directory on the host's local container storage (/var/lib/docker/overlay2), resolves any symlinks and ensures the file gets copied to/from the container without any potential cve leakage.- How I did it
VI and lots of blood, sweat and tears for this one.
- How to verify it
- Description for the changelog
Addresses docker cp issue noted in BZ1717087 and BZ1723491
- A picture of a cute animal (not mandatory but encouraged)