Configuration
You can configure CI Fuzz to fit your project's needs. The easiest and most common way is by using a cifuzz.yaml
file in your project's root directory.
Project Configuration
For project-specific settings that you want to share with your team, the cifuzz.yaml
file is the recommended approach. When you run cifuzz init
, an empty cifuzz.yaml
file is created.
Here is an example of a cifuzz.yaml
file:
# The build system used by your project (e.g., cmake, bazel, other).
build-system: cmake
# Directory where the compilation database (compile_commands.json) is located.
build-dir: "build"
# Engine used for fuzzing
engine: "libfuzzer"
# Settings for the AI Test Agent (Spark)
num-candidates: 10
target-coverage: 80
Discovering Configuration Options
The best way to see all available configuration options is to use the --help
flag with any CI Fuzz command. This ensures you always see the most up-to-date list of options.
For example, to see all options for the run
command:
cifuzz run --help
To see options for other commands, you can use:
cifuzz --help
(Global options)cifuzz create --help
cifuzz spark --help
Alternative Configuration Methods
While cifuzz.yaml
is best for most projects, you can also use environment variables or a global configuration file for specific use cases.
Environment Variables
You can override any setting using environment variables by prefixing the option name with CIFUZZ_
. This is useful for temporary settings or for use in CI/CD pipelines.
Example:
# Override the target coverage and number of candidates for a single run
export CIFUZZ_TARGET_COVERAGE=80
export CIFUZZ_NUM_CANDIDATES=5
cifuzz spark
Global Configuration
To set personal default options that apply to all your projects, you can create a global config.yaml
file.
File Location:
- Linux:
$HOME/.config/cifuzz/config.yaml
(or$XDG_CONFIG_HOME/cifuzz/config.yaml
) - macOS:
$HOME/Library/Application Support/cifuzz/config.yaml
Example:
# My personal default engine for all projects
engine: "libfuzzer"
Configuration Precedence
CI Fuzz applies configurations in the following order (highest precedence first):
- Environment Variables (e.g.,
CIFUZZ_ENGINE
) - Project Configuration (
cifuzz.yaml
) - Global Configuration (
config.yaml
)
This means an environment variable will always override a setting in your project's cifuzz.yaml
.