Skip to content

Policy to detect components with neither PURL nor CPE defined #2587

Closed

Description

@mwerner96

Current Behavior

I want to define a policy to detect components that neither have a PURL nor a CPE defined. I have tried the following, as I couldn't find a condition for "not defined":

policy

My policy does not mark any components with No Identifier.
Looking at the code, it becomes apparent why my policy would not work:

https://github.com/DependencyTrack/dependency-track/blob/master/src/main/java/org/dependencytrack/policy/CpePolicyEvaluator.java#L53

The CpePolicyEvaluator does not evaluate empty (null) CPEs, just like the PackageURLPolicyEvaluator.

Proposed Behavior

It should be possible to check for empty PURL and/or CPE. I want to do this to remind me and my team to always add an identifier for vulnerability scanning.

I see two possible solutions:

  1. Add a condition to CPE and PURL (and possibly the others, too) to check for is empty.
  2. Remove the early return in the Evaluator classes, since the Matcher catches null anyways.

Checklist

Activity

  1. added
    enhancement
    on Mar 10, 2023
  2. added this to the 4.8 milestone on Mar 11, 2023
  3. github-actions commented on Apr 15, 2023

    @github-actions
    Contributor

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  4. locked as resolved and limited conversation to collaborators on Apr 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions