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

Top level output config should only affect grype root command #2025

Open
willmurphyscode opened this issue Aug 1, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@willmurphyscode
Copy link
Contributor

What happened:

If output: [json] (or any other list, including an empty list) is present in the config file, grype db list fails with an error.

What you expected to happen:

Not to fail with an error.

How to reproduce it (as minimally and precisely as possible):

cd $(mktemp -d)
echo 'output: [json]' >> .grype.yaml
grype apline:latest
grype db list

You'll see that grype alpine:latest works correctly and prints JSON to stdout, but grype db list fails in the following way:

$ grype db list
invalid application config: 1 error(s) decoding:

* 'output' expected type 'string', got unconvertible type '[]interface {}', value: '[json]'

Anything else we need to know?:

Environment:

  • Output of grype version:
Application:         grype
Version:             0.79.4
BuildDate:           2024-07-31T15:05:32Z
GitCommit:           brew
GitDescription:      [not provided]
Platform:            darwin/arm64
GoVersion:           go1.22.5
Compiler:            gc
Syft Version:        v1.10.0
Supported DB Schema: 5
  • OS (e.g: cat /etc/os-release or similar): M1 macbook
@willmurphyscode willmurphyscode added the bug Something isn't working label Aug 1, 2024
@willmurphyscode willmurphyscode moved this to Ready in OSS Aug 1, 2024
@willmurphyscode
Copy link
Contributor Author

I think what we plan to do here is demote the output of grype db list to be under db, so you'd have like:

db:
    list-output: json
...

or something. It's important that the behavior of the top level output key remain unchanged. In other words, break the config relative to the minor commands db list and not the main command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Ready
Development

No branches or pull requests

1 participant