Ruby Security Field Guide

Parslet Level 1

In the following workshops we will have you walkthrough building a JSON parser using Parslet. The first level will have you construct the lexical analysis rules for carving the input into tokens. The second level will be concerned with transforming these lexical tokens into Ruby actions. We have provided you with boilerplate code as linked below in the workshop files.

For each of these exercises we have provided Rspec tests for you to check that your implementations are correct, when all of the Rspec tests pass, turn green, then you know you've completed the level! If you are unfamiliar with take a look at this Rspec primer.

While writing out your code, take exceptional care not to introduce vulnerabilities in the transformation process!

Edit the boiler plate code to create your parser. Once all of the rspec tests pass and all you see is green, move on to level 2. elow is a listing of the basic Ruby primitives you should be able to parse when finished:

  • Null (null)
  • Boolean (true, false)
  • Integers (1234)
  • Strings ("1234")
  • Arrays ([1234, "1234"])
  • Hashes ({"key": "value"})

Level 1 Files

Level 1 Additional Resources