-
Notifications
You must be signed in to change notification settings - Fork 181
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
disallow absolute file path in oras push
and oras attach
by default
#980
Comments
@suganyas I am not sure packaging an absolutely pathed artifact is intended in your case. If it's not, maybe oras should guide our users not to produce those artifacts in 2.0? |
Hi @qweeah thanks for looking into it . I just tried to push an artifact file from linux environment from a absolute path or from different directory. The path is implicitly taken by the oras cli or oras sdk when I pushed it. Like the file was in a directory /home/vts/1/a.exe. and I pushed from /home/test. I am ok if the push fails stating me that the file is not in the current directory and for security reasons you have to be in same working directory. But the push passes and pull fails . So disallow is a much better option. I am sure when I used ORAS python SDK it did fail with error stating as here https://github.com/oras-project/oras-py/blob/209c9b98043a00d1b04789cc2967ca7021dc5b2e/oras/provider.py#L651 . The CLI should have same behaviour as SDK. Then push and pull are coherent. It can be a bad experience when push is ok and pull fails and when different people do it can be hard for people to understand why it fails |
@qweeah I am happy to contribute or make changes according to our decision |
@suganyas My idea is that it's better to prevent user from using absolute path. @FeynmanZhou @shizhMSFT @TerryHowe what do you think? P.S. This issue introduces breaking change and need to be enabled for ORAS 2.0 release. |
This will change the default behavior of
I think our intention is to recommend users use a relative path by default but provide an option for users who stick to using an absolute path across different targets. We need to clearly define the error messages when users use the absolute path when pushing/attaching without specifying the |
I have a question @FeynmanZhou @qweeah on disallow abs path by default. This means push will be successful for an abs path only when --allow-absolute-path path is enabled during oras push?? It will be a new flag added? I don't see it now in oras and when pull fails with path traversal error tell them to use allow-path-traversal. Am I understanding it right? |
@suganyas The discussion by @FeynmanZhou was for Here are more insights: Using absolute paths with |
@shizhMSFT thanks for the clarification. So these are the changes we need to do in version v2.0.0 (prevent default push from absolute path and proper error message to help to identify the issue because pull and push can be done in different systems and persons)
|
@qweeah @suganyas After digging into the code, I noticed that we just found a bug. There is already a flag named --disable-path-validation skip path validation However, this flag is incorrectly implemented. By looking at the current implementation: Line 142 in 365ad23
At the first glance, it seems correct. However, it is wrong since the file store is the source for reading and thus We need to fix it by properly implementing the flag |
@qweeah |
@shizhMSFT Thanks for pointing out. I forgot we already have this flag. Created an issue #983 The question is: If we fixed this bug, what default value should we give it? Since |
@qweeah It is a bug not a feature. The interface and default value are by design but the behaviour of the implementation mismatches the design. Therefore, fixing this bug is not considered as a breaking change. |
Path validation flag requires checking on whether the input file paths are in the sub-folder of current working directory. What we want to achieve is disable pushing artifacts containing absolute path by default. There is a subtle difference between those two, like: What if the file path is in current working directory but is presented as absolute format? Should we allow pushing of it I think for the scope of #983, we can fix the path validation and allow pushing such files. But in 2.0, we should disable that. @shizhMSFT |
No, we should not allowing pushing it by default as it is not pullable by default. |
Marking this issue as a duplicate of #983 |
What is the version of your ORAS CLI
oras 1.0.0
What would you like to be added?
By default, disable pushing files with absolute file path in
oras push
andoras attach
, add a new flag, like--allow-absolute-path
to support glass-breaking scenarios.The artifact packed via
oras attach/push --allow-absolute-path
can only be pulled viaoras pull --T/allow-path-traversal
Why is this needed for ORAS?
Absolutely pathed layers are dangerous, since
Are you willing to submit PRs to contribute to this feature?
The text was updated successfully, but these errors were encountered: