-
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
Fix modular jar final permissions #333
Fix modular jar final permissions #333
Conversation
When a new modular jar file is generated with maven-jar-plugin with Java 11, the final permissions of the file are restricted to the current user instead of using the environment umask which usually allows for group and other users to access the file as well. This is caused by the use of Files#createTempFile() which has a restrictive file permission model for security reason but as the temporary file is generated next to the original jar file, and there's no sensitive reason to restrict its access, the restrictive file permission should not be needed. Fix the issue by creating a simple temporary file generator method.
2cf85ab
to
61607d6
Compare
Hi, Thanks for the contribution. |
Also I noticed that the temp file is not marked for deletion. So if the move operation fails the temp file will be left on the filesystem. |
Yes, it is possible but as the other tools uses the default umask, I thought this was not needed. Do you want me to implement this behavior though?
As far as I can tell from the javadoc, |
I'm not sure I follow which tools you have in mind. In this case it seems more robust to use explicitly the same permissions as the original file as this is the intended behavior if my understanding is correct.
Yes, this is the existing behavior. If you want and think it makes sense would be great if you can add this change as well. |
I was referring to |
I can add the change. Most likely would not rely on |
Instead of relying on current umask property, read mjar permissions and provide it to Files#createTempFile(...)
When a new modular jar file is generated with maven-jar-plugin with Java 11, the final permissions of the file are restricted to the current user instead of using the environment umask which usually allows for group and other users to access the file as well.
This is caused by the use of Files#createTempFile() which has a restrictive file permission model for security reason but as the temporary file is generated next to the original jar file, and there's no sensitive reason to restrict its access, the restrictive file permission should not be needed.
Fix the issue by creating a simple temporary file generator method.
Fixes #332