-
Notifications
You must be signed in to change notification settings - Fork 48
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
feat: cannot extract files outside the target directory #205
base: main
Are you sure you want to change the base?
feat: cannot extract files outside the target directory #205
Conversation
This commits adds several security controls and tests so that files cannot be extracted outside of the target directory, and hardlinks cannot point to files outside of the target directory.
|
}}, | ||
}, | ||
}, | ||
error: `cannot extract from package "test-package": cannot create path /[a-z0-9\-\/]*/file outside of root /[a-z0-9\-\/]*`, |
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.
/[a-z0-9-/]*/file
What is this path? Is it to hide the root?
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.
Yes indeed
// Root defaults to "/" if empty. | ||
Root string |
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.
Won't that be a bit risky to have /
as the default? What if Chisel overwrites the files in the system?
How about /var/lib/chisel
or $PWD
? The snap may not be able to write to the former.
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.
This is the root of the filesystem, I am not sure we can provide a good default as users may choose whatever folder they wish. But, more importantly, I put the root as /
because this is a general API and, in my opinion, the default shouldn't correspond to one use-case.
This commits adds several security controls and tests so that files
cannot be extracted outside of the target directory, and hardlinks
cannot point to files outside of the target directory.