Back to LanguageTool Homepage - Privacy - Imprint

Java Security Manager and password-protected external files

It is not possible to use password-protected external files if “LanguageTool is running with a Java security manager that forbids Authenticator.setDefault().” (http://wiki.languagetool.org/tips-and-tricks#toc9).

The documentation that I found for Java Security Manager is for software developers who build software applications. Examples:

Questions:

  1. How does an end user know whether LT is running with a Java Security Manager that forbids Authenticator.setDefault()?

  2. What error message will an end user see if s/he tries to run LT with password-protected external files and with a Java Security Manager that forbids Authenticator.setDefault()?

  3. I guess that the IT people at an organization can change the Java Security Manager settings. Typically where/how would they do this?

They usually don’t know I guess, they will only notice when they run into the issue. Some error will be shown. I can’t tell what exactly it would say without manually reproducing the issue first.

A few people cannot access the STE checker. A Java error includes this line:
java.net.UnknownHostException: www.techscribe.co.uk
I’m trying to find the cause of the error. Possibly, it’s because their Java Security Manager forbids Authenticator.setDefault, but possibly, it’s for a different reason. I’m trying to find the cause of the Java error.

Do you know how I can do these?

  1. Find if there is a Java Security Manager on my computer.
  2. If there is, change it to forbid Authenticator.setDefault.

Then, I can see what error message occurs.

Could you post the full error message?

“Using an alternate java.policy file” at https://blog.frankel.ch/java-security-manager/ seems to come close. But I’d suggest you first post the full error message.

Hi @dnaber, I posted the error as a zip file because I cannot post a text file.

error.zip (1.4 KB)

What you could try: use the external file but without username and password (just for testing). The issue happens when loading the disambiguation XML. So yes, it might be an issue with the Security Manager.

Thanks. I’ll tell the users try to access files that are not password protected.

I want to replicate the user’s problem. To do that, my plan is to use an alternative java.policy file and then try to break the access.

The first step is to run LT with the default user.policy. I get an error message When I run this command:
java -Djava.security.manager -jar languagetool.jar

As a test, I tried a similar command on a different (and very old) Java file. The Java program started.

(Page https://blog.frankel.ch/java-security-manager/ tells me what to do, but it doesn’t give an example. For examples of full commands, refer to https://docs.oracle.com/javase/7/docs/technotes/guides/security/PolicyFiles.html .)

The message I get with LT is in the zip file: java-security-message.zip (670 Bytes)

Is the error message that I see with LT the expected/correct behaviour?

I know almost nothing about the Java Security Manager, but probably yes. It’s what you get when you run a Security Manager that disallows everything (which is probably the default without a policy), thus LT will fail even before parsing the XML files.

My understanding is that the default is to permit everything. (Which is why most users most of the time can access the XML data. But, when an organization tightens the security, then the access fails.)

The default of Java, yes - because the default is to not have a Security Manager, I think. But once you activate one without a policy, I guess it disallows everything by default.

@dnaber, thanks.

My guess that possibly the access problem is related to Java Security Manger is not correct.

UnknownHostException is “Thrown to indicate that the IP address of a host could not be determined” (https://docs.oracle.com/javase/7/docs/api/java/net/UnknownHostException.html).