-
Notifications
You must be signed in to change notification settings - Fork 368
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
Support symbolic links in archive files #359
Comments
This PR extends the downloader to support symlinks in tarball archives. Fixes kubernetes-sigs#359
This PR extends the downloader to support symlinks in tarball archives. addresses kubernetes-sigs#359
We should probably do some research ahead of time before allowing this. Nearly all client software that deals with symlinks in downloaded payload exposes security vulnerabilities down the line based on my observation. Kubectl was subject to this too. |
ok. electron client builds will be filled with symlinks. |
I think we might be ok with evaluating the symlink and see if it goes above the plugin install directory. We do similar checks elsewhere. That might help with the security aspect. |
nice, that makes sense |
I have strong reservations against allowing symlinks in tarballs.
These repeated vulnerabilities bound considerable development resources and also posed a threat to the reputation of k8s with regards to security. As a result, there is now a KEP that will almost certainly lead to dropping support for symlinks in I don't think that we can reasonably assume that we are going to be smarter than the kubectl core developers when it comes to making symlinks secure. Therefore, we should not do it. @starpit Would it possible to build plugin bundles without symlinks? |
@corneliusweig commented:
the issue is particularly problematic on macos, where applications are really directories, and chromium uses many symlinks therein:
keep in mind that all but the last two rows are the compressed sizes. |
I see, thanks for checking this out. Would those exploded bundles still work, or does symlink dereferencing even break the application? Now for |
i believe that the symlink-dereferenced applications work. most of these come from macOS Framework versioning (e.g. Current -> ) i will quantify windows and linux. it is possible those platforms do not suffer from the same egregious symlinking issue. |
confirmed: linux and windows suffer not at all from the symlink issue. this seems only to affect macOS application bundles. $ find dist/electron/Kui-win32-x64 -type l | wc -l
0
$ find dist/electron/Kui-linux-x64 -type l | wc -l
0
$ find dist/electron/Kui-darwin-x64 -type l | wc -l
19 |
should i take a shot at updating krew to use an external tar (or all tarball extractions?) on macos? |
I'd actually be more hesitant to maintain two code paths for this and deal with GNU tar vs BSD tar. I think we have a rather safe(r) handling of symlinks so far. For example, we let developers choose what plugin binary must be symlinked via the I think for our tar code, we can consider a similar check to make sure the resulting symlinks still lies within the extraction directory. (That would still work, right?) |
it does seem that, with some specific and heavy restrictions, we could have safe symlink support. cornelius raises a good point that rolling our own does mean that the security implications are in our hands. the tar "Security Rules of Thumb" advises:
which i think krew does. i will update my PR so that
1 and 2b? Update: another thought; we could disallow symlinks to any enclosing (or absolute) path. e.g. ok: foo -> bar/baz error: foo -> /path/to/danger the last one is possibly valid, but requires that we maintain code that recognizes correctly where the "top" lies. |
yeah it's valid. we already have code for this for symlinking the plugins today. we make sure even our link is not escaping where it's supposed to link to (since |
/retitle Support symbolic links in archive files |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
i have a tar.gz file that contains symlinks. when krew (0.3.1) tries to install my archive, i see this error:
that file is a symlink, and the first symlink in the archive. i don't see anything else special about it that might lead to errors.
The text was updated successfully, but these errors were encountered: