-
Couldn't load subscription status.
- Fork 9.1k
HADOOP-19031. Enhance access control for RunJar. #6427
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
Conversation
|
💔 -1 overall
This message was automatically generated. |
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.
We are creating the directory & then setting the permissions, so there is some time b/w the two operations, theoritically where things can go nasty.
As of now we are using File.createTempFile("hadoop-unjar", "", tmpDir); can we explore using Files.createTempFile(path, null, "", PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("<perm>")));(If it works)? or just Files.createTempFile
The javadoc reads
The attrs parameter is optional file-attributes to set atomically when creating the file. Each attribute is identified by its name. If more than one attribute of the same name is included in the array then all but the last occurrence is ignored. When no file attributes are specified, then the resulting file may have more restrictive access permissions to files created by the File.createTempFile(String, String, File) method.
I guess it might do things atomically
|
@ayushtkn Thanks for your comments. I want to fix it simple and don't involve more changes since I didn't know the background of the current implement: 'create - delete - mkdir'.
True, this way may include some potential issue. Will try to update it later. Thanks. |
|
I think we don't need consider atomicity here. The directory is created with permission 755 by default, so no one else can write any data to it. And because this is still an empty directory, no data can be read from it. @Hexiaoqiao @ayushtkn |
85108b8 to
872cc23
Compare
|
Attach Javadoc about Files.createTempDirectory(). https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#createTempDirectory-java.nio.file.Path-java.lang.String-java.nio.file.attribute.FileAttribute...- Considering that this method can loop generate random names until file or directory can be created, And invoked to check write access when creating the directory. So it didn't need to delete and mkdir again IMO. FYI. |
|
💔 -1 overall
This message was automatically generated. |
|
All failed unit tests are related with 'Caused by: java.lang.OutOfMemoryError: unable to create new native thread'. Any changes about CI recently? I am confused this PR didn't create any new thread here but why thread overload. |
|
this unable to create native thread is intermittent, can trigger the build again & it should be sorted... if the build comes clean, the change looks good to me, I haven't tried locally, do give a check once before merging. |
|
Trigger CI again, let's wait what it will say. |
|
💔 -1 overall
This message was automatically generated. |
… by He Xiaoqiao. Signed-off-by: Shuyan Zhang <[email protected]> Signed-off-by: Shilun Fan <[email protected]> Signed-off-by: Ayush Saxena <[email protected]> (cherry picked from commit 9634bd3)
… by He Xiaoqiao. Signed-off-by: Shuyan Zhang <[email protected]> Signed-off-by: Shilun Fan <[email protected]> Signed-off-by: Ayush Saxena <[email protected]> (cherry picked from commit 9634bd3)
|
Committed to trunk, branch-3.4, branch-3.4.0. Thanks @zhangshuyan0 @ayushtkn @slfan1989 . |
…ibuted by He Xiaoqiao. Signed-off-by: Shuyan Zhang <[email protected]> Signed-off-by: Shilun Fan <[email protected]> Signed-off-by: Ayush Saxena <[email protected]>
… by He Xiaoqiao. Signed-off-by: Shuyan Zhang <[email protected]> Signed-off-by: Shilun Fan <[email protected]> Signed-off-by: Ayush Saxena <[email protected]> (cherry picked from commit 9634bd3)
…6427). Contributed by He Xiaoqiao. Signed-off-by: Shuyan Zhang <[email protected]> Signed-off-by: Shilun Fan <[email protected]> Signed-off-by: Ayush Saxena <[email protected]> Change-Id: Ic0ef7f58c8285c8e51e58156cd07e5a5c14074e4
…ibuted by He Xiaoqiao. Signed-off-by: Shuyan Zhang <[email protected]> Signed-off-by: Shilun Fan <[email protected]> Signed-off-by: Ayush Saxena <[email protected]>
… (apache#6427). Contributed by He Xiaoqiao. Signed-off-by: Shuyan Zhang <[email protected]> Signed-off-by: Shilun Fan <[email protected]> Signed-off-by: Ayush Saxena <[email protected]>
… (apache#6427). Contributed by He Xiaoqiao. Signed-off-by: Shuyan Zhang <[email protected]> Signed-off-by: Shilun Fan <[email protected]> Signed-off-by: Ayush Saxena <[email protected]> (cherry picked from commit 913a542)
Description of PR
Make sure that the work directory of RunJar is only accessible by the current user.
How was this patch tested?
For code changes:
LICENSE,LICENSE-binary,NOTICE-binaryfiles?