-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add utility functions to get name of GNU tar executable in OS-agnostic manner #276
Conversation
python/python/bystro/utils/tar.py
Outdated
|
||
|
||
# here and throughout, fully qualify executable names to avoid privilege escalation | ||
GNU_TAR_LINUX = "/usr/bin/tar" |
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.
Can we use something like which
to locate this? I'm not sure what privilege escalation is possible with that approach, please help me understand
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.
Thanks, good call, updated to use which to locate these.
In re privilege escalation, if command line names aren't fully qualified, a malicious user with access to $PATH could save an executable named tar
in a location that had precedence over /usr/bin and get up to shenanigans. Not the biggest risk in this scenario but it's a belt and suspenders kind of thing.
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 question and request for install script update
@akotlar mind taking another look? Main changes:
|
@poneill merge at your convenience |
At various points in annotation file processing we rely on tar to compress or decompress files. In particular, we use GNU tar and use certain features that are specific to that implementation. On linux, GNU tar is the default. On MacOSX, however, the default implementation is bsdtar, which is not fully compatible with GNU tar. If we end up calling bsdtar when we mean GNU tar, subtle bugs can result.
So, in order to run tar correctly we need to know which OS we're running it on and specify the correct executable name for GNU tar (or raise an error if it isn't installed). This commit defines a utils module that provides a runtime constant GNU_TAR_EXECUTABLE_NAME valid under linux or MacOSX.
Closes #277