question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Quotes in header values break almost all snippets for all Chromium HARs

See original GitHub issue

For example, I’m pretty sure this is an entirely valid raw HTTP header:

My-Header: "quoted" 'value'

In almost all cases I’ve seen, httpsnippet inserts this header value literally, without escaping either quote format, but within quotes in the output syntax, and so generating broken output every time, like: headers: { "My-Header": ""quoted" 'value'" }

This is bad because quotes are used in a lot of real HTTP traffic, for example new Chromium versions now send a “sec-ch-ua-platform” header on every single HTTPS request, and the value is always wrapped in quotes: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-UA-Platform.

That means this breaks almost all snippets from almost all Chrome HAR files, making them all syntactically invalid.

The only cases I’ve seen where this does work is the JS snippets that use stringify-object to build an options object, which generates single-quoted output and automatically escapes any included string quotes en route.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
pimterrycommented, Jun 8, 2022

I’ve actually been using my own httpsnippet fork, since the repo seemed abandoned, and in my fork (based on the pre-typescript code unfortunately) @eeWynell added a %q format to the codebuilder that handles quotes automatically, which might be interesting: https://github.com/httptoolkit/httpsnippet/commit/2401900ba1fb04526d2e110cfaf15a119a024083#diff-78e5fb011bd79a6d7b6f88df468aadeac95cf9c8adc86268642815b77f8bfaf2.

That was intended to start fixing some similar issues and add a base to add other new languages, but something similar might help solve this issue here.

As an aside - I’m excited to see the many changes here recently! I’d be very happy to drop my fork and migrate back to the main package, if there’s a chance that it’ll be actively maintained in future. I’m using httpsnippet in HTTP Toolkit. I’d be happy to help with the maintenance work here if there’s any way I can contribute, since I’m using it heavily and currently maintaining my own fork of the same thing anyway, just let me know.

Read more comments on GitHub >

github_iconTop Results From Across the Web

861678 - Sec-Metadata header causing issues with some sites
I tried to find out more about al_req_id and it turns out to be a simple Apache Log request ID and may or...
Read more >
Having Google Chrome repeat table headers on printed pages
If a page break occurs near the top of the table, it won't leave behind an orphaned caption or column headers with no...
Read more >
Header Tags: A Simple (But Complete) Guide To H1, H2 and ...
In this new guide, you'll learn exactly how to use H1 to H6 heading tags to optimize your page and drive higher search...
Read more >
XSS Filter Evasion - OWASP Cheat Sheet Series
This will bypass most SRC domain filters. Inserting JavaScript in an event method will also apply to any HTML tag type injection that...
Read more >
GitLab Flavored Markdown (GLFM)
Quote break. > This very long line is still quoted properly when it wraps. Keep writing to make sure this line is long...
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