-
-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for regex in filter object while running /sbom #1262
Comments
This is correct. |
@arkajnag23 could you try using the |
@prabhu Are you referring to 10.8.9? |
Thanks @prabhu for adding exclude in server mode; but this actually not resolving my issue. As filter supports to provide package details, hence my initial attempt was to use regex and negative lookahead to remove what I don't need to be in filtered SBOM. |
Filter is an array of strings where you can pass any part of a purl like group or package name; even maven and gradle profile names. cdxgen/lib/server/openapi.yaml Line 263 in be4e4f4
|
@prabhu If my understanding is correct , filter accepts array of String of packages what we want to include/extract and not what we want to exclude. If filterBom method can support REGEX then it would be really useful to define something like this: "^(?!.(abc\|test|)).$" |
Filter is to exclude. Only is to include. Can you give it a try please? |
Thanks @prabhu for clarifying. When I used this CURL request, then I am getting many dependencies being analyzed.
whereas when using , the result is very different
As the verification is happening on different purl -> value. |
@prabhu Together with my above comment, want to clarify why filter was designed like: Use --filter to filter components containing the string in the purl or components.properties.value. Was there any specific business requirement to have the filter check on components.properties.value |
Discussed in #1261
Originally posted by arkajnag23 July 23, 2024
I am using CDXGEN server mode and using POST method (/sbom) to generate the SBOM.
I have multi module Maven projects which includes Angular JS + Maven; CDXGEN seems to generate the sbom with required components.
But now, I want to exclude certain groups/artifacts to generate the filtered SBOM.
As I want to exclude hence I tried using negative lookahead with regular expression, like below:
curl -X POST http://localhost:9090/sbom \ -H "Content-Type: application/json" \ -d '{ "path": "/var/<workspace path>", "type": "maven,js", "multiProject": true, "resolveTransitive": true, "recurse": true, "installDeps": true, "filter": "^(?!.*(abc\\|test|)).*$" }'
While going through the source code, it seems the filterBom method, doesn't support Regular Expression.
Can someone provide some support on the same?
The text was updated successfully, but these errors were encountered: