Giter Site home page Giter Site logo

embo-test / jazzer.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from codeintelligencetesting/jazzer.js

0.0 0.0 0.0 4.66 MB

Coverage-guided, in-process fuzzing for the Node.js

Home Page: https://code-intelligence.com

License: Apache License 2.0

Shell 0.28% JavaScript 12.76% C++ 9.78% C 1.25% TypeScript 73.97% CMake 1.87% Batchfile 0.09%

jazzer.js's Introduction

Jazzer.js is a coverage-guided, in-process fuzzer for the Node.js platform developed by Code Intelligence. It is based on libFuzzer and brings many of its instrumentation-powered mutation features to the JavaScript ecosystem.

Jazzer.js currently supports the following platforms:

  • Linux x86_64
  • macOS x86_64 and arm64
  • Windows x86_64

Quickstart

To use Jazzer.js in your own project follow these few simple steps:

  1. Add the @jazzer.js/core dev-dependency

    npm install --save-dev @jazzer.js/core
  2. Create a fuzz target invoking your code

    // file "FuzzTarget.js"
    module.exports.fuzz = function (data /*: Buffer */) {
    	const fuzzerData = data.toString();
    	myAwesomeCode(fuzzerData);
    };
    
    // Alternatively, using ES6 syntax is also possible
    export function fuzz(data /*: Buffer */) {
    	const fuzzerData = data.toString();
    	myAwesomeCode(fuzzerData);
    }
  3. Start the fuzzer using the fuzz target

    npx jazzer FuzzTarget
  4. Enjoy fuzzing!

Usage

Jazzer.js can be used in two ways: Creating dedicated fuzz targets, as shown in the Quickstart section, or integrated into the Jest test framework.

Using test framework integration

To use fuzzing in your normal development workflow, a tight integration with the Jest test framework is provided. This coupling allows the execution of fuzz tests alongside your normal unit tests and seamlessly detect problems on your local machine or in your CI, enabling you to check that found bugs stay resolved forever.

Furthermore, the Jest integration enables great IDE support, so that individual inputs can be run or even debugged, similar to what you would expect from normal Jest tests.

Note: Detailed explanation on how to use the Jest integration can be found at docs/jest-integration.md.

A fuzz test in Jest looks similar to the following example:

describe("My function", () => {
	it.fuzz("can be fuzzed", (data) => {
		target.fuzzMe(data);
	});
});

Using fuzz targets

Creating fuzz targets and executing those via CLI commands is straightforward and similar to what you would expect from other fuzzers. This approach offers the most control and can easily be integrated in your CI pipelines via npm/npx commands.

Note: Detailed explanation on how to create and use fuzz targets can be found at docs/fuzz-targets.md.

A fuzz target can look as simple as this example:

// file "FuzzTarget.js"
module.exports.fuzz = function (data /*: Buffer */) {
	const fuzzerData = data.toString();
	myAwesomeCode(fuzzerData);
};

Documentation

Further documentation is available at docs/readme.md.

Demo Video - Introduction to Jazzer.js

We recorded a live demo which shows how to get Jazzer.js up and running for your own projects. If you are just getting started, this might be helpful.

You can watch the recording here.

Credit

Jazzer.js is inspired by its namesake Jazzer, also developed by Code Intelligence.

Code Intelligence logo

jazzer.js's People

Contributors

dependabot[bot] avatar kyakdan avatar bertschneider avatar oetr avatar sebastianpoeplau avatar 0xricksanchez avatar thiamthiam avatar flipsi avatar ligurio avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.