How Filtering Works
Filter expressions work on packages (dependencies) and evaluate to a boolean result. Packages are included in results when expressions evaluate totrue.
Quick Examples
License Filtering
List only packages that use the MIT license:Popularity Analysis
Find dependencies that appear unpopular:Vulnerability Detection
Find dependencies with critical vulnerabilities:Filter Input Structure
Filter expressions receive the following input data:| Variable | Content |
|---|---|
_ | The root variable, holding other variables |
vulns | Map of vulnerabilities organized by severity |
scorecard | OpenSSF Scorecard metrics and scores |
projects | List of source projects associated with the package |
licenses | List of licenses in SPDX license code format |
pkg | Package information (ecosystem, name, version) |
Refer to the filter input specification for the detailed structure of input messages.
Common Filter Expressions
Security-Focused Filters
- Vulnerability Checks
- Maintenance Checks
- License Compliance
Project Quality Filters
Advanced Combination Filters
Filter Input JSON Example
Understanding the structure helps create effective filters:Practical Use Cases
Security Auditing
License Compliance
Quality Assessment
Performance Tips
Optimize Complex Filters
Optimize Complex Filters
- Place most selective conditions first
- Use
&&instead of nested conditions when possible - Avoid redundant checks in complex expressions
Use Appropriate Data Types
Use Appropriate Data Types
- Use
size()for counting array elements - Use
exists()for checking array membership - Use direct comparison for simple values
Batch Operations
Batch Operations
- Combine multiple similar checks into single expressions
- Use the query workflow for repeated filtering operations
- Cache results using JSON dumps for multiple analyses
CEL Language Quick Reference
Common Functions
size()- Get length of arrays or mapsexists(var, condition)- Check if condition is true for any elementin- Check membership in arrays or mapscontains()- String contains checkstartsWith()/endsWith()- String prefix/suffix checks
Operators
==,!=- Equality comparison<,<=,>,>=- Numeric comparison&&,||- Logical AND, OR!- Logical NOT+,-,*,/- Arithmetic operations
Data Types
true,false- Booleans"string"- Strings (double quotes)123,45.67- Numbers["a", "b"]- Arrays{"key": "value"}- Maps

