Skip to content

ci: pin actions to commit SHAs (supply-chain); add yara-scan feature build/test job - #14

Merged
warpedatom merged 1 commit into
mainfrom
ci/sha-pin-and-yara-coverage
Jul 21, 2026
Merged

ci: pin actions to commit SHAs (supply-chain); add yara-scan feature build/test job#14
warpedatom merged 1 commit into
mainfrom
ci/sha-pin-and-yara-coverage

Conversation

@warpedatom

@warpedatom warpedatom commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Closes the CI gap where the yara-scan feature was never built in CI.

Summary by Sourcery

Pin GitHub Actions in CI and release workflows to specific commit SHAs and add CI coverage for the yara-scan feature, including build, test, and lint steps.

Build:

  • Pin actions/checkout, dtolnay/rust-toolchain, Swatinem/rust-cache, and softprops/action-gh-release to specific commit SHAs in CI and release workflows.

CI:

  • Add a dedicated yara-scan CI job that installs clang/libclang and runs build, tests, and clippy with the yara-scan feature enabled.

…build/test job

Closes the CI gap where the yara-scan feature was never built in CI.
@sourcery-ai

sourcery-ai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Pins all GitHub Actions in CI and release workflows to specific commit SHAs for supply-chain hardening, and adds a dedicated CI job to build, test, and lint the yara-scan feature on Ubuntu with the necessary system dependencies installed.

Sequence diagram for the new yara-scan CI job

sequenceDiagram
  participant CI_workflow
  participant actions_checkout
  participant dtolnay_rust_toolchain
  participant Swatinem_rust_cache
  participant apt_get
  participant cargo

  CI_workflow->>actions_checkout: uses actions/checkout@3d3c42e5...
  CI_workflow->>dtolnay_rust_toolchain: uses dtolnay/rust-toolchain@4cda84d5...
  CI_workflow->>Swatinem_rust_cache: uses Swatinem/rust-cache@e18b4977...
  CI_workflow->>apt_get: run sudo apt-get update
  CI_workflow->>apt_get: run sudo apt-get install -y clang libclang-dev
  CI_workflow->>cargo: run cargo build --release --features yara-scan --verbose
  CI_workflow->>cargo: run cargo test --features yara-scan --verbose
  CI_workflow->>cargo: run cargo clippy --all-targets --features yara-scan -- -D warnings
Loading

File-Level Changes

Change Details Files
Pin all GitHub Actions in CI workflow to immutable commit SHAs.
  • Replace version tags for actions/checkout with a specific commit SHA and comment the corresponding major version.
  • Replace version tags for dtolnay/rust-toolchain with a specific commit SHA and comment the corresponding channel (stable).
  • Replace version tags for Swatinem/rust-cache with a specific commit SHA and comment the corresponding major version.
.github/workflows/ci.yml
Add a CI job to build, test, and lint the project with the yara-scan feature enabled.
  • Define a new yara job that runs on ubuntu-latest.
  • Reuse pinned checkout, toolchain, and rust-cache actions in the new job.
  • Install clang and libclang-dev via apt to satisfy bindgen/libyara build requirements.
  • Run cargo build, test, and clippy with the yara-scan feature enabled and clippy configured to deny warnings.
.github/workflows/ci.yml
Pin all GitHub Actions in release workflow to immutable commit SHAs.
  • Replace version tags for actions/checkout with a specific commit SHA and comment the corresponding major version.
  • Replace version tags for dtolnay/rust-toolchain with a specific commit SHA and comment the corresponding channel (stable).
  • Replace version tags for Swatinem/rust-cache with a specific commit SHA and comment the corresponding major version.
  • Replace version tag for softprops/action-gh-release with a specific commit SHA and comment the corresponding major version.
.github/workflows/release.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The new yara job largely duplicates the setup steps from other jobs; consider extracting common steps into a reusable workflow or composite action to keep CI configuration DRY and easier to maintain.
  • The apt-get update && apt-get install step in the yara job will run on every workflow execution; if this becomes a bottleneck, you might want to look into using a prebuilt image or a dedicated setup-clang action to avoid repeated package installs.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `yara` job largely duplicates the setup steps from other jobs; consider extracting common steps into a reusable workflow or composite action to keep CI configuration DRY and easier to maintain.
- The `apt-get update && apt-get install` step in the `yara` job will run on every workflow execution; if this becomes a bottleneck, you might want to look into using a prebuilt image or a dedicated setup-clang action to avoid repeated package installs.

## Individual Comments

### Comment 1
<location path=".github/workflows/ci.yml" line_range="58-59" />
<code_context>
+      - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
+      # bindgen needs libclang; the vendored libyara compiles from source with the
+      # runner's C toolchain (build-essential is preinstalled on ubuntu-latest).
+      - name: Install clang/libclang for the vendored yara build
+        run: sudo apt-get update && sudo apt-get install -y clang libclang-dev
+      - run: cargo build --release --features yara-scan --verbose
+      - run: cargo test --features yara-scan --verbose
</code_context>
<issue_to_address>
**suggestion (performance):** Tighten the apt-get install to avoid pulling unnecessary packages and speed up the job.

Please switch to `sudo apt-get update && sudo apt-get install -y --no-install-recommends clang libclang-dev` so we don’t pull in recommended packages unnecessarily while still meeting bindgen/libyara’s requirements.

```suggestion
      - name: Install clang/libclang for the vendored yara build
        run: sudo apt-get update && sudo apt-get install -y --no-install-recommends clang libclang-dev
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread .github/workflows/ci.yml
Comment on lines +58 to +59
- name: Install clang/libclang for the vendored yara build
run: sudo apt-get update && sudo apt-get install -y clang libclang-dev

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (performance): Tighten the apt-get install to avoid pulling unnecessary packages and speed up the job.

Please switch to sudo apt-get update && sudo apt-get install -y --no-install-recommends clang libclang-dev so we don’t pull in recommended packages unnecessarily while still meeting bindgen/libyara’s requirements.

Suggested change
- name: Install clang/libclang for the vendored yara build
run: sudo apt-get update && sudo apt-get install -y clang libclang-dev
- name: Install clang/libclang for the vendored yara build
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends clang libclang-dev

@warpedatom
warpedatom merged commit 53402a2 into main Jul 21, 2026
6 checks passed
@warpedatom
warpedatom deleted the ci/sha-pin-and-yara-coverage branch July 21, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant