Skip to content
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

Security Exception when navigating to https URL on Win7 #10

Closed
hrj opened this issue Dec 21, 2014 · 8 comments · Fixed by #68
Closed

Security Exception when navigating to https URL on Win7 #10

hrj opened this issue Dec 21, 2014 · 8 comments · Fixed by #68
Assignees
Milestone

Comments

@hrj
Copy link
Member

hrj commented Dec 21, 2014

As reported by @vit1251 on chat:

windows 7 with java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) Client VM (build 25.25-b02, mixed mode, sharing)

The exception is:

An error occurred trying to process a request.
Exception:
java.lang.ExceptionInInitializerError
Meaning:
Unknown.
Message:
null
@hrj hrj added the bug label Dec 21, 2014
@hrj
Copy link
Member Author

hrj commented Dec 21, 2014

@vit1251 can you try running again with -debug option:

java -jar gngr-v0-0-0-.jar -debug

and paste here the output that is printed on the console.

@vit1251
Copy link

vit1251 commented Dec 21, 2014

Starting with -debug have two output stdout:

Codesource: file:/C:/WORK/gngr/gngr-v0-0-0.jar
Codesource: zipentry://uno/Primary_Extension.jar
Creating req mgr for: FramePanel[windowId=null,hashCode=1971489295,parent=null]
Codesource: zipentry://uno/h2-1.4.180.jar
Codesource: zipentry://uno/jooq-3.4.2.jar
Codesource: file:/C:/Program%20Files/Java/jre1.8.0_25/lib/ext/localedata.jar
name indexer : namedItem in class org.lobobrowser.html.js.Window
Codesource: zipentry://uno/js.jar
Setting up scope: JavaObjectWrapper[object=org.lobobrowser.html.js.Window@476102cc,type=org.lobobrowser.html.js.Window]


In about:welcome Running loop
Found stylesheets: 0
Stylesheets set to null
Response: ClientletResponseImpl[url=about:welcome,method=GET,mimeType=text/html,fromCache=false,requestType=OPEN_WINDOW]
Navigation over: about:welcome
Codesource: zipentry://uno/okhttp-2.0.1-SNAPSHOT.jar
Codesource: zipentry://uno/okhttp-urlconnection-2.0.0.jar
In : about:welcome Acquiring Semaphore: java.util.concurrent.Semaphore@3fb28996[Permits = 1]
Going to stop JS scheduler
Exiting loop


Finished interrupting
Clearing document scope
Setting up scope: JavaObjectWrapper[object=org.lobobrowser.html.js.Window@476102cc,type=org.lobobrowser.html.js.Window]
Found stylesheets: 0
Stylesheets set to null


In http://www.yandex.ru Running loop
Going to stop JS scheduler
Exiting loop


Finished interrupting
Clearing document scope
Setting up scope: JavaObjectWrapper[object=org.lobobrowser.html.js.Window@476102cc,type=org.lobobrowser.html.js.Window]
Found stylesheets: 0
Stylesheets set to null
Found stylesheets: 1
Stylesheets set to null


In http://www.yandex.ru Running loop
Response: ClientletResponseImpl[url=http://www.yandex.ru,method=GET,mimeType=text/html,fromCache=false,requestType=ADDRESS_BAR]
Navigation over: http://www.yandex.ru
URL Cached: http://yastatic.net/www/2.178/rapido/pages/big/_big.css
Found stylesheets: 1
Stylesheets set to null
URL Cached: http://yastatic.net/lego/_/La6qi18Z8LwgnZdsAr1qy1GwCwo.gif
URL Cached: http://yastatic.net/lego/_/La6qi18Z8LwgnZdsAr1qy1GwCwo.gif
URL Cached: http://yastatic.net/morda-logo/i/logo.png
Codesource: file:/C:/Program%20Files/Java/jre1.8.0_25/lib/ext/sunec.jar
Codesource: file:/C:/Program%20Files/Java/jre1.8.0_25/lib/ext/sunjce_provider.jar
Codesource: file:/C:/Program%20Files/Java/jre1.8.0_25/lib/ext/sunmscapi.jar
In : http://www.yandex.ru Acquiring Semaphore: java.util.concurrent.Semaphore@25fab5d[Permits = 1]
Going to stop JS scheduler
Exiting loop


Finished interrupting
Clearing document scope
Setting up scope: JavaObjectWrapper[object=org.lobobrowser.html.js.Window@476102cc,type=org.lobobrowser.html.js.Window]
Found stylesheets: 0
Stylesheets set to null


In about:error Running loop
Response: null

And stderr:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Dec 21, 2014 4:40:13 PM org.lobobrowser.gui.FramePanel replaceContentImpl
INFO: replaceContentImpl(): this=FramePanel[windowId=null,hashCode=1971489295,parent=org.lobobrowser.gui.FillerComponent[,0,0,0x0,invalid,layout=org.lobobrowser.util.gui.WrapperLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=java.awt.Dimension[width=32767,height=32767],minimumSize=java.awt.Dimension[width=0,height=0],preferredSize=java.awt.Dimension[width=32767,height=32767]]],response=ClientletResponseImpl[url=about:welcome,method=GET,mimeType=text/html,fromCache=false,requestType=OPEN_WINDOW], content=org.lobobrowser.primary.clientlets.html.HtmlContent@1b4bfaff
Dec 21, 2014 4:40:13 PM org.lobobrowser.gui.NavigationEngine addNavigationEntry
INFO: addNavigationEntry(): entry=NavigationEntry[url=about:welcome,method=GET,title=null]
Dec 21, 2014 4:40:19 PM org.lobobrowser.gui.FramePanel replaceContentImpl
INFO: replaceContentImpl(): this=FramePanel[windowId=null,hashCode=1971489295,parent=org.lobobrowser.gui.FillerComponent[,0,25,1920x948,layout=org.lobobrowser.util.gui.WrapperLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=java.awt.Dimension[width=32767,height=32767],minimumSize=java.awt.Dimension[width=0,height=0],preferredSize=java.awt.Dimension[width=32767,height=32767]]],response=ClientletResponseImpl[url=http://www.yandex.ru,method=GET,mimeType=text/html,fromCache=false,requestType=ADDRESS_BAR], content=org.lobobrowser.primary.clientlets.html.HtmlContent@787499d8
Dec 21, 2014 4:40:19 PM org.lobobrowser.gui.NavigationEngine addNavigationEntry
INFO: addNavigationEntry(): entry=NavigationEntry[url=http://www.yandex.ru,method=GET,title=Яндекс]
Dec 21, 2014 4:40:26 PM org.lobobrowser.primary.ext.ExtensionImpl showError
WARNING: showError(): An error occurred trying to process document [null]
java.lang.ExceptionInInitializerError
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at sun.security.jca.ProviderConfig$2.run(Unknown Source)
    at sun.security.jca.ProviderConfig$2.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.security.jca.ProviderConfig.doLoadProvider(Unknown Source)
    at sun.security.jca.ProviderConfig.getProvider(Unknown Source)
    at sun.security.jca.ProviderList.getProvider(Unknown Source)
    at sun.security.jca.ProviderList$ServiceList.tryGet(Unknown Source)
    at sun.security.jca.ProviderList$ServiceList.access$200(Unknown Source)
    at sun.security.jca.ProviderList$ServiceList$1.hasNext(Unknown Source)
    at java.security.KeyPairGenerator.getInstance(Unknown Source)
    at sun.security.ssl.JsseJce.getKeyPairGenerator(Unknown Source)
    at sun.security.ssl.JsseJce.isEcAvailable(Unknown Source)
    at sun.security.ssl.CipherSuite$KeyExchange.isAvailable(Unknown Source)
    at sun.security.ssl.CipherSuite.isAvailable(Unknown Source)
    at sun.security.ssl.SSLContextImpl.getApplicableCipherSuiteList(Unknown Source)
    at sun.security.ssl.SSLContextImpl.getDefaultCipherSuiteList(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.init(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.<init>(Unknown Source)
    at sun.security.ssl.SSLSocketFactoryImpl.createSocket(Unknown Source)
    at com.squareup.okhttp.Connection.upgradeToTls(Connection.java:228)
    at com.squareup.okhttp.Connection.connect(Connection.java:153)
    at com.squareup.okhttp.Connection.connectAndSetOwner(Connection.java:169)
    at com.squareup.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:104)
    at com.squareup.okhttp.internal.http.RouteSelector.next(RouteSelector.java:131)
    at com.squareup.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:292)
    at com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:235)
    at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:420)
    at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:371)
    at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:466)
    at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
    at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
    at org.lobobrowser.request.RequestEngine.processHandler(RequestEngine.java:789)
    at org.lobobrowser.request.RequestEngine.processHandler(RequestEngine.java:832)
    at org.lobobrowser.request.RequestEngine.processHandler(RequestEngine.java:832)
    at org.lobobrowser.request.RequestEngine.access$1(RequestEngine.java:744)
    at org.lobobrowser.request.RequestEngine$RequestHandlerTask.lambda$0(RequestEngine.java:1078)
    at org.lobobrowser.request.RequestEngine$RequestHandlerTask$$Lambda$31/1442672428.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.lobobrowser.request.RequestEngine$RequestHandlerTask.run(RequestEngine.java:1084)
    at org.lobobrowser.util.SimpleThreadPool$ThreadRunnable.run(SimpleThreadPool.java:129)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "loadLibrary.sunmscapi")
    at java.security.AccessControlContext.checkPermission(Unknown Source)
    at java.security.AccessController.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkLink(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at sun.security.mscapi.SunMSCAPI$1.run(SunMSCAPI.java:52)
    at sun.security.mscapi.SunMSCAPI$1.run(SunMSCAPI.java:50)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.security.mscapi.SunMSCAPI.<clinit>(SunMSCAPI.java:50)
    ... 46 more

Dec 21, 2014 4:40:26 PM org.lobobrowser.gui.FramePanel replaceContentImpl
INFO: replaceContentImpl(): this=FramePanel[windowId=null,hashCode=1971489295,parent=org.lobobrowser.gui.FillerComponent[,0,25,1920x948,layout=org.lobobrowser.util.gui.WrapperLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=java.awt.Dimension[width=32767,height=32767],minimumSize=java.awt.Dimension[width=0,height=0],preferredSize=java.awt.Dimension[width=32767,height=32767]]],response=null, content=org.lobobrowser.primary.clientlets.html.HtmlContent@14edb039
Dec 21, 2014 4:40:28 PM org.lobobrowser.gui.DefaultWindowFactory$1 windowClosing
INFO: windowClosing(): Saving general settings: bounds=java.awt.Rectangle[x=-8,y=-8,width=1936,height=1056]
Dec 21, 2014 4:40:28 PM org.lobobrowser.gui.DefaultWindowFactory$1 windowClosed
INFO: windowClosed(): frames.size()=1,exitWhenAllWindowsClosed=true
Dec 21, 2014 4:40:28 PM org.lobobrowser.gui.DefaultWindowFactory$1 windowClosed
WARNING: Exiting JVM because all windows are now closed!

@hrj
Copy link
Member Author

hrj commented Dec 21, 2014

Thanks for the report.

This seems to be a bug in the java std packages. The sun.security.* package seems to not have sufficient privileges to load its native libraries.

Confirmed by @vit1251 :
java version 64 bit, 8u25 from oracle
URL: https://www.mail.ru

This URL works fine on Ubuntu 14.04, Oracle Java 8u25.

@hrj hrj changed the title Startup fails on Win7 sometimes Security Exception when browsing https://www.mail.ru on Win7 Dec 21, 2014
@hrj hrj changed the title Security Exception when browsing https://www.mail.ru on Win7 Security Exception when navigating to https://www.mail.ru on Win7 Dec 21, 2014
@hrj hrj modified the milestones: 0.2, 0.3 Dec 25, 2014
@hrj
Copy link
Member Author

hrj commented Jan 1, 2015

Just realized that "java.lang.RuntimePermission" "loadLibrary.sunmscapi" needs to be granted to JDK classes. There is a similar grant for RuntimePermission("loadLibrary.sunec") already in our security policy.

@vit1251 This should be hopefully fixed in next release.

@hrj hrj self-assigned this Jan 1, 2015
@hrj hrj changed the title Security Exception when navigating to https://www.mail.ru on Win7 Security Exception when navigating to https URL on Win7 Jan 1, 2015
@hrj
Copy link
Member Author

hrj commented Jan 4, 2015

@vit1251 I have published a test-version with a hopeful fix for this issue:
https://uprootlabs.github.io/gngrTestCases/static/gngr_testing_issue10.jar

I don't have a Windows machine available for testing. Can you please download and try the above version on your Windows machine?

hrj added a commit to hrj/gngr that referenced this issue Jan 7, 2015
@hrj hrj mentioned this issue Jan 7, 2015
@hrj hrj closed this as completed in #68 Jan 7, 2015
@hrj
Copy link
Member Author

hrj commented Jan 8, 2015

I got my hands on a Win 7 box and was able to reproduce this. Debugging now.

@hrj hrj reopened this Jan 8, 2015
@hrj hrj modified the milestones: 0.4, 0.3 Jan 8, 2015
@hrj
Copy link
Member Author

hrj commented Jan 8, 2015

The problem turned out to be a very simple one. Windows paths are differently encoded (they are URL escaped) than in *nix.

The previous fix was not required. Hence will be reverting it, and adding a new fix.

hrj added a commit that referenced this issue Jan 8, 2015
@hrj hrj closed this as completed in b48eeb2 Jan 8, 2015
@hrj
Copy link
Member Author

hrj commented Jan 8, 2015

A new release with a fix is available: 0.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants