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
8155246: Throw error if default java.security file is missing #9747
Conversation
👋 Welcome back coffeys! A progress list of the required criteria for merging this PR into |
Webrevs
|
What's the need for this change? Perhaps I'm missing the bigger problem here. Certainly not having a java.security file is sub-optimal and I suspect very very rare, but throwing exceptions that breaks existing apps seems like a big hammer and would now need a property added to override Doing this change for jdk-dev only I could see, but as the CSR points toward backporting, that seems more risky |
Hi Tony, there are a few points for the change IMO:
regards, |
@@ -47,6 +47,10 @@ | |||
* implementation-specific location, which is typically the properties file | |||
* {@code conf/security/java.security} in the Java installation directory. | |||
* | |||
* @implNote If the master security properties file is missing, the JDK | |||
* implementation will throw an {@code InternalError} when initializing the | |||
* {@code Security} class. |
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.
Is "master security properties file" the right term here? The only use of "master" in this class seems to be a deprecated method.
I'm also not sure about the word "missing" as there can be many reasons why opening a file may fail, e.g. something changes the permissions or file owner so that it can't be opened for example.
The implNote need not be specific on the exception that is thrown, it could say "will throw an unspecified exception ..."
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.
The opening line of the java.security file denotes it as the "master security properties file". I think it works well but open to suggestions. Maybe we can re-use the terminology from previous paragraph.
Fair point about the "missing" and error clause -- perhaps:
@implNote If the file containing the default values of security properties fails to load,
* the JDK implementation will throw an unspecified error when initializing the
* {@code Security} class.
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.
I think if you just said "If this properties file ..." it would be sufficient, as the previous paragraph provided enough context as to what you are referring to.
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.
Btw the current code does not handlmissing or unreadable overwrite files very well. PropsLoaded will be true even when the replacing overwrite file could not be loaded (resulting in an empty list).
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.
it's a fair point @ecki -- the 2nd loadedProps = true;
call is redundant since the code block is not executed unless the security.overridePropertiesFile
is set to true by reading the props from default/master file.
one option here might be to delay the re-initialization of props
until we successfully load the override security props file
i.e. push this code block down
if (overrideAll) {
props = new Properties();
if (sdebug != null) {
sdebug.println
("overriding other security properties files!");
}
}
I'll log another JBS issue to track that.
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.
@ecki -- Logged JDK-8292297 to track the issue you raised
@@ -47,6 +47,9 @@ | |||
* implementation-specific location, which is typically the properties file | |||
* {@code conf/security/java.security} in the Java installation directory. | |||
* | |||
* @implNote If this property file fails to load, the JDK implementation will | |||
* throw an unspecified error when initializing the {@code Security} class. | |||
* |
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.
I think I'd probably use "the property file" rather than "this property file" here but otherwise the implNote looks okay to me.
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.
Change "property file" to "properties file".
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.
I think I'd probably use "the property file" rather than "this property file" here but otherwise the implNote looks okay to me.
Ok with me.
@@ -47,6 +47,9 @@ | |||
* implementation-specific location, which is typically the properties file | |||
* {@code conf/security/java.security} in the Java installation directory. | |||
* | |||
* @implNote If this property file fails to load, the JDK implementation will | |||
* throw an unspecified error when initializing the {@code Security} class. | |||
* |
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.
Change "property file" to "properties file".
@@ -47,6 +47,9 @@ | |||
* implementation-specific location, which is typically the properties file | |||
* {@code conf/security/java.security} in the Java installation directory. | |||
* | |||
* @implNote If this property file fails to load, the JDK implementation will | |||
* throw an unspecified error when initializing the {@code Security} class. | |||
* |
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.
I think I'd probably use "the property file" rather than "this property file" here but otherwise the implNote looks okay to me.
Ok with me.
@@ -22,6 +22,9 @@ | |||
# the command line, set the key security.overridePropertiesFile | |||
# to false in the master security properties file. It is set to true | |||
# by default. | |||
# | |||
# If this property file fails to load, the JDK implementation will throw |
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.
Change "property file" to "properties file".
@coffeys This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 129 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
/integrate |
Going to push as commit 9d7c13e.
Your commit was automatically rebased without conflicts. |
In the broken case where the conf/security/java.security configuration file doesn't exist, the JDK should throw an Error.
CSR in progress.
Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9747/head:pull/9747
$ git checkout pull/9747
Update a local copy of the PR:
$ git checkout pull/9747
$ git pull https://git.openjdk.org/jdk pull/9747/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 9747
View PR using the GUI difftool:
$ git pr show -t 9747
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9747.diff