OpenPrinting / OpenPrinting/libcups

ippfuzz: Fuzz test generator for ipptool

Open
#47 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement priority-low
Dominant language
C
Stars
81
Forks
48
Avg merge
23h 58m
Merged PRs (30d)
2

Description

Copied from ippsample issue 72

As part of our discussions during the February 2018 IPP F2F meeting, we discussed ways to introduce fuzz-testing into ipptool.

Two approaches were considered:

  1. Adding support to ipptool to randomly generate requests, attributes, values, etc.
  2. Adding a program to generate random ipptool test files that can be fed into ipptool.

Since the first approach would still require ipptool to be able to write out a failed test for later diagnosis (what the second approach will do as its primary function), it seems like creating a test file generator is the simpler approach.

The generator should provide options to limit the amount of randomness, for example "always use Get-Printer-Attributes", "always include the following attributes and values", etc. so that "mostly valid" requests can be generated to test specific areas.

The generator should also provide options for the expected responses, for example "expect the following status codes" or "expect the random attributes to be in the unsupported attributes group of the response."

Ideally ippfuzz should be able to automate running ipptool and iterate N times, storing the results in a directory and providing a summary of the test results on stdout.


Also, when automating the tool should stop after a certain number of repeated failures (default 3?) - at that point the Printer has probably crashed...


When writing the results to a test directory, rename tests and results, e.g. "pass-nnnnnnnn.ext" for passed tests and "fail-nnnnnnnn.ext" for failed tests? Be sure to include the .test file and the XML results plist file.


Maybe focus on supporting fuzzing templates which look like ipptool test files? Expand values like:

  • "$[ascii(100)]": Random string of exactly 100 characters
  • "$[ascii(0,32767)]": Random string of 0 to 32767 characters
  • "$[utf8(1000)]": Random Unicode string of 1000 characters
  • "$[bytes(10,5000)]": 10 to 5000 random bytes
  • "$[integer(10,20)]": Random integer from 10 to 20
  • "$[boolean]": Random boolean value
  • "$[value1|value2|value3]": randomly choose between the three values
  • "$[repeat(10000) ... ]": expand the "..." text 10000 times.

"$[...]" might not be the best choice, consider other markup options.

Need to see what other fuzzing tools do.


Resources:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing ipptool and the copied ippsample issue for existing test-file and result formats. Compare the proposed generator, template expansion, automation, failure limits, and result storage requirements with available fuzzing tools. Done means an agreed scope and a working ippfuzz workflow that generates tests, runs ipptool, stores pass/fail artifacts, and summarizes results.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cli, testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.