Export is null on certain conditions

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
kellenmurphycommented, 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?

0reactions
bzbzhcommented, 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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

IS NULL not working in where clause when this data is ...
I converted an Excel file into a text file, then imported this text file into a SQL Server database using the SQL Server...
Read more >
Working with SQL NULL values - SQLShack
The IS NULL condition is used to return rows that contain the NULL ... SQL Server offers some functions that help to handle...
Read more >
simplesamlphp/SAML-tracer - Null value in exported file - GitHub
I'm having issues with exporting the trace. It doesn't matter if I mask/exclude values or not, the resulting file shows as null. This...
Read more >
null - JavaScript - MDN Web Docs - Mozilla
The null value represents the intentional absence of any object value. It is one of JavaScript's primitive values and is treated as falsy...
Read more >
Export Excel : issue with null values - Vizlib Community
The dash is exported in Excel that can cause some Excel formula to crash. As a consequence, the user need after export to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found