-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HADOOP-18235. vulnerability: we may leak sensitive information in LocalKeyStoreProvider #4998
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -142,20 +142,26 @@ protected void initFileSystem(URI uri) | |
|
|
||
| @Override | ||
| public void flush() throws IOException { | ||
| super.flush(); | ||
| if (LOG.isDebugEnabled()) { | ||
| LOG.debug("Resetting permissions to '" + permissions + "'"); | ||
| } | ||
| if (!Shell.WINDOWS) { | ||
| Files.setPosixFilePermissions(Paths.get(file.getCanonicalPath()), | ||
| permissions); | ||
| } else { | ||
| // FsPermission expects a 10-character string because of the leading | ||
| // directory indicator, i.e. "drwx------". The JDK toString method returns | ||
| // a 9-character string, so prepend a leading character. | ||
| FsPermission fsPermission = FsPermission.valueOf( | ||
| "-" + PosixFilePermissions.toString(permissions)); | ||
| FileUtil.setPermission(file, fsPermission); | ||
| super.getWriteLock().lock(); | ||
| try { | ||
| file.createNewFile(); | ||
| if (LOG.isDebugEnabled()) { | ||
| LOG.debug("Resetting permissions to '" + permissions + "'"); | ||
| } | ||
| if (!Shell.WINDOWS) { | ||
| Files.setPosixFilePermissions(Paths.get(file.getCanonicalPath()), | ||
| permissions); | ||
| } else { | ||
| // FsPermission expects a 10-character string because of the leading | ||
| // directory indicator, i.e. "drwx------". The JDK toString method returns | ||
| // a 9-character string, so prepend a leading character. | ||
| FsPermission fsPermission = FsPermission.valueOf( | ||
| "-" + PosixFilePermissions.toString(permissions)); | ||
| FileUtil.setPermission(file, fsPermission); | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the method getOutputStreamForKeystore(), before sending outputStream, should it be checked that the file is empty. Reason being, between creatingFile and setting permissions, there could be that some other process puts something in the file.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @saxenapranav I don't believe this is an issue. If this process has successfully got a write handle then it is assumed no one else is actively writing to the file.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean to say is what if some other process writes into the file between |
||
| super.flush(); | ||
| } finally { | ||
| super.getWriteLock().unlock(); | ||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
no need for the super. prefix here
but: we do now require lock() to be reentrant