Skip to content
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

Invalid catalogers are silently ignored #2389

Closed
selzoc opened this issue Dec 1, 2023 · 4 comments
Closed

Invalid catalogers are silently ignored #2389

selzoc opened this issue Dec 1, 2023 · 4 comments
Labels
bug Something isn't working changelog-ignore Don't include this issue in the release changelog good-first-issue Good for newcomers

Comments

@selzoc
Copy link
Contributor

selzoc commented Dec 1, 2023

What happened:
Due to #2277, some catalogers were renamed. As a result, our config file (which had the old names) lead our syft scan to produce no packages.

What you expected to happen:
syft to print an error or warning letting us know that our config is invalid.

Steps to reproduce the issue:

pwd
/Users/cselzo/workspace/syft
→ cat /tmp/foo.yml
catalogers:
  - foo
  - bar
  - baz
  - qux
→ syft -v packages . -c /tmp/foo.yml
[0000]  INFO syft version: 0.98.0
[0000]  WARN no explicit name and version provided for directory source, deriving artifact ID from the given path (which is not ideal)
[0000]  INFO could not identify distro
[0000]  INFO skipping cataloger "alpm-db-cataloger"
[0000]  INFO skipping cataloger "apk-db-cataloger"
[0000]  INFO skipping cataloger "binary-cataloger"
[0000]  INFO skipping cataloger "conan-cataloger"
[0000]  INFO skipping cataloger "dart-pubspec-lock-cataloger"
[0000]  INFO skipping cataloger "dpkg-db-cataloger"
[0000]  INFO skipping cataloger "dotnet-deps-cataloger"
[0000]  INFO skipping cataloger "dotnet-portable-executable-cataloger"
[0000]  INFO skipping cataloger "elixir-mix-lock-cataloger"
[0000]  INFO skipping cataloger "erlang-rebar-lock-cataloger"
[0000]  INFO skipping cataloger "github-actions-usage-cataloger"
[0000]  INFO skipping cataloger "github-action-workflow-usage-cataloger"
[0000]  INFO skipping cataloger "go-module-file-cataloger"
[0000]  INFO skipping cataloger "go-module-binary-cataloger"
[0000]  INFO skipping cataloger "haskell-cataloger"
[0000]  INFO skipping cataloger "java-archive-cataloger"
[0000]  INFO skipping cataloger "java-gradle-lockfile-cataloger"
[0000]  INFO skipping cataloger "java-pom-cataloger"
[0000]  INFO skipping cataloger "graalvm-native-image-cataloger"
[0000]  INFO skipping cataloger "javascript-lock-cataloger"
[0000]  INFO skipping cataloger "javascript-package-cataloger"
[0000]  INFO skipping cataloger "linux-kernel-cataloger"
[0000]  INFO skipping cataloger "nix-store-cataloger"
[0000]  INFO skipping cataloger "php-composer-installed-cataloger"
[0000]  INFO skipping cataloger "php-composer-lock-cataloger"
[0000]  INFO skipping cataloger "portage-cataloger"
[0000]  INFO skipping cataloger "python-package-cataloger"
[0000]  INFO skipping cataloger "python-installed-package-cataloger"
[0000]  INFO skipping cataloger "r-package-cataloger"
[0000]  INFO skipping cataloger "rpm-archive-cataloger"
[0000]  INFO skipping cataloger "rpm-db-cataloger"
[0000]  INFO skipping cataloger "ruby-gemfile-cataloger"
[0000]  INFO skipping cataloger "ruby-gemspec-cataloger"
[0000]  INFO skipping cataloger "ruby-installed-gemspec-cataloger"
[0000]  INFO skipping cataloger "cargo-auditable-binary-cataloger"
[0000]  INFO skipping cataloger "rust-cargo-lock-cataloger"
[0000]  INFO skipping cataloger "sbom-cataloger"
[0000]  INFO skipping cataloger "cocoapods-cataloger"
[0000]  INFO skipping cataloger "swift-package-manager-cataloger"
No packages discovered

Anything else we need to know?:

Environment:

  • Output of syft version:
    Application: syft
    Version:    0.98.0
    BuildDate:  2023-11-29T14:42:34Z
    GitCommit:  Homebrew
    GitDescription: [not provided]
    Platform:   darwin/arm64
    GoVersion:  go1.21.4
    Compiler:   gc
    
  • OS (e.g: cat /etc/os-release or similar): macOS 13.6.2
@selzoc selzoc added the bug Something isn't working label Dec 1, 2023
@tgerla
Copy link
Contributor

tgerla commented Dec 4, 2023

Hi @selzoc, thanks for the report. Looking at your output I see that Syft is logging an INFO line noting each skipped cataloger. That message might be better being a WARN or even a fatal error. Would changing INFO to WARN solve your problem, do you think? I can see the argument for making it a fatal error, though.

@tgerla tgerla moved this to Awaiting Response in OSS Dec 4, 2023
@daxxog
Copy link

daxxog commented Dec 22, 2023

I don't think changing all the "skipping cataloger" messages to WARN would be what we would want; rather having a WARN emitted when a non-existent cataloger is used.

% syft -v packages . --catalogers this-cataloger-does-not-exist |& grep this-cataloger-does-not-exist
% echo $?
1

@wagoodman
Copy link
Contributor

yeah, if there are no catalogers that are ultimately used, this should be an error and exit 1. It seems like a simple check here and return an error around here would do the trick:

nCatalogers := len(catalogers)

@wagoodman wagoodman added the good-first-issue Good for newcomers label Jan 3, 2024
@wagoodman wagoodman moved this from Awaiting Response to Backlog in OSS Jan 3, 2024
@wagoodman
Copy link
Contributor

Fixed by #1383

@github-project-automation github-project-automation bot moved this from Backlog to Done in OSS Jan 22, 2024
@wagoodman wagoodman added the changelog-ignore Don't include this issue in the release changelog label Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working changelog-ignore Don't include this issue in the release changelog good-first-issue Good for newcomers
Projects
Archived in project
Development

No branches or pull requests

4 participants