Commit Graph

103 Commits

Author SHA1 Message Date
Riccardo Schirone 093e26ec0a common: fallback to delete challenge task dir inside docker (#385)
* common/ChallengeTask: add exec_docker_cmd and use it to clean tmp dirs

* fix typo

* fix run-docker-cmd

* fix tests
2025-04-15 09:47:49 +02:00
Riccardo Schirone f8f1af6c66 common: remove some old example files (#387) 2025-04-14 18:07:03 +02:00
Riccardo Schirone cf6bde73b2 remove old OSSFuzzTool (#386) 2025-04-11 15:29:00 +02:00
Henrik Brodin 1e4e56490f NodeLocalStorage (#369)
This PR introduces a NodeLocal storage concept. Data is always processed on the local node, and only replicated to the azure file storage as needed.

A DaemonSet is introduced that syncs any corpus on the local node with the global corpus directory.

The following path structure is introduced:

/node_data/crs_scratch
/node_data/tasks_storage
/node_data/scratch
The first two directories is the equivalent of the previous usage of

/crs_scratch
/tasks_storage
The scratch is for basing temporary files and directories on the same filesystem as node-local version to be able to do atomic renames.

Further, ChallengeTask data is used normally on the /node_data/... paths, but is stored as /tasks_storage/{uuid}.tgz on the "remote" storage. This is to speed up copying.

Corpus and CrashSets are synced as is.
2025-04-11 14:03:49 +02:00
Riccardo Schirone eb66060ac3 ci: run mypy on components (#132) 2025-04-09 09:56:16 +02:00
Henrik Brodin 35680246eb Fix build-type (#370) 2025-04-08 12:58:42 +02:00
Henrik Brodin d187482bad Henrik boyan/fix type hints (#367)
* Use alternative type alias for BuildType type hints

* Remove unrelated test file

* check

---------

Co-authored-by: Boyan-MILANOV <boyan.milanov@trailofbits.com>
2025-04-08 11:34:16 +02:00
Riccardo Schirone 658f9c64c4 patcher: improve context retriever agent (#357) 2025-04-07 12:39:47 +02:00
Boyan MILANOV 966c184129 Make build_type a proper enum (#346)
* Make build type an int enum

* Lint

* Fix protobuf

* Fix protobuf for linux

* Remove old  enum and use the  class from protobuf message

* Lint

* Fix tests

* Print build type name instead of int value in logs

* Try fix enum instanciation in scheduler

* Correctly get protobuf enum name for BuildType values using EnumTypeWrapper methods

* Fix import

---------

Co-authored-by: Boyan MILANOV <boyanmilanov@coder-boyanmilanov-aixcc-boyan.c.production-1-405717.internal>
2025-04-07 11:54:42 +03:00
Henrik Brodin 44bbadb3c1 Implements stop harness processing (#317)
Previously, if all harnesses had zero weight on would still be chosen.
This ensures only harnesses of weight >0.0 are considered and allows for
proper stop.
A minor change to the task cancellation was also made to ensure delete
all tasks message was acknowledged properly.
2025-03-31 11:08:36 +02:00
Ronald Eytchison cc7ab22750 Fix CoverageMap and CoverageBot and add test cases (#319) 2025-03-30 09:42:42 -04:00
2over12 ab0d7be2fd Optimize Copies for Seedgen (#295)
* update seedgen

* context manager

* format

* format

* tests and fixes
2025-03-28 09:35:44 -04:00
Ronald Eytchison 5e089cf6c4 Upload LLM OTel data to Signoz (#275)
* Copy signoz deployment from example-crs-architecture

* Make ports local and remove unused clickhouse config

* Upload seed-gen LLM traces to SigNoz with OTel

* Add telemetry to patcher and seed-gen with common function

* Update README and lockfiles
2025-03-28 11:04:45 +01:00
Henrik Brodin c2e2dc95c7 Include task metadata (#290) 2025-03-28 09:27:10 +01:00
2over12 85e9f4818d Sliced Parser (#265)
* sliced parser

* add local target search

* update orchestrator

* more fixes

* test more

* remove ext refs

* lints

* fix list

* docs

* update
2025-03-27 08:49:20 -04:00
Ronald Eytchison 300e9d438a Use code coverage in seed-gen to sample functions (#204)
* Calculate function coverage fraction

Note: function isn't tested yet

* Store function coverage in Redis

* Sample function off coverage map in seed-gen

* Conditionally update function coverage

* Try multiple definition lookup heuristics

* Log function probability and coverage fraction

* Fix calculate_function_probabilities

* Fix docstring
2025-03-24 21:16:59 -04:00
Henrik Brodin 42ed9402f0 Stop work on expired (#196)
* Implements task cancelation

- Cancel one or all tasks.
- delete_task.sh script for invoking
- refactored to keep deleted tasks in a separate set, update tasks as
  needed from registry instead of updating the stored tasks.

* Refactor cancellation, update use in vulnerabilities

* Cleanup cancellation

* Remove package_name from protomsg

* Fix test case

* fix tests

* PR feedback
2025-03-19 18:00:16 +01:00
Riccardo Schirone 51648f62a6 patcher: reimplement loop limits (#210)
* patcher: implement review retries check

* patcher: simplify QE.build_patch_node

* patcher: implement retries

* common/examples: add libpng-example data
2025-03-14 09:15:04 +01:00
Riccardo Schirone bd72490b42 common/util-cli: extend utility to interact with CRS components (#197) 2025-03-12 18:27:16 +01:00
Riccardo Schirone 7fb382035d Update protobuf auto-generated code to remove package_name field (#198)
* Update protobuf auto-generated code to remove package_name field

* ci: ensure protobuf is always updated

* fix test_vulnerabilities

* lint

* fix pathcer test

* fix other tests

* lint

* fix ci

* REMOVE ME: test ci

* removed
2025-03-12 13:01:13 +01:00
Riccardo Schirone c92e6c6a6f program-model: mount local source directory when indexing (#168)
* common: add workdir_from_dockerfile API in ChallengeTask

* program-model: mount local source directory when indexing

* program-model: configure graphdb_url from settings
2025-03-10 14:23:56 +01:00
Riccardo Schirone e0b898a6b4 program-model: introduce codequery (#178)
* program-model/tree-sitter: refactor classes

* program-model/tree-sitter: change how paths are considered

This allows to parse also code in oss-fuzz (e.g. injected fuzz targets
not in upstream project)

* common: change name format for challenge commit

* program-model/codequery: make it persistent and nice

* program-model: disable janus & co for now

* patcher: make use of codequery instead of just tree-sitter

* program-model: add integration tests for codequery

* program-model/codequery: add support for different languages

* patcher: install codequery in patcher's container

* ci: fix codequery install

* program-model: ensure cqdb storage in /crs_scratch

* program-model: ensure the cqdb storage is available only at the end
2025-03-10 14:11:07 +01:00
Riccardo Schirone f3a0647b93 patcher: implement context-retriever loop in the SWE agent (#160)
* common: ignore errors when trying to restore a challenge

* patcher: allow SWE agent to request new context

* patcher: some other refactoring re code snippets
2025-03-07 11:09:50 +01:00
Ronald Eytchison 1a7537d204 Add Claude 3.7 sonnet (#126) 2025-03-06 09:23:22 -05:00
Ronald Eytchison 3e9321c7cc Remove mocked context (#119)
* Get function body from program-model for seed-explore

* Add harness finding fallback

Also add language field to project.yaml class

* Update test to have new TaskMeta param

* Install ripgrep in CI

* Search oss-fuzz project dir and add test cases
2025-03-06 09:20:50 -05:00
Henrik Brodin 0a7bac450e Henrik/indexing integration (#130)
Integration of the indexer service
2025-03-05 13:56:31 +01:00
Evan Downing d3f3cd3765 Add graphdb indexing (#114)
* Add indexes for fields

* Add indexing schema
2025-03-04 10:51:53 -05:00
Henrik Brodin 65dd397115 Store task-id in task-meta file (#123)
Store task-id in task-meta file
2025-03-04 13:00:13 +01:00
Ronald Eytchison 642728b704 Get diff from ChallengeTask instead of mock (#111)
* Get diff from ChallengeTask instead of mock

* Remove mock diff and don't pass WeightedHarness to Task

* Address review feedback

* Update seed-gen env var in CI
2025-03-03 08:54:20 -05:00
Riccardo Schirone 2b981259fd ci: enable integration tests in common package (#110) 2025-02-27 16:44:19 +01:00
Riccardo Schirone b0dc8cf68a patcher: simplify with Command and remove some older parts (#91)
* patcher: use pydantic basemodel
* patcher: restructure to use Command
* patcher: remove mock mode because not needed anymore
* remove also env var in docker compose for mock mode
* patcher: remove filtering for now
* patcher: remove | None to fields with default
2025-02-27 14:59:53 +01:00
Ronald Eytchison fecf87293d Add vuln discovery eval (#68)
* Add vuln discovery eval script

* Handle multiple markdown blocks in response

* Add langfuse metadata

* Add timestamp to output dirs

* Make abstract class

* Move vuln discovery eval script

* Make VulnDiscovery class

* Add eval script to test current vuln discovery implementation

* Switch to Claude 3.5 Sonnet for seed-gen

* Update vuln discovery prompts

* Appease ruff

* Update seed-gen for changes from main

* Fix ReproduceMultiple
2025-02-21 11:44:02 -05:00
2over12 4cf093043c Repro multiple sans in seed-gen (#82)
* repdocuce

* fix seedgen

* formatting

* fix bug

* lint:

* fix work dir

* first only

* fix format
2025-02-20 16:28:31 -05:00
Riccardo Schirone 5b1ce401c2 Serve loop (#78)
* patcher: do not use package_name anymore
* patcher: fix tests
2025-02-20 14:26:42 -05:00
2over12 1b9ea1da01 Allow multiple sanitizer builds without changing build type (#77)
* multiple builds per build type based on sanitizer

* update clients for now

* fixes

* formatting

* additional method

* add back name for now

* build builds of various types

* implement tracer bot

* use task loop with list

* fix users

* fix

* add max tries to tracer

* add test

* formatting

* fix field type

* fix default

* coverage_builds

* annotation

* restore old annotation
2025-02-20 10:59:29 -05:00
Henrik Brodin fe07435b77 Create the TaskMeta structure in the task directory (#79)
* Create the TaskMeta structure in the task directory

it contains information about project name and focus.

* lint

* Address review

* Restore name property
2025-02-20 03:48:23 +01:00
Evan Downing c6892939dc Updates program model directory (#66)
* Modify protobuf

* Update directory parameters for program model

* Update directory calls and build image call

* Always apply diff

* Always apply diff
2025-02-19 15:59:40 -05:00
Riccardo Schirone b27d6597ae common: make queue timeouts configurable (#75) 2025-02-19 14:51:10 -05:00
Riccardo Schirone 499eccaeb6 Patcher improvements (#57)
* patcher: improve the patcher by being more flexible

* patcher: use ChallengeTask.restore to retry patches

* patcher: simplify a bit the create_upatch
2025-02-19 12:27:12 -05:00
2over12 916f49048a Tracer (#38)
* task updates

* tracer

* tracer queue

* update pb

* finish up fuzzer bot

* regen proto

* task updates

* fix again

* newline

* add tracer bot compose

* add compose

* update orchestrator

* fix some tests

* fix group names

* ack the item

* fix import

* fix

* stub patcher interaction

* fix queue for now

* fix patcher

* formatting

* fixes

* parse stack trace

* bump stack trace

* merge proto

* update patcher:

* shorten timeout

* fix seedgen

* fix lint

* fix lints

* get rid of todo
2025-02-19 10:08:12 -05:00
Riccardo Schirone 2ad37085bc common: Challenge Task restore method (#56)
* common: make apply_patch_diff more flexible

* common: add 'restore' method in challenge task
2025-02-19 09:57:08 -05:00
Henrik Brodin 34fb10c4e2 Henrik/no build request mock (#64)
* Implement actual build request creation

Removes the mock and adds functionality to parse the project yaml.

* Move the ProjectYaml to common

* lint

* Pass in the correct name

* pr feedback

* Tmpfix uvlock
2025-02-19 00:22:27 +01:00
2over12 d4c9f74294 Enforce python >=3.10 and use ignore_cleanup_errors in TemporaryDirectory (#2)
* Enforce python >=3.10 and use ignore_cleanup_errors in TemporaryDirectory

* have an upper bound on requires-python

* update uv.locks

---------

Co-authored-by: Riccardo Schirone <riccardo.schirone@trailofbits.com>
2025-02-18 17:56:28 -05:00
Henrik Brodin 8d9a7c0d0a Cleanup of group names for consumers (#41)
* Cleanup of group names for consumers

We only really need distinct consumer group names if there are multiple
consumers. Most consumers are still the orchestrator components so I've
simplified things a bit and removed group names that weren't needed.

* fmt
2025-02-18 19:47:35 +01:00
Riccardo Schirone 0d046011ba common: adapt to newer diffs executed within the inner src dir 2025-02-18 13:42:01 -05:00
Riccardo Schirone 1918d160e0 fuzzer/builder-bot: install 'patch' in container 2025-02-18 13:42:01 -05:00
2over12 ea2fd093d5 Program model integrate (#13)
* Add documentation

* Add janusgraph custom configuration. Simply graph creation.

* Add properties to edges. Index on uri property.

* reformat

* Create libpng graph in a more reasonable amount of time.

* Update README.md

* Wrap indexing into function

* updating...

* update proto

* fix command

* Update settings for serve and processing indexing

* Add dockerfile to docker container

* Add trigger script

* Fix error with loading graphml file

* reformat

* Remove resource constraints for program model

* Change permissions of temp dir

* Update readme

* Update dockerignore

---------

Co-authored-by: Evan Downing <2077950+evandowning@users.noreply.github.com>
2025-02-18 11:59:16 -05:00
2over12 3668cd9301 Apply diff in builder bot (#32)
* apply diff in builder bot

* fix dockerfile seed-gen

* format

* apply the diffs

* fix builds

* store if diff was applied

* Revert "format"

This reverts commit f07a806ebd98f16409f0c3676aefc50441562239.
2025-02-18 10:43:51 -05:00
Riccardo Schirone 7166ccfba5 common: move diff apply into ChallengeTask (#34)
* common: move diff apply into ChallengeTask

* common: do not raise exceptions if no patch

* common: use raw string for mocked patch

* common: enforce ordering in get_diffs
2025-02-18 09:56:36 -05:00
Ronald Eytchison 02679fe521 Switch from Azure-hosted models to OpenAI-hosted 2025-02-18 09:54:44 -05:00