-
Notifications
You must be signed in to change notification settings - Fork 255
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
Replace tar (cli) with code-only packing #808
base: master
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: astef The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Welcome @astef! |
Hi @astef. Thanks for your PR. I'm waiting for a kubernetes-csi member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
/ok-to-test |
Pull Request Test Coverage Report for Build 12367443998Details
💛 - Coveralls |
|
@astef can you sign the cla first? thx |
I had to change my email in GitHub, that's why EasyCLA now fails. Will fix it soon. |
@andyzhangx I've just finished manual test in my cluster (snapshot/restore, checked integrity of content, folder structure inside controller), and removed "WIP" prefix. Sorry for delay and back-and-forth. |
@astef thanks for the contribution, does original tar command supports symlink? |
Yes it does, here's how I check:
|
@astef then this is a regression and blocker. |
But proposed solution supports symlinks too. In "special notes" I've meant that I'm not testing symlinks in unit-tests, but they're suppored. Actually, now I think that I can write a more concrete unit-test, without |
@andyzhangx you were right, there was a regression. Up to this moment I didn't realize that |
/test pull-csi-driver-nfs-external-e2e |
|
||
fileInfo := tarHeader.FileInfo() | ||
|
||
filePath := filepath.Join(dstDirPath, tarHeader.Name) |
Check failure
Code scanning / CodeQL
Arbitrary file write extracting an archive containing symbolic links High
symlink creation
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.
Expected, since we want to preserve such links in snapshots.
} | ||
|
||
if fileInfo.Mode()&fs.ModeSymlink != 0 { | ||
if err := os.Symlink(tarHeader.Linkname, filePath); err != nil { |
Check failure
Code scanning / CodeQL
Arbitrary file write extracting an archive containing symbolic links High
symlink creation
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.
Expected, since we want to preserve such links in snapshots.
PR needs rebase. 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-sigs/prow repository. |
What type of PR is this?
/kind feature
What this PR does / why we need it:
tar
utility in the system. This is beneficial for distroless containersSpecial notes for your reviewer:
One of the important cases I've tried to support - proper symlink support. Unfortunately, symlinks happen to be not supported in the testing solution I've chosen (
golang.org/x/mod/sumdb/dirhash
), so this functionality is only tested by me manually. This can be improved, if we'll find a way to hash the resulting directories considering symlinks. I've also tried to byte-compare the resulting archives, but they contain non-deterministic information, and, therefore, not comparable.Another important case was reported by an automatic check - Arbitrary file access during archive extraction ("Zip Slip"). Issue was reproduced in test and fixed. I've chosen the error, which won't change in future versions of Go (after they will finally "turn on" their fix by default, see issue)
Does this PR introduce a user-facing change?: