Thank you for contributing to the Buttercup Cyber Reasoning System!
# Clone and setup
git clone --recurse-submodules https://github.com/trailofbits/buttercup.git
cd buttercup
make setup-local # Automated setup
make deploy # Start environment
# Setup development tools (optional but recommended)
cargo install prek # Fast Rust-based git hooks
prek install # Auto-runs checks on commitmake help # View all commands
make lint # Lint all components
make lint-component COMPONENT=orchestrator # Lint specific component
make send-libpng-task # Run test task
make status # Check deployment status
make undeploy # Clean up resources- Tools:
ruff(formatting/linting),ty(type checking) - Git hooks:
prekautomatically validates code, configs, and line endings on commit - Manual checks:
prek runormake lint
Redis (required for unit tests):
# Start Redis with Docker
docker run -d -p 6379:6379 --name buttercup-redis redis:7.4
# Or on macOS with Homebrew
brew install redis && brew services start redisSystem dependencies (varies by component):
| Component | Dependencies |
|---|---|
| common, orchestrator | ripgrep |
| fuzzer, fuzzer_runner | ripgrep |
| program-model, patcher, seed-gen | ripgrep, codequery, universal-ctags, custom cscope |
# macOS
brew install ripgrep codequery universal-ctags autoconf automake
git submodule update --init external/buttercup-cscope
make install-cscope
# IMPORTANT: universal-ctags must be in PATH before BSD ctags (macOS default).
# BSD ctags is incompatible with cscope/codequery. Add to ~/.zshrc or ~/.bashrc:
export PATH="/opt/homebrew/bin:$PATH"
# Ubuntu/Debian
sudo apt-get install -y ripgrep codequery universal-ctags autoconf automake
git submodule update --init external/buttercup-cscope
make install-cscopeseed-gen only - requires WASM Python build path:
export PYTHON_WASM_BUILD_PATH="python-3.12.0.wasm"-
Unit Tests (5-10 min): Run on all PRs
cd <component> && uv run pytest
-
Integration Tests (15-30 min): Daily or with
integration-testslabel# Requires: codequery, ripgrep, cscope (for program-model, patcher, seed-gen) # Requires: NODE_DATA_DIR env var pointing to writable scratch directory NODE_DATA_DIR=/tmp/buttercup_test uv run pytest --runintegration
macOS limitations: Some integration tests require Docker builds that only work on x86_64 Linux (CI). Tests that work locally on macOS ARM64:
common/tests/test_reliable_queue.py- Redis queue testsprogram-model/tests/test_tree_sitter.py- Tree-sitter parsingpatcher/tests/test_utils.py,test_context_retriever.py- Patcher utilitiesseed-gen/test/test_find_harness.py- Harness finding (some skipped)
-
Full System (90+ min): Weekly or with
full-integrationlabelmake deploy && make send-libpng-task
| Component | Purpose |
|---|---|
/common/ |
Shared utilities, protobufs, Redis queues |
/orchestrator/ |
Task coordination, scheduling, API client |
/fuzzer/ |
Vulnerability discovery bots |
/fuzzer_runner/ |
Fuzzer execution runner |
/program-model/ |
Code analysis (CodeQuery, Tree-sitter) |
/patcher/ |
LLM-powered patch generation |
/seed-gen/ |
Intelligent input generation |
- Branch from main:
git checkout -b feature/your-feature - Code following existing patterns and conventions
- Test your changes at appropriate level
- Commit (prek hooks run automatically if installed)
- Push and create PR with clear description
Each component uses uv:
cd <component>
uv sync # Install dependencies
uv add <package> # Add new dependency
uv lock --upgrade # Update dependencies- Follow existing patterns in each component
- Use structured logging and Pydantic models
- Handle errors with circuit breakers for external services
- Write tests for new functionality
integration-tests- Triggers component integration testsfull-integration- Triggers full system test (use sparingly)
# Kubernetes commands
kubectl logs -n crs -l app=<service> --tail=100
kubectl exec -it -n crs <pod> -- /bin/bash
kubectl port-forward -n crs service/buttercup-competition-api 31323:1323- Environment issues? Run
make validateto check if your setup is ready - Tests failing? Ensure Redis is running (see Test Prerequisites) and dependencies are installed with
cd <component> && uv sync - Missing system tools? See the Test Prerequisites table for component-specific dependencies
- Quick Reference - Common commands and troubleshooting
- Deployment Guide - Detailed deployment information
- Custom Challenges - Adding new test cases
Open an issue or reach out to the development team.