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

HAR import fails silently #8500

Closed
1 task done
LIttleAncientForestKami opened this issue May 28, 2024 · 7 comments · Fixed by zaproxy/zap-extensions#5250
Closed
1 task done

HAR import fails silently #8500

LIttleAncientForestKami opened this issue May 28, 2024 · 7 comments · Fixed by zaproxy/zap-extensions#5250
Assignees
Labels
add-on bug in:exim Issues pertaining to Import/Export add-on.

Comments

@LIttleAncientForestKami
Copy link

LIttleAncientForestKami commented May 28, 2024

Describe the bug

Possibly the fault might be in the underlying library but I also wish to point out that UI behaves as it nothing has happened. I did the import twice, for I initially thought that I have perhaps misclicked or something. Logs say that NPE happens. Not sure if this happens for every HAR file or just mine, but I tried a couple.

Steps to reproduce the behavior

  1. Open ZAP
  2. Import HAR file
  3. Nothing happens, no error message

Expected behavior

HAR files is imported or a clear error message tells me what's wrong and if I can do something about that HAR file to have it imported.

Software versions

ZAP 2.15.0, via snap list. zaproxy 2.15.0 32 latest/stable psiinon classic

Java, via java --version:
openjdk 11.0.12 2021-07-20
OpenJDK Runtime Environment 18.9 (build 11.0.12+7)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7, mixed mode)

Ubuntu via inxi:
Host: [redacted] Kernel: 6.5.0-35-generic x86_64 bits: 64
compiler: N/A Desktop: GNOME 42.9 (Wayland) tk: GTK 3.24.33 wm: gnome-shell
dm: GDM3 42.0 Distro: Ubuntu 22.04.4 LTS (Jammy Jellyfish)

Screenshots

No response

Errors from the zap.log file

2024-05-28 11:51:56,844 [ZAP-Import-Har-1] ERROR UncaughtExceptionLogger - Exception in thread "ZAP-Import-Har-1"
java.lang.NullPointerException: null
	at edu.umass.cs.benchlab.har.HarCustomFields.addHarCustomFields(HarCustomFields.java:122) ~[harlib-1.1.3.jar:?]
	at edu.umass.cs.benchlab.har.HarCustomFields.addHarCustomFields(HarCustomFields.java:130) ~[harlib-1.1.3.jar:?]
	at edu.umass.cs.benchlab.har.HarEntry.<init>(HarEntry.java:197) ~[harlib-1.1.3.jar:?]
	at edu.umass.cs.benchlab.har.HarEntries.<init>(HarEntries.java:86) ~[harlib-1.1.3.jar:?]
	at edu.umass.cs.benchlab.har.HarLog.<init>(HarLog.java:131) ~[harlib-1.1.3.jar:?]
	at edu.umass.cs.benchlab.har.tools.HarFileReader.readHarFile(HarFileReader.java:112) ~[harlib-1.1.3.jar:?]
	at edu.umass.cs.benchlab.har.tools.HarFileReader.readHarFile(HarFileReader.java:87) ~[harlib-1.1.3.jar:?]
	at org.zaproxy.addon.exim.har.MenuImportHar$1.run(MenuImportHar.java:69) ~[?:?]
2024-05-28 11:52:34,859 [ZAP-Import-Har-2] ERROR UncaughtExceptionLogger - Exception in thread "ZAP-Import-Har-2"
java.lang.NullPointerException: null
	at edu.umass.cs.benchlab.har.HarCustomFields.addHarCustomFields(HarCustomFields.java:122) ~[harlib-1.1.3.jar:?]
	at edu.umass.cs.benchlab.har.HarCustomFields.addHarCustomFields(HarCustomFields.java:130) ~[harlib-1.1.3.jar:?]
	at edu.umass.cs.benchlab.har.HarEntry.<init>(HarEntry.java:197) ~[harlib-1.1.3.jar:?]
	at edu.umass.cs.benchlab.har.HarEntries.<init>(HarEntries.java:86) ~[harlib-1.1.3.jar:?]
	at edu.umass.cs.benchlab.har.HarLog.<init>(HarLog.java:131) ~[harlib-1.1.3.jar:?]
	at edu.umass.cs.benchlab.har.tools.HarFileReader.readHarFile(HarFileReader.java:112) ~[harlib-1.1.3.jar:?]
	at edu.umass.cs.benchlab.har.tools.HarFileReader.readHarFile(HarFileReader.java:87) ~[harlib-1.1.3.jar:?]
	at org.zaproxy.addon.exim.har.MenuImportHar$1.run(MenuImportHar.java:69) ~[?:?]

Additional context

HAR was done via Chromium, can be imported by it back or by newest Firefox.

Would you like to help fix this issue?

  • Yes
@thc202
Copy link
Member

thc202 commented May 28, 2024

Can you provide a sample HAR that reproduces the issue? This will most likely be addressed with zaproxy/zap-extensions#5250.

@thc202 thc202 added add-on in:exim Issues pertaining to Import/Export add-on. labels May 28, 2024
@LIttleAncientForestKami
Copy link
Author

Browser Versions

Chromium (used to export HAR) 125.0.6422.112 (Official Build) snap (64-bit)
Revision e099925e675bbb19c42822548f5175ab03a36a32-refs/branch-heads/6422_76@{#3}
OS Linux
JavaScript V8 12.5.227.9
User Agent Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36

Firefox (used to import HAR): 126.0 (64 bits), May 14th, via snap.

HAR was done via Chromium, can be imported by it back or by newest Firefox. Will try to add a sample.

@kingthorin
Copy link
Member

Will try to add a sample.

Thanks @LIttleAncientForestKami I'd like to be sure that it succeeds with the changes I'm working on in zaproxy/zap-extensions#5250

@LIttleAncientForestKami
Copy link
Author

Sample

peteris.rocks.har, obtained by visiting https://peteris.rocks/blog/htop/ with Chromium (and with Network tab opened in dev tools)

image

OK, will need to post HAR file in some other manner as it doesn't allow it's upload saying it's unsupported file type.

@thc202
Copy link
Member

thc202 commented May 28, 2024

Change the extension to .txt.

@LIttleAncientForestKami
Copy link
Author

LIttleAncientForestKami commented May 28, 2024

peteris.rocks.har.txt
attempt to paste failed, upload as txt seems to be working

and thanks for lighning quick responses and navigation @thc202

@kingthorin
Copy link
Member

This is great. Using the code in the PR.

  • There are some HTTP/3 (h3) requests in the HAR that will be dropped.
  • It also reveals that Chrome sets httpVersion as http/2.0 instead of http/2 so I've updated the code to handle that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add-on bug in:exim Issues pertaining to Import/Export add-on.
Development

Successfully merging a pull request may close this issue.

3 participants