Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fuzz testing #16

Open
wants to merge 13 commits into
base: v6
Choose a base branch
from
Open

Fuzz testing #16

wants to merge 13 commits into from

Conversation

hulkoba
Copy link

@hulkoba hulkoba commented Dec 1, 2023

PR description

Relates to #openpgpjs#1689

Adds fuzz test for

  • createCleartextMessage
  • createMessage({binary})
  • createMessage({text})
  • generateKey()
  • readKey({ armoredKey })
  • readKey({ binaryKey })
  • readMessage({ binaryMessage })
  • readMessage({ armoredMessage })

Running a fuzz test

The test/fuzz directory contains fuzz targets like for example createMessageBinary.

You can run one fuzz target:

TARGET=createMessageBinary npm run fuzz

Notice, that TARGET is the name of your fuzz target module.


(Don't) running with coverage

Jazzer.js unfortunately does not support coverage for esm tests, yet.

We've implemented the tests also with coverage, turned everything into cjs, but removed it because it is not super useful.
Because the imported modules were not read correctly, the result always shows, that the fuzzing function is 100% covered but not the function we are trying to fuzz.

We decided to use esm-tests and wait until jazzer.js adds coverage support for esm.
Then it can be adapted easily, by adding the --coverage option to the jazzer command.

test/fuzz/readme.md Outdated Show resolved Hide resolved
@hulkoba hulkoba added question Further information is requested help wanted Extra attention is needed and removed question Further information is requested labels Dec 7, 2023
@hulkoba hulkoba force-pushed the fuzz-testing branch 8 times, most recently from da8c8b1 to 1b847bb Compare December 11, 2023 11:25
@hulkoba hulkoba removed the help wanted Extra attention is needed label Dec 11, 2023
@hulkoba hulkoba marked this pull request as ready for review December 11, 2023 13:01
@hulkoba hulkoba force-pushed the fuzz-testing branch 5 times, most recently from f5541b4 to 8c69033 Compare December 12, 2023 12:20
@hulkoba hulkoba force-pushed the fuzz-testing branch 2 times, most recently from 7752567 to 7a41b55 Compare December 12, 2023 12:44
package.json Outdated Show resolved Hide resolved
test/fuzz/createCleartextMessage.cjs Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
test/fuzz/readKeyArmored.cjs Outdated Show resolved Hide resolved
test/fuzz/readme.md Outdated Show resolved Hide resolved
because it is not super useul
since coverage does not work as expected at all, we can use esm. So if jazzer at some point, add esm support for esm, we can easily add it
@hulkoba hulkoba force-pushed the fuzz-testing branch 3 times, most recently from 7e80bb1 to 99a506a Compare December 18, 2023 08:03
@hulkoba hulkoba force-pushed the fuzz-testing branch 2 times, most recently from eeba908 to afc0432 Compare December 18, 2023 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants