Skip to content

Commit

Permalink
Cflite fuzzing adding (#165)
Browse files Browse the repository at this point in the history
## Pull Request Template

### Prerequisites

<!-- Take a couple of minutes to help our maintainers work faster by
checking of the pre-requisites. -->
<!-- To tick the checkboxes replace the space with an 'x', so [ ]
becomes [x] . -->

- [x] I have
[searched](https://github.com/DefinetlyNotAI/Logicytics/pulls) for
duplicate or closed issues.
- [x] I have read the [contributing
guidelines](https://github.com/DefinetlyNotAI/Logicytics/blob/main/CONTRIBUTING.md).
- [x] I have followed the instructions in the
[wiki](https://github.com/DefinetlyNotAI/Logicytics/wiki) about
contributions.
- [ ] I have updated the documentation accordingly, if required.
- [ ] I have tested my code with the `--dev` flag, if required.

### PR Type

<!-- Take a couple of minutes to help our maintainers work faster by
telling us what is the PR guided on. -->
<!-- To tick the checkboxes replace the space with an 'x', so [ ]
becomes [x] . -->

- [ ] Bug fix <!-- Non-Breaking Bug Fix - Usually relates to fixing an
issue -->
- [x] New feature <!-- Non-Breaking Change that adds a new feature -->
- [ ] Refactoring <!-- Non-Breaking Change that modifies existing code
to refactor it to become more organised -->
- [ ] Documentation
update <!-- Non-Breaking Change that modifies existing documentation to
refactor it or add extra comments - either wiki, md files or code is
included here -->
- [ ] ⚠️ Breaking change ⚠️ <!-- Breaking Bug Fix / New Addition that
changes how Logicytics works -->

### Description

This pull request introduces several new GitHub workflows for
ClusterFuzzLite and refactors the `CODE/_debug.py` file to improve
logging and error handling. The most important changes include adding
new workflows for batch fuzzing, continuous builds, and cron tasks, as
well as refactoring methods in `_debug.py` to enhance readability and
functionality.

#### New GitHub Workflows:

*
[`.github/workflows/cflite_batch.yml`](diffhunk://#diff-949fc2996b2e6e5c6eaba884cacc65e708f97a3863d9c1771a9977bb900c0562R1-R37):
Added a workflow for batch fuzzing with ClusterFuzzLite, scheduled to
run every 6 hours.
*
[`.github/workflows/cflite_build.yml`](diffhunk://#diff-6a380eaf4eb765b7f8021b58c945424b0cef11356e166e1a5b223e6792572bacR1-R28):
Added a workflow for continuous builds with ClusterFuzzLite, triggered
on pushes to the main branch.
*
[`.github/workflows/cflite_cron.yml`](diffhunk://#diff-eeb1dc17caf046b9bba9036c2503d3884a1ed2fde3e7c832e9f5d26d3397a8d4R1-R27):
Added a workflow for daily cron tasks with ClusterFuzzLite, scheduled to
run once a day at midnight.

#### Refactoring in `CODE/_debug.py`:

* Improved logging and error handling in `HealthCheck` and `DebugCheck`
classes, including adding detailed docstrings and restructuring methods
for better readability.
[[1]](diffhunk://#diff-cddd7a4c003554a2fce729e954458aa39d397bf2910c94cdd093f39747848061L6-L36)
[[2]](diffhunk://#diff-cddd7a4c003554a2fce729e954458aa39d397bf2910c94cdd093f39747848061L71-L135)
[[3]](diffhunk://#diff-cddd7a4c003554a2fce729e954458aa39d397bf2910c94cdd093f39747848061L148-R163)
[[4]](diffhunk://#diff-cddd7a4c003554a2fce729e954458aa39d397bf2910c94cdd093f39747848061R180-R233)
[[5]](diffhunk://#diff-cddd7a4c003554a2fce729e954458aa39d397bf2910c94cdd093f39747848061L225-R247)
* Moved the `execution_policy` method from `DebugCheck` to `Check` class
in `CODE/logicytics/Checks.py` for better organization.
[[1]](diffhunk://#diff-83131f7977935512c18a758ef3ff85db0152c6f8277d99eb94b0bb6830c70a08R5)
[[2]](diffhunk://#diff-83131f7977935512c18a758ef3ff85db0152c6f8277d99eb94b0bb6830c70a08R25-R47)

### Motivation and Context

<!-- REQUIRED: Why is this PR required? What problem does it solve? Why
do you want to do it? -->
CI Testing, added fuzzing and fixed bugs

### Credit

<!-- If this PR is a contribution, please mention the contributors here
using the appropriate syntax. -->

<!--
### File-Created/CONTRIBUTION by MAIN-Username
What you did, created, removed, refactored, fixed, or discovered.
- [Your GitHub Username](https://github.com/YourGitHubLink)
- [Your GitHub Username](https://github.com/YourGitHubLink) etc...
-->

### Issues Fixed

<!-- REQUIRED: What issues will be fixed? (Format: "#50, #23" etc.) if
none exist type _N/A_ -->


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
  - Introduced three new GitHub Actions workflows for automated tasks: 
    - Batch fuzzing
    - Continuous integration builds
    - Daily cron tasks for fuzz testing

- **Bug Fixes**
- Enhanced logging in health and debug checks to streamline error
tracking.

- **Documentation**
- Updated method signatures and added new methods for improved
functionality and clarity.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
DefinetlyNotAI authored Dec 18, 2024
2 parents 0580aaf + 391a6ed commit 737a90d
Show file tree
Hide file tree
Showing 5 changed files with 224 additions and 102 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/cflite_batch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: ClusterFuzzLite batch fuzzing
on:
schedule:
- cron: '0 0/6 * * *' # Every 6th hour. Change this to whatever is suitable.
permissions: read-all
jobs:
BatchFuzzing:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sanitizer:
- address
# Override this with the sanitizers you want.
# - undefined
# - memory
steps:
- name: Build Fuzzers (${{ matrix.sanitizer }})
id: build
uses: google/clusterfuzzlite/actions/build_fuzzers@v1
with:
language: python # Change this to the language you are fuzzing.
sanitizer: ${{ matrix.sanitizer }}
- name: Run Fuzzers (${{ matrix.sanitizer }})
id: run
uses: google/clusterfuzzlite/actions/run_fuzzers@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
fuzz-seconds: 3600
mode: 'batch'
sanitizer: ${{ matrix.sanitizer }}
output-sarif: true
# Optional but recommended: For storing certain artifacts from fuzzing.
# See later section on "Git repo for storage".
# storage-repo: https://${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/OWNER/STORAGE-REPO-NAME.git
# storage-repo-branch: main # Optional. Defaults to "main"
# storage-repo-branch-coverage: gh-pages # Optional. Defaults to "gh-pages".
28 changes: 28 additions & 0 deletions .github/workflows/cflite_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: ClusterFuzzLite continuous builds
on:
push:
branches:
- main # Use your actual default branch here.
permissions: read-all
jobs:
Build:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ matrix.sanitizer }}-${{ github.ref }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
sanitizer:
- address
# Override this with the sanitizers you want.
# - undefined
# - memory
steps:
- name: Build Fuzzers (${{ matrix.sanitizer }})
id: build
uses: google/clusterfuzzlite/actions/build_fuzzers@v1
with:
language: python # Change this to the language you are fuzzing.
sanitizer: ${{ matrix.sanitizer }}
upload-build: true
27 changes: 27 additions & 0 deletions .github/workflows/cflite_cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: ClusterFuzzLite cron tasks
on:
schedule:
- cron: '0 0 * * *' # Once a day at midnight.
permissions: read-all
jobs:
Pruning:
runs-on: ubuntu-latest
steps:
- name: Build Fuzzers
id: build
uses: google/clusterfuzzlite/actions/build_fuzzers@v1
with:
language: python # Change this to the language you are fuzzing
- name: Run Fuzzers
id: run
uses: google/clusterfuzzlite/actions/run_fuzzers@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
fuzz-seconds: 600
mode: 'prune'
output-sarif: true
# Optional but recommended.
# See later section on "Git repo for storage".
# storage-repo: https://${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/OWNER/STORAGE-REPO-NAME.git
# storage-repo-branch: main # Optional. Defaults to "main"
# storage-repo-branch-coverage: gh-pages # Optional. Defaults to "gh-pages".
Loading

0 comments on commit 737a90d

Please sign in to comment.