Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 2
updates:
# Cargo dependencies
- package-ecosystem: cargo
directory: /
schedule:
interval: weekly
commit-message:
prefix: "deps"
groups:
rust-dependencies:
patterns:
- "*"
open-pull-requests-limit: 5

# GitHub Actions
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
commit-message:
prefix: "ci"
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ${{ matrix.os }}
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: CodeQL

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
# Weekly scan on Sundays
- cron: '0 0 * * 0'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: cpp
# Analyze generated C FFI headers and cross-language test code

- name: Build and compile C FFI test
run: |
# Build Rust library with FFI to generate C header
cargo build --release --features ffi,encryption
# Verify header was generated
ls -la include/cachekit.h
# Compile C FFI test (CodeQL traces compilation)
cd tests/cross_language
cc -std=c99 -Wall -Wextra -I../../include -c test_c.c -o test_c.o

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:cpp"
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: actions/create-github-app-token@v1
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ secrets.APP_ID }}
Expand All @@ -32,7 +32,7 @@ jobs:
if: ${{ needs.release-please.outputs.release_created }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
Expand Down
292 changes: 292 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,292 @@
name: Security

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '0 3 * * *'
release:
types: [published]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1

jobs:
fast-security:
name: Fast Security Checks
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "stable"
components: clippy

- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-security-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-security-
${{ runner.os }}-cargo-

- name: Install cargo-audit
run: cargo install cargo-audit --locked

- name: Install cargo-deny
run: cargo install cargo-deny --locked

- name: Run cargo audit (CVE scanning)
run: cargo audit

- name: Run cargo deny (license compliance + advisories)
run: cargo deny check

- name: Run clippy (strict linting)
run: cargo clippy --all-features --all-targets -- -D warnings

- name: Run tests
run: cargo test --all-features

quick-fuzz:
name: Quick Fuzz (Corpus Only)
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'pull_request'
strategy:
fail-fast: false
matrix:
target:
- byte_storage_checksum_collision
- byte_storage_compress
- byte_storage_corrupted_envelope
- byte_storage_decompress
- byte_storage_empty_data
- byte_storage_format_injection
- byte_storage_integer_overflow
- compression_bomb
- encryption_aad_injection
- encryption_key_derivation
- encryption_large_payload
- encryption_nonce_reuse
- encryption_roundtrip
- encryption_truncated_ciphertext
- integration_layered_security
- key_derivation
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly

- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
fuzz/target/
key: ${{ runner.os }}-cargo-fuzz-nightly-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-fuzz-nightly-
${{ runner.os }}-cargo-

- name: Install cargo-fuzz
run: cargo install cargo-fuzz --locked

- name: Run quick fuzz (corpus only)
run: |
cd fuzz
# Build first - fail fast on compile errors
cargo fuzz build ${{ matrix.target }}
# Run corpus - timeout exit code 124 is acceptable (means it ran)
timeout 120 cargo fuzz run ${{ matrix.target }} -- -runs=0 -max_total_time=120 || [ $? -eq 124 ]

deep-fuzz:
name: Deep Fuzzing (8 hours)
runs-on: ubuntu-latest
if: github.event_name == 'schedule'
strategy:
fail-fast: false
matrix:
target:
- byte_storage_checksum_collision
- byte_storage_compress
- byte_storage_corrupted_envelope
- byte_storage_decompress
- byte_storage_empty_data
- byte_storage_format_injection
- byte_storage_integer_overflow
- compression_bomb
- encryption_aad_injection
- encryption_key_derivation
- encryption_large_payload
- encryption_nonce_reuse
- encryption_roundtrip
- encryption_truncated_ciphertext
- integration_layered_security
- key_derivation
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly

- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
fuzz/target/
key: ${{ runner.os }}-cargo-fuzz-nightly-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-fuzz-nightly-
${{ runner.os }}-cargo-

- name: Install cargo-fuzz
run: cargo install cargo-fuzz --locked

- name: Run deep fuzz (30 minutes per target)
run: |
cd fuzz
# Build first - fail fast on compile errors
cargo fuzz build ${{ matrix.target }}
# Run fuzz - timeout exit code 124 is acceptable (means it ran the full duration)
timeout 1800 cargo fuzz run ${{ matrix.target }} -- -max_total_time=1800 || [ $? -eq 124 ]

- name: Upload crash artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: fuzz-crashes-${{ matrix.target }}
path: fuzz/artifacts/${{ matrix.target }}/
if-no-files-found: ignore

kani:
name: Kani Formal Verification
runs-on: ubuntu-latest
if: github.event_name == 'schedule'
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.85"

- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-kani-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-kani-
${{ runner.os }}-cargo-

- name: Install Kani
run: |
cargo install --locked kani-verifier || echo "Kani install failed, skipping verification"
cargo kani setup || echo "Kani setup failed, skipping verification"

- name: Run Kani verification
run: cargo kani --all-features || echo "Kani verification failed or not supported"
continue-on-error: true

cargo-vet:
name: Cargo Vet (Supply Chain)
runs-on: ubuntu-latest
if: github.event_name == 'schedule'
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.85"

- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-vet-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-vet-
${{ runner.os }}-cargo-

- name: Install cargo-vet
run: cargo install cargo-vet --locked

- name: Run cargo vet
run: cargo vet

sbom:
name: Generate SBOM
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.85"

- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-sbom-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-sbom-
${{ runner.os }}-cargo-

- name: Install cargo-sbom
run: cargo install cargo-sbom --locked

- name: Generate SBOM
run: cargo sbom > cachekit-core-sbom.json

- name: Upload SBOM as release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./cachekit-core-sbom.json
asset_name: cachekit-core-sbom.json
asset_content_type: application/json
Loading
Loading