CVE-2019-11251: Remove symlink support from kubectl cp#82143
CVE-2019-11251: Remove symlink support from kubectl cp#82143k8s-ci-robot merged 1 commit intokubernetes:masterfrom
Conversation
|
/sig cli |
|
There was a problem hiding this comment.
rather than holding a pointer to the command, consider storing the name of the parent command here (e.g. o.ExecParentCmdName = cmd.Parent().Name()
then, make the hint about using exec condition on ExecParentCmdName being non-empty. that way, CopyOptions stays reusable
There was a problem hiding this comment.
this should refer users to help describing how to use exec for symlink support... it is not immediately obvious how you would do that (even just see cp command help for details)
There was a problem hiding this comment.
nit: this is verbose for an error that might be printed a bunch of times. Maybe simplify it to something like:
| fmt.Fprintf(o.IOStreams.ErrOut, "warning: file %q is a symlink, skipping (consider using %s exec for symlink support)\n", destFileName, o.cmd.Parent().Name()) | |
| fmt.Fprintf(o.IOStreams.ErrOut, "skipping symlink: %q -> %q\n", destFileName, linkTarget) |
There was a problem hiding this comment.
I'd tend to agree. the pointer to exec can be printed just once
There was a problem hiding this comment.
This continue makes no difference, so I think it should be omitted.
Another alternative (my personal favorite) would be to remove the else and keep the continue to make the code path even cleaner and easier to read.
There was a problem hiding this comment.
Fair point, I prefer the no else approach too.
There was a problem hiding this comment.
I think o.cmd can be nil in some of the tests, as the o.Complete func that sets cmd isn't executed in all of them. The applies to at least TestTarUntar.
|
/milestone v1.16 |
|
@liggitt @tallclair @odinuge updated, sample output: |
|
/retest |
1 similar comment
|
/retest |
There was a problem hiding this comment.
nit: does this copy to /tmp/bar like the description says?
There was a problem hiding this comment.
nit: does this copy to /tmp/bar like the description says?
|
@liggitt nits addressed, comments answered, ptal |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: liggitt, soltysh The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
| evaledPath, err := filepath.EvalSymlinks(baseName) | ||
| if mode&os.ModeSymlink != 0 { | ||
| if !symlinkWarningPrinted && len(o.ExecParentCmdName) > 0 { | ||
| fmt.Fprintf(o.IOStreams.ErrOut, "warning: file %q is a symlink, skipping (consider using \"%s exec -n %q %q -- tar cf - %q | tar xf -\")\n", destFileName, o.ExecParentCmdName, src.PodNamespace, src.PodName, src.File) |
There was a problem hiding this comment.
nit: I would make this error message more consistent with the other one, so they can be visually scanned together
| fmt.Fprintf(o.IOStreams.ErrOut, "warning: file %q is a symlink, skipping (consider using \"%s exec -n %q %q -- tar cf - %q | tar xf -\")\n", destFileName, o.ExecParentCmdName, src.PodNamespace, src.PodName, src.File) | |
| fmt.Fprintf(o.IOStreams.ErrOut, "warning: skipping symlink: %q -> %q (consider using \"%s exec -n %q %q -- tar cf - %q | tar xf -\")\n", destFileName, o.ExecParentCmdName, src.PodNamespace, src.PodName, src.File) |
|
/retest Review the full test history for this PR. Silence the bot with an |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Based on the recent discussion in SIG-CLI we've decided to drop support when copying data from pods.
Special notes for your reviewer:
/assign @liggitt @tallclair
Only the second commit matters, the first is coming from #82087
Fixes #87773
Does this PR introduce a user-facing change?: