Repository navigation
Closed
Labels
Description
For certain SAML traces it occured to me than the export return an empty file (in fact a file with "null" inside).
An error raises here:
const createFromJSON = function(obj) {
let stringified = JSON.stringify(obj);
return JSON.parse(stringified);
};
const enrichWithResponse = (req, res) => {
let responseCopy = createFromJSON(res);
req.responseStatus = responseCopy.statusCode;
req.responseStatusText = responseCopy.statusLine;
req.responseHeaders = responseCopy.responseHeaders;
};
let reqscopy = reqs.map(req => {
let newRequest = createFromJSON(req);
enrichWithResponse(newRequest, req.getResponse());
the_filters.forEach(filter => filter(newRequest));
return newRequest;
});
When trying to stringify "req.getResponse()" when it returns null.
I wonder if it would be a good solution to alter this:
'attachHeadersToRequest' : function(request) { // onBeforeSendHeaders
let uniqueRequestId = new SAMLTrace.UniqueRequestId(request.requestId, request.method, request.url);
uniqueRequestId.create(id => {
let tracer = SAMLTrace.TraceWindow.instance();
// Maybe revise the HTTP method on redirected requests
let alterationResult = tracer.reviseRedirectedRequestMethod(request, id);
id = alterationResult.id;
let entry = tracer.httpRequests.find(req => req.id === id);
if (!entry) {
// Skip further execution if no precedingly issued request can be found. This may occur, if tracing
// new requests is paused. Requests that were issued before pausing will be found and handled.
return;
}
entry.headers = request.requestHeaders;
tracer.addRequestItem(entry, () => entry.res);
tracer.updateStatusBar();
});
},
In particular:
tracer.addRequestItem(entry, () => entry.res);
to
tracer.addRequestItem(entry, () => entry.res || {});
or so
So the whole trace can be exported dispite one of them acts oddly.
Activity
thijskh commentedon Oct 18, 2021
Any idea what the exact issue is with that request? Is that visible in the tracer view?
bzbzh commentedon Oct 18, 2021
Yes it is.
No idea at this point.
kellenmurphy commentedon Aug 1, 2022
@bzbzh were any of the traced events blocked by Firefox due to a security warning, i.e. for a self-signed certificate which hadn't been accepted? Or which had popped the warning and then you accepted to proceed anyway? i.e. see: #66 (comment)
I'm able to replicate the trace js error that causes a null export under that condition.
bzbzh commentedon Aug 1, 2022
@kellenmurphy I have no "Accept Risk and Continue" message. The certificate is a let's encrypt one. Is there another way/thing to test?
kellenmurphy commentedon Aug 1, 2022
@bzbzh Okay, no need for more testing... it is telling though that there's something odd about certain traces. I'm going to dig on the thread I have re: self-signed cert warnings to see if I can isolate why that gets the
null... and maybe we'll solve your problem as well in the meantime?khlr commentedon Nov 11, 2023
Hm... So @kellenmurphy was able to replicate this... I wasn't. I used the super-handy testing website https://badssl.com.
Clicking e.g. the expired link leads to SAML-tracer tracing the request without any response (due to the blocking by the browser).
However, this trace can still be exported without any problems. The response-less request simply does not end up in the output. Ok, that could of course also be considered an error. But that would probably be a separate topic.
What exactly do you have to do to recreate the null error?
chris18890 commentedon Feb 6, 2024
I seem to have come across the same issue
Env/actions:
I'm able to see the results of the SAML trace onscreen, but when I do an export I get a 4 byte file that just has the word "null" printed in it.
tvdijen commentedon Feb 6, 2024
Unfortunately that's not reproducible for us @chris18890 ...
thijskh commentedon Feb 6, 2024
It would be great if someone who encounters this issue and can actually reproduce it, could see if they can debug it/find the cause.
chris18890 commentedon Feb 7, 2024
Oddly enough though, it worked perfectly on firefox!
Is there anything I can help with in terms of reproducing it?
tvdijen commentedon Feb 7, 2024
@chris18890 If you can reproduce it, you could try and opening the 'developer tools' in your add-on window and see if anything is being blocked why you try to export.
BryanSD commentedon Apr 26, 2024
I believe I ran into this issue as well, and may have steps to reproduce in Firefox. You can contrive a scenario where this works in the context of a SAML exchange, but it's equally present on a visit to google.com:
This reproduction works because, from my understanding, a bug in Request Blocking in Firefox allows the request to actually be sent but the response is ignored: https://bugzilla.mozilla.org/show_bug.cgi?id=1756770
The real-life use-case where I saw this occurred when JS in the page was cancelling the request before it could ever complete - the request went out, but it was cancelled before the response was received. However, no record of the request could be found in a SAML Tracer export even though it appeared "live" when viewing the network activity there.
KLuK9 commentedon Nov 29, 2024
Here is the error in the console log when I click on "export" (the one in the toolbar, not the one in the pop-up):
In the pop-up, if I hover the "export" button, this is the preview URL

Windows 10 22H2
Google Chrome Version 131.0.6778.86
tvdijen commentedon Nov 29, 2024
I have the same setup of Windows and Chrome-version, but I cannot reproduce this at all.. I'm suspecting that this issue is related to some other add-on like a script-blocker..
KLuK9 commentedon Nov 29, 2024
I just disabled uBlock Origin and everything works fine now! Thank you.
Since it's a very popular extension, perhaps all the problems come from there, or from other ad blockers.
tvdijen commentedon Nov 29, 2024
It must be some non-default setting @KLuK9, because I installed that add-on and SAML-tracer export keeps working.
sullivan1337 commentedon Mar 5, 2025
I had this exact same problem, and was able to fix it in the export by clearing the
Filter resourcestoggle..Seems counterintuitive, but with that enabled the export seems to miss a bunch of data.
tvdijen commentedon Mar 5, 2025
@sullivan1337 Missing a bunch of data is to be expected if you filter resources.. Perfectly normal behaviour. This ticket is about exporting and then end up with empty files.
sullivan1337 commentedon Mar 5, 2025
The behavior I was seeing was if
Filtered resourceswas toggled on, my files were missing all SAML requests or empty all-together.As soon as I disabled the Filter, all the expected results and traffic were then included.
Just trying to help out as I was experiencing almost identical behavior as others in this thread.
tvdijen commentedon Mar 5, 2025
Thanks! That's useful info! Any other add-ons in place?
DavidCSloaneHKS commentedon May 20, 2025
Seeing this same behavior in Firefox for Windows 138.04, on Windows 11 23H2 with current patches. SAML Tracer and 1Password are the only enabled extensions. I have UBlock Origin but I've disabled it to try and fix SAML-tracer. I can see dozens of SAML-tagged entries in the SAML-tracer window, but export only produces a file containing "null", whether "Filter resources" is checked or un-checked. Any suggestions would be welcome.
gparrishgparrish commentedon Jun 16, 2025
I had this issue today at work in Firefox 139 in private mode. I was able to complete a couple of traces and received the exports without issue (491KB), then everything after that was all just 1KB files with the null. I had not really made any changes to the extension or had dev tools open at all. I removed and reinstalled the extension and had the same issue, then picked a different option on the export, and it started working again, but after 5-6 exports, it then went back to the 1KB export, and any export changes had no effect. I then opened dev tools and found this error below, in case it is helpful. Also, another weird behavior I noticed is that occasionally my in-private window is just closed by something, my SAML trace window is still up, but the Firefox private window I was using is just gone. I am going to switch over to Chrome to see if the exports work normally there.
Fix null export when requests have no response; add test suite
kellenmurphy commentedon May 10, 2026
The root cause is in
enrichWithResponseinSAMLTraceIO.js. When a request is blocked, cancelled, or interrupted before a response arrives,getResponse()returnsundefined. That gets passed tocreateFromJSON, which callsJSON.stringify(undefined)— butJSON.stringify(undefined)doesn't produce a string, it returns the JS valueundefined. SoJSON.parsethrows a SyntaxError, the exception goes uncaught,ui.exportResultis never updated, and the downloaded file contains justnull.The fix is a one-line null guard at the top of
enrichWithResponse: ifresis null or undefined, return early. That lets interrupted requests appear in the export without response fields, rather than crashing the whole thing. I'll include this in a PR along with a fix for the related issue in #106.Fix null export when requests have no response; add test suite (#108)
tvdijen commentedon May 31, 2026
Closed in #108