ebourg / jsign

Java implementation of Microsoft Authenticode for signing Windows executables, installers & scripts
https://ebourg.github.io/jsign
Apache License 2.0
250 stars 107 forks source link

Maven Jsign Plugin is changing proxy settings #104

Open BueDo opened 2 years ago

BueDo commented 2 years ago

Hallo,

while using JSign-maven-plugin and Proxy-Settings defined in the settings.xml within an multi-module-build it seems the Plugin "loses" the specified nonProxyHosts. So if you build module A and module B and you are using the Plugin for module A in module B Proxy-Settings without the nonProxyHosts are actively used. A similar problem was reported here: https://github.com/mojohaus/jaxb2-maven-plugin/issues/60

maybe there is something in common.

Possible fix could be, that the SignHelper is aware of the nonProxyHosts settings and within initializeProxy() this regex would be used for an extra condition within the select method of the anonyme inner class of ProxySelector.

One thing - how fast do you think this change could be deployed?

thanks Dominic

ebourg commented 2 years ago

Thank you for reporting this issue. The plugin does indeed change the JVM proxy configuration after loading the proxy parameters from the Maven settings, but it doesn't honor the nonProxyHosts parameter. jaxb2 solved this issue by restoring the previous proxy settings after running. I fail to understand why Maven doesn't handle the proxy configuration itself since it holds the settings.

BueDo commented 2 years ago

i totally understand you and i also expected a behavior like you have described.

haha i nearly get insane while figuring out why always the proxy is used while it shouldn't.

ebourg commented 2 years ago

I think if the Jsign Maven plugin has to configure the proxy used by the JVM it should handle the nonProxyHosts parameter. Proxy settings could be defined in the Maven configuration with the timestamping URL matching the nonProxyHosts pattern. In this case the timestamping would fail.

Either this, or figure out how to let Maven handle the proxy configuration itself.

I don't have the time to work on this right now, but if someone wants to send a PR I can review and merge it.