Subject: Fuzzing Structured Fields from ABNF

From: Mark Nottingham <[email-masked]>
Date: Thu, 9 Jul 2020 21:15:21 +1000

Kate, one of my colleagues, pointed out that one of the wonderful tools she's created:
  https://github.com/katef/kgt
... can be used to create input for blab from ABNF:
  https://gitlab.com/akihe/blab
... which can in turn be used to create values that conform to that ABNF.

I've put up a slightly modified blab file (with a couple of small tweaks, including one to remove generated base64, since it's so rarely actual base64):
  https://gist.github.com/mnot/06deaeadab6616929a59d687ca7dff25

This can be used to check your parser to see if it can handle the (hopefully valid) input. In the case of my parser:
  https://pypi.org/project/http-sfv/

It looks like this:

blab -l . -e "structured-fields.sf-dictionary" | python3 -m http_sfv --dictionary --stdin
blab -l . -e "structured-fields.sf-list" | python3 -m http_sfv --list --stdin
blab -l . -e "structured-fields.sf-item" | python3 -m http_sfv --item --stdin

(with http_sfv installed from source; I'll release a new version that does --stdin shortly).

Just thought this might be helpful for some implementers. I'll sleep a bit better knowing that the ABNF does indeed appear to produce correct output...

Cheers,

P.S. Should we do the same with http-core ABNF?

--
Mark Nottingham   https://www.mnot.net/

---

From: Amos Jeffries <[email-masked]>
Date: Fri, 10 Jul 2020 14:46:42 +1200

> P.S. Should we do the same with http-core ABNF?

If possible, please do.

Amos

---

From: Mark Nottingham <[email-masked]>
Date: Fri, 10 Jul 2020 13:46:50 +1000

> On 10 Jul 2020, at 12:46 pm, Amos Jeffries <[email-masked]> wrote:
> 

To do that, parsers would have to expose some way to run the traffic through and raise errors appropriately -- for all of the headers, etc. that they parse.