Skip to content

fix(crypto): packages count [Backport release/0.7.z] - #2898

Merged
gildub merged 5 commits into
guacsec:release/0.7.zfrom
gildub:release/0.7.z-fix-crypto-packages-count
Nov 19, 2026
Merged

gildub merged 5 commits into
guacsec:release/0.7.zfrom
gildub:release/0.7.z-fix-crypto-packages-count

Conversation

@gildub

@gildub gildub commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary by Sourcery

Fix crypto-related package counts and extend crypto asset filtering across SBOM and PURL listings.

New Features:

  • Add a crypto asset filter to PURL listings, allowing packages that generate named algorithms, keys, or other crypto assets to be queried.
  • Broaden SBOM crypto filtering to include all crypto asset types, including related crypto material.

Bug Fixes:

  • Correct crypto package counts by restricting PURL matches to actual packages generating matching crypto assets.

Documentation:

  • Update the OpenAPI specification and endpoint descriptions for crypto asset filtering.

Tests:

  • Add coverage for PURL filtering by generated crypto assets and SBOM filtering by algorithms and keys.

@sourcery-ai

sourcery-ai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

API

Expose the PURL listing crypto filter as a repeated query parameter and pass its values to the service.

  • modules/fundamental/src/purl/endpoints/mod.rs L86-94, L114-122 (+2 small edits)
  • openapi.yaml L2890-2899

Update the SBOM crypto-filter description to cover all crypto asset types.

  • modules/fundamental/src/sbom/endpoints/mod.rs L185-186
  • openapi.yaml L3252-3253

Implementation

Filter listed PURLs to packages that generate matching verified crypto assets, and retain the existing unfiltered service method.

  • modules/fundamental/src/purl/service/mod.rs L42-45, L558-571, L651-744

Allow SBOM crypto filtering to match any crypto asset type instead of algorithms only.

  • modules/fundamental/src/sbom/service/sbom.rs L251 (removed lines)

Tests

Verify PURL filtering matches generated crypto assets, excludes similarly named non-crypto nodes, and accepts multiple names.

  • modules/fundamental/src/purl/endpoints/test.rs L3390-3449

Verify SBOM filtering matches both algorithm and key assets and returns no results for unknown names.

  • modules/fundamental/src/sbom/endpoints/test.rs L1974-2006

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[bot]
sourcery-ai Bot previously approved these changes Nov 18, 2026

@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.

Sourcery assessment

Approved.

@gildub
gildub force-pushed the release/0.7.z-fix-crypto-packages-count branch from 2acfb1f to 8e4007d Compare November 18, 2026 19:52

@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 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".cargo/config.toml" line_range="6" />
<code_context>
 xtask-ai = "run --features ai --package xtask --"

 [env]
-CARGO_WORKSPACE_ROOT = { value = "", relative = true }
\ No newline at end of file
+CARGO_WORKSPACE_ROOT = { value = "", relative = true }
</code_context>
<issue_to_address>
**Workspace builds stop at compile time**

When the build environment does not independently set `CARGO_WORKSPACE_ROOT`, `env!("CARGO_WORKSPACE_ROOT")` in `test_context::absolute`, `test-context`, and `modules/fundamental` fails during compilation because Cargo does not provide the variable, so workspace builds stop before tests or applications can run.

Restore the `.cargo/config.toml` environment entry for `CARGO_WORKSPACE_ROOT`.
</issue_to_address>

### Comment 2
<location path="modules/fundamental/src/purl/service/mod.rs" line_range="655" />
<code_context>
+            // packages (left) generating (relationship) a crypto asset (right) with a given name;
+            // the `sbom_crypto` join ensures the generated node really is a crypto asset, and not
+            // just a node which happens to share its name
+            let generated = sea_query::Query::select()
+                .column((
+                    sbom_node_purl_ref::Entity,
</code_context>
<issue_to_address>
**Non-package PURLs pass crypto filter**

When a CycloneDX machine-learning model has a PURL and is the source of a `provides` relationship to a crypto asset whose name matches the filter, the subquery matches every PURL reference on a node with a `Generates` relationship, without requiring the left node to be a package. A CycloneDX machine-learning model can have a PURL and participate in `provides`, so its PURL is returned as a package generating the crypto asset even though it has no `sbom_package` row.

Require the left node to have a matching `(sbom_id, node_id)` row in `sbom_package` before returning its PURL.
</issue_to_address>

Sourcery assessment

Approval pending. 2 findings to address first.

Blocking findings: .cargo/config.toml:6, modules/fundamental/src/purl/service/mod.rs:655


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread .cargo/config.toml Resolved
@gildub
gildub force-pushed the release/0.7.z-fix-crypto-packages-count branch from 8e4007d to d0aaeba Compare November 18, 2026 19:53
@sourcery-ai
sourcery-ai Bot dismissed their stale review November 18, 2026 19:55

Sourcery withdrew this approval because the latest commits introduced blocking findings.

@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.

Sourcery assessment

Approved.

@gildub
gildub added this pull request to the merge queue Nov 19, 2026
@gildub gildub changed the title Release/0.7.z fix crypto packages count [Backport release/0.7.z] fix(crypto): packages count [Backport release/0.7.z] Nov 19, 2026
Merged via the queue into guacsec:release/0.7.z with commit 2bf3518 Nov 19, 2026
9 checks passed
@gildub
gildub deleted the release/0.7.z-fix-crypto-packages-count branch November 19, 2026 13:43
@github-project-automation github-project-automation Bot moved this to Done in Trustify Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant