Files
IsaacTrost 311085c3c5 Debugger integration (#414)
* changed configuration to focus on seed-gen

* added nomminally working debug_subagent_task

* debugging process

* debugging process

* debugging process

* debugging process

* got debug subagent to work more reliably

* debugging why it cant find the seed file

* added more tests

* more debugging of debugginf functionality

* more debugging of debugger

* debugging working, scripts bad because some symbols are not found

* mostly working live debugging, still a bit pricy though

* Added hybrid mode that will do batch, then try interactive if that fails

* fixes

* fixes, updating docker interactive

* updating mi parsing for gdb

* modifications to the mi parser

* Improve coverage tracking precision (#401)

* Improve coverage tracking precision

Previously coverage tracking included all regions. This changes coverage tracking to be more precise.

Macros that result in code are represented as a single line in the function, and any executed line in the macro will make that line 'covered'. Beyound that, only CodeRegions will count. This will prevent code guarded by #if that aren't in the binary from being considered reachable for example. The idea is that seed-gen would have more accurate information when selecting functions to target.

I've done some testing and it appears as if the new implementation in general reaches more lines and covers more functions.

* Fix macro coverage leaking across files due to missing filename in key

The expansion_coverage map used (line, col) as key without filename,
causing coverage from one file to incorrectly appear in another when
macros were at the same coordinates.

* Recursively expand macros and add named types for coverage data

- Process ExpansionRegion target_regions recursively instead of counting
  only the call site line
- Add coordinate index for O(1) expansion lookups
- Cache computed expansion lines to avoid recomputation across functions
- Use bulk set operations for better performance
- Prevent infinite loops with visited set for circular macro references
- Add named types for coverage data structures:
  - RegionCoords, ExpansionKey, CachedExpansionLines
  - Type aliases: ExpansionMap, CoordToFilenames, ExpansionLinesCache
- Add comprehensive tests for nested macros and edge cases

* fix: fixing `line 110: set: -g: invalid option` for Fish shell (#408)

Co-authored-by: kevin-valerio <kevin-valerio@users.noreply.github.com>

* working state

* working state for monolith, still needs refactor

* limit grep output (whoops) and fix building to force optimization flags

* added function lookup tool

* added better build selection logic, and avoided c ode duplication

* fix fuzzer selection to ignore debug

* added debug builds as a seperate 'sanitizor'

* fixed build system, more in line with other dependancies now

* adding new better debug targets, and logging

* final changes before testing

* improving test coverage

* improving test coverage

* feat: add extract_povs command to buttercup-util (#410)

Add new CLI subcommand to extract PoVs, stack traces, and patches from
Redis submissions into a structured directory format for easy analysis.

Features:
- Extracts crash inputs (PoV files) via kubectl cp from cluster pods
- Writes fuzzer and tracer stack traces to text files
- Exports associated patches with metadata
- Organizes output by project/task_id/vulnerability
- Supports filtering by task_id and passed_only options
- Skips empty patch trackers (placeholders that never received content)

* Use git-lfs when downloading challenges

* improving test coverage

* Delete b.txt

* final changes before run hopefully

* feat: add extract_povs command to buttercup-util (#410)

Add new CLI subcommand to extract PoVs, stack traces, and patches from
Redis submissions into a structured directory format for easy analysis.

Features:
- Extracts crash inputs (PoV files) via kubectl cp from cluster pods
- Writes fuzzer and tracer stack traces to text files
- Exports associated patches with metadata
- Organizes output by project/task_id/vulnerability
- Supports filtering by task_id and passed_only options
- Skips empty patch trackers (placeholders that never received content)

* Sanitize exception messages for git clone command (#411)

* Sanitize exception messages for git clone command

* Update test case

* Don't sanitize exception if there is no PAT

* merging with main and fixing tests which tested old build system

* fixing erronous changes from testing

* fix silly linting errors

* reformatted for linter

* fixing failing tests

* fixing failing tests

* linting

* restore scripts to remove debugging changes

---------

Co-authored-by: Henrik Brodin <90325907+hbrodin@users.noreply.github.com>
Co-authored-by: Kevin Valerio <24193167+kevin-valerio@users.noreply.github.com>
Co-authored-by: kevin-valerio <kevin-valerio@users.noreply.github.com>
Co-authored-by: Ronald Eytchison <58823072+reytchison@users.noreply.github.com>
2026-01-26 09:15:48 -05:00
..
2025-07-31 09:55:36 -04:00
2025-10-03 10:36:30 -04:00
2025-03-27 16:50:03 +01:00

Buttercup Orchestrator

Components

Each component in the Orchestrator can be configured with CLI arguments or with environment variables. For example, the Task Server can be configured with the following CLI arguments:

$ buttercup-task-server --help
usage: buttercup-task-server [-h] [--redis_url str] [--log_level str] [--host str] [--port int] [--reload | --no-reload] [--workers int]

options:
  -h, --help            show this help message and exit
  --redis_url str       Redis URL (default: redis://localhost:6379)
  --log_level str       Log level (default: info)
  --host str            Host (default: 127.0.0.1)
  --port int            Port (default: 8000)
  --reload, --no-reload
                        Reload source code on change (default: False)
  --workers int         Number of workers (default: 1)

$ buttercup-task-server --redis_url redis://localhost:6379 --log_level debug --host 0.0.0.0 --port 8000 --reload --workers 4

Alternatively, the same configuration can be set with environment variables:

$ export BUTTERCUP_TASK_SERVER_REDIS_URL=redis://localhost:6379
$ export BUTTERCUP_TASK_SERVER_LOG_LEVEL=debug
$ export BUTTERCUP_TASK_SERVER_HOST=0.0.0.0
$ export BUTTERCUP_TASK_SERVER_PORT=8000
$ export BUTTERCUP_TASK_SERVER_RELOAD=true
$ export BUTTERCUP_TASK_SERVER_WORKERS=4
$ buttercup-task-server

Or it can be set in a .env file:

BUTTERCUP_TASK_SERVER_REDIS_URL=redis://localhost:6379
BUTTERCUP_TASK_SERVER_LOG_LEVEL=debug
BUTTERCUP_TASK_SERVER_HOST=0.0.0.0
BUTTERCUP_TASK_SERVER_PORT=8000
BUTTERCUP_TASK_SERVER_RELOAD=true
BUTTERCUP_TASK_SERVER_WORKERS=4

Version Management

The project uses hatchling for version management. The version is stored in pyproject.toml and is automatically used by the server's status endpoint.

To bump the version:

  1. Edit the version in pyproject.toml:
[project]
version = "0.1.0"  # Update this line
  1. The version will be automatically picked up by the server's status endpoint and API version.

Releasing a New Version

To create a new release:

  1. Update the version in pyproject.toml as described in the Version Management section above.

  2. Create and push a tag matching the version:

git tag v0.1.0  # Replace with your version
git push origin v0.1.0
  1. Manually create a new release on GitHub:
    • Go to the repository's "Releases" page
    • Click "Create a new release"
    • Select the tag you just created
    • Fill in the release title and description
    • Click "Publish release"

Once the release is created, the CI will automatically:

  • Build and publish Docker images for all components with the new version
  • Tag the images with both the full version and major.minor version
  • Push the images to GitHub Container Registry (ghcr.io)

Note

: If you encounter a "tag is needed when pushing to registry" error during the Docker build, this indicates an issue with the Docker workflow configuration. The workflow needs to be updated to properly set the image tags using the metadata action's output. This is typically fixed by ensuring the tags parameter in the docker/metadata-action step includes type=ref,event=release in its configuration. The current configuration only includes branch, PR, and semver patterns.

The Docker images will be available at:

ghcr.io/<repository-owner>/buttercup-orchestrator:<version>
ghcr.io/<repository-owner>/buttercup-fuzzer:<version>
ghcr.io/<repository-owner>/buttercup-patcher:<version>
ghcr.io/<repository-owner>/buttercup-seed-gen:<version>
ghcr.io/<repository-owner>/buttercup-program-model:<version>

Task Server

Provides the REST API the competition API will contact to submit new tasks for Buttercup to process. Implemented with FastAPI and based on the automatically generated code from the Swagger definitions.

uv run buttercup-task-server --help

Downloader

Download the sources for a new task.

uv run buttercup-task-downloader --help

Registry (debugging/development)

Small utility just for debugging/development, to inspect the task registry in Redis.

uv run buttercup-task-registry --help

Development

Create a new virtual environment and enter it:

uv venv
. ./.venv/bin/activate
uv sync --all-extras

Run the tests:

pytest

To update the apis to a newer version, run the following script:

make update-apis

from the orchestrator directory.