Bug 276730 - security/zaproxy: Cannot open the options menu
Summary: security/zaproxy: Cannot open the options menu
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Jose Alonso Cardenas Marquez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-30 11:27 UTC by Lorenzo Salvadore
Modified: 2024-03-24 00:24 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (acm)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lorenzo Salvadore freebsd_committer freebsd_triage 2024-01-30 11:27:09 UTC
When I try to open the options menu (Tools>Options) no options window is created.
In stderr I get the following error:

452649 [AWT-EventQueue-0] ERROR org.zaproxy.zap.extension.selenium.internal.FirefoxProfileManager - Do not know how to find Firefox directory for FreeBSD
452650 [AWT-EventQueue-0] ERROR org.zaproxy.zap.ZAP.UncaughtExceptionLogger - Exception in thread "AWT-EventQueue-0"
java.lang.NullPointerException: null
        at org.zaproxy.zap.extension.selenium.internal.FirefoxProfileManager.getProfilesDirectory(FirefoxProfileManager.java:68) ~[?:?]
        at org.zaproxy.zap.extension.selenium.internal.FirefoxProfileManager.getProfiles(FirefoxProfileManager.java:95) ~[?:?]
        at org.zaproxy.zap.extension.selenium.SeleniumOptionsPanel.initParam(SeleniumOptionsPanel.java:494) ~[?:?]
        at org.parosproxy.paros.view.AbstractParamContainerPanel.lambda$initParam$1(AbstractParamContainerPanel.java:662) ~[zap-2.14.0.jar:2.14.0]
        at java.util.ArrayList.forEach(ArrayList.java:1541) ~[?:?]
        at org.parosproxy.paros.view.AbstractParamContainerPanel.initParam(AbstractParamContainerPanel.java:662) ~[zap-2.14.0.jar:2.14.0]
        at org.parosproxy.paros.view.AbstractParamDialog.initParam(AbstractParamDialog.java:359) ~[zap-2.14.0.jar:2.14.0]
        at org.parosproxy.paros.control.MenuToolsControl.options(MenuToolsControl.java:73) ~[zap-2.14.0.jar:2.14.0]
        at org.parosproxy.paros.control.MenuToolsControl.options(MenuToolsControl.java:66) ~[zap-2.14.0.jar:2.14.0]
        at org.parosproxy.paros.view.MainMenuBar$3.actionPerformed(MainMenuBar.java:245) ~[zap-2.14.0.jar:2.14.0]
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967) ~[?:?]
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308) ~[?:?]
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405) ~[?:?]
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262) ~[?:?]
        at javax.swing.AbstractButton.doClick(AbstractButton.java:369) ~[?:?]
        at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1020) ~[?:?]
        at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1064) ~[?:?]
        at java.awt.Component.processMouseEvent(Component.java:6635) ~[?:?]
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3342) ~[?:?]
        at java.awt.Component.processEvent(Component.java:6400) ~[?:?]
        at java.awt.Container.processEvent(Container.java:2263) ~[?:?]
        at java.awt.Component.dispatchEventImpl(Component.java:5011) ~[?:?]
        at java.awt.Container.dispatchEventImpl(Container.java:2321) ~[?:?]
        at java.awt.Component.dispatchEvent(Component.java:4843) ~[?:?]
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918) ~[?:?]
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547) ~[?:?]
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488) ~[?:?]
        at java.awt.Container.dispatchEventImpl(Container.java:2307) ~[?:?]
        at java.awt.Window.dispatchEventImpl(Window.java:2772) ~[?:?]
        at java.awt.Component.dispatchEvent(Component.java:4843) ~[?:?]
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772) ~[?:?]
        at java.awt.EventQueue$4.run(EventQueue.java:721) ~[?:?]
        at java.awt.EventQueue$4.run(EventQueue.java:715) ~[?:?]
        at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) ~[?:?]
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95) ~[?:?]
        at java.awt.EventQueue$5.run(EventQueue.java:745) ~[?:?]
        at java.awt.EventQueue$5.run(EventQueue.java:743) ~[?:?]
        at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) ~[?:?]
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:742) ~[?:?]
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) [?:?]
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) [?:?]
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) [?:?]
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) [?:?]
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) [?:?]
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:90) [?:?]
Comment 1 Jose Alonso Cardenas Marquez freebsd_committer freebsd_triage 2024-01-30 16:06:01 UTC
Hello Lorenzo. zaproxy needs some changes for support FreeBSD completely. I need send some patches to zaproxy projects and apply them to zaproxy port. Please, test the following: 

--- zap/src/main/java/org/parosproxy/paros/Constant.java.orig   2024-01-30 15:58:57 UTC
+++ zap/src/main/java/org/parosproxy/paros/Constant.java
@@ -1405,9 +1405,19 @@ public final class Constant {
         return matcher.find();
     }

+    // Determine FreeBSD Operating System
+    // ZAP: Changed to final.
+    private static final Pattern patternFreeBSD = Pattern.compile("freebsd", Pattern.CASE_INSENSITIVE);
+
+    public static boolean isFreeBSD() {
+        String os_name = System.getProperty("os.name");
+        Matcher matcher = patternFreeBSD.matcher(os_name);
+        return matcher.find();
+    }
+
     // Determine Linux Operating System
     // ZAP: Changed to final.
-    private static final Pattern patternLinux = Pattern.compile("linux", Pattern.CASE_INSENSITIVE);
+    private static final Pattern patternLinux = Pattern.compile("linux|freebsd", Pattern.CASE_INSENSITIVE);

     public static boolean isLinux() {
         String os_name = System.getProperty("os.name");



If you are testing zaproxy feel free to report more issues in this PR and I'll try fix it asap.
Comment 2 Lorenzo Salvadore freebsd_committer freebsd_triage 2024-02-01 13:25:33 UTC
Thanks, your patch works.

Yes, I am testing a bit zaproxy. Another bug that I have found is that opening the web browser from within zaproxy does not work: I get the following message in stderror.

ELF binary type "3" not known.

        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:163) ~[?:?]
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:156) ~[?:?]
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:151) ~[?:?]
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:132) ~[?:?]
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:127) ~[?:?]
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:112) ~[?:?]
        at org.zaproxy.zap.extension.selenium.ExtensionSelenium.getWebDriverImpl(ExtensionSelenium.java:1106) ~[?:?]
        at org.zaproxy.zap.extension.selenium.ExtensionSelenium.getWebDriver(ExtensionSelenium.java:928) ~[?:?]
        at org.zaproxy.zap.extension.selenium.ExtensionSelenium.getWebDriver(ExtensionSelenium.java:896) ~[?:?]
        at org.zaproxy.zap.extension.selenium.internal.BuiltInSingleWebDriverProvider.getWebDriver(BuiltInSingleWebDriverProvider.java:63) ~[?:?]
        at org.zaproxy.zap.extension.selenium.ExtensionSelenium.getWebDriverImpl(ExtensionSelenium.java:776) ~[?:?]
        at org.zaproxy.zap.extension.selenium.ExtensionSelenium.getWe
        at org.zaproxy.zap.extension.selenium.ExtensionSelenium.getProxiedBrowserByName(ExtensionSelenium.java:677) ~[?:?]
        at org.zaproxy.zap.extension.selenium.ExtensionSelenium.getProxiedBrowserByName(ExtensionSelenium.java:653) ~[?:?]
        at org.zaproxy.zap.extension.selenium.ExtensionSelenium.getProxiedBrowserByName(ExtensionSelenium.java:637) ~[?:?]
        at org.zaproxy.zap.extension.selenium.ExtensionSelenium.getProxiedBrowserByName(ExtensionSelenium.java:627) ~[?:?]
        at org.zaproxy.zap.extension.quickstart.launch.ExtensionQuickStartLaunch.lambda$launchBrowser$1(ExtensionQuickStartLaunch.java:218) ~[?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]
Caused by: java.net.UnknownHostException: laptop0: Name does not resolve
        at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) ~[?:?]
        at java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:930) ~[?:?]
        at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1543) ~[?:?]
        at java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:848) ~[?:?]
        at java.net.InetAddress.getAllByName0(InetAddress.java:1533) ~[?:?]
        at java.net.InetAddress.getLocalHost(InetAddress.java:1665) ~[?:?]
        ... 25 more

        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:163) ~[?:?]
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:156) ~[?:?]
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:151) ~[?:?]
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:132) ~[?:?]
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:127) ~[?:?]
        at org.zaproxy.zap.extension.selenium.ExtensionSelenium.getProxiedBrowserByName(ExtensionSelenium.java:653) ~[?:?]
        at org.zaproxy.zap.extension.selenium.ExtensionSelenium.getProxiedBrowserByName(ExtensionSelenium.java:637) ~[?:?]
        at org.zaproxy.zap.extension.selenium.ExtensionSelenium.getProxiedBrowserByName(ExtensionSelenium.java:627) ~[?:?]
        at org.zaproxy.zap.extension.quickstart.launch.ExtensionQuickStartLaunch.lambda$launchBrowser$1(ExtensionQuickStartLaunch.java:218) ~[?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]
Caused by: java.net.UnknownHostException: laptop0: Name does not resolve
        at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) ~[?:?]
        at java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:930) ~[?:?]
        at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1543) ~[?:?]
        at java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:848) ~[?:?]
        at java.net.InetAddress.getAllByName0(InetAddress.java:1533) ~[?:?]
        at java.net.InetAddress.getLocalHost(InetAddress.java:1665) ~[?:?]
        ... 25 more
85216 [ZAP-BrowserLauncher] ERROR org.zaproxy.zap.extension.quickstart.launch.ExtensionQuickStartLaunch - Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. 
Host info: host: 'Unknown', ip: 'Unknown'
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. 
Host info: host: 'Unknown', ip: 'Unknown'
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:620) ~[?:?]
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236) ~[?:?]
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:163) ~[?:?]
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:156) ~[?:?]
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:151) ~[?:?]
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:132) ~[?:?]
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:127) ~[?:?]
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:112) ~[?:?]
        at org.zaproxy.zap.extension.selenium.ExtensionSelenium.getWebDriverImpl(ExtensionSelenium.java:1106) ~[?:?]
        at org.zaproxy.zap.extension.selenium.ExtensionSelenium.getWebDriver(ExtensionSelenium.java:928) ~[?:?]
        at org.zaproxy.zap.extension.selenium.ExtensionSelenium.getWebDriver(ExtensionSelenium.java:896) ~[?:?]
        at org.zaproxy.zap.extension.selenium.internal.BuiltInSingleWebDriverProvider.getWebDriver(BuiltInSingleWebDriverProvider.java:63) ~[?:?]
        at org.zaproxy.zap.extension.selenium.ExtensionSelenium.getWebDriverImpl(ExtensionSelenium.java:776) ~[?:?]
        at org.zaproxy.zap.extension.selenium.ExtensionSelenium.getWebDriver(ExtensionSelenium.java:576) ~[?:?]
        at org.zaproxy.zap.extension.selenium.ExtensionSelenium.getProxiedBrowser(ExtensionSelenium.java:737) ~[?:?]
        at org.zaproxy.zap.extension.selenium.ExtensionSelenium.getProxiedBrowserByName(ExtensionSelenium.java:677) ~[?:?]
        at org.zaproxy.zap.extension.selenium.ExtensionSelenium.getProxiedBrowserByName(ExtensionSelenium.java:653) ~[?:?]
        at org.zaproxy.zap.extension.selenium.ExtensionSelenium.getProxiedBrowserByName(ExtensionSelenium.java:637) ~[?:?]
        at org.zaproxy.zap.extension.selenium.ExtensionSelenium.getProxiedBrowserByName(ExtensionSelenium.java:627) ~[?:?]
        at org.zaproxy.zap.extension.quickstart.launch.ExtensionQuickStartLaunch.lambda$launchBrowser$1(ExtensionQuickStartLaunch.java:218) ~[?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]
Caused by: org.openqa.selenium.WebDriverException: Driver server process died prematurely.
Build info: version: '4.14.0', revision: 'e5a96349ce'
System info: os.name: 'FreeBSD', os.arch: 'amd64', os.version: '15.0-CURRENT', java.version: '11.0.21'
Driver info: driver.version: FirefoxDriver
        at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:243) ~[?:?]
        at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:119) ~[?:?]
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:602) ~[?:?]
        ... 20 more





And a dialog box saying "The provided browser was not found."

Maybe something needs to be configured properly in Options->Selenium.
Comment 3 Jose Alonso Cardenas Marquez freebsd_committer freebsd_triage 2024-02-02 20:51:44 UTC
(In reply to Lorenzo Salvadore from comment #2)
This issue can be more complex because it depends of spiderajax, crawljax and webdriver extensions. 

zaproxy wants download webdriver used by firefox (geckodriver). You can see it at ~/.ZAP/webdriver/linux/64|32. You can replace geckodriver there with a native version of FreeBSD.

acm@ifrit:~/.ZAP/webdriver/linux/64 % pkg search geckodri
geckodriver-0.26.0_40          Proxy for using WebDriver clients with Gecko-based browsers

I was doing some tests and it seems like issues with crawljax library. I'll try see more to fix this issue
Comment 4 commit-hook freebsd_committer freebsd_triage 2024-03-24 00:24:14 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=84b72a1703f8f24c308dca77823b33b1cdd48da5

commit 84b72a1703f8f24c308dca77823b33b1cdd48da5
Author:     Jose Alonso Cardenas Marquez <acm@FreeBSD.org>
AuthorDate: 2024-03-24 00:22:20 +0000
Commit:     Jose Alonso Cardenas Marquez <acm@FreeBSD.org>
CommitDate: 2024-03-24 00:22:20 +0000

    security/zaproxy: Update cache files because gradle was updated

    - Fix open options menu
    PR:             276730
    Reported by:    salvadore

 security/zaproxy/Makefile                          |  1 +
 security/zaproxy/distinfo                          | 10 +++++-----
 ...n_java_org_parosproxy_paros_Constant.java (new) | 23 ++++++++++++++++++++++
 3 files changed, 29 insertions(+), 5 deletions(-)