mondoohq / cnspec

An open source, cloud-native security to protect everything from build to runtime
https://cnspec.io
Other
272 stars 13 forks source link

12 `InvalidArgument` errors running `platform {*}` on macOS #416

Open tas50 opened 1 year ago

tas50 commented 1 year ago

Describe the bug On macOS where we don't analyze package data we throw a very large number of errors when getting platform data. We shouldn't be throwing this 12 times for the user when it's an expected issue on macOS.

To Reproduce Steps to reproduce the behavior:

  1. run cnspec shell
  2. run `platform {*}
  3. See error

Expected behavior Warnings in the sections of the data structure that we can't fix

Screenshots or CLI Output

 ~/dev  cnspec shell
→ no provider specified, defaulting to local.
  Use --help for a list of available providers.
→ loaded configuration from /Users/tsmith/.config/mondoo/mondoo.yml using source default
→ discover related assets for 1 asset(s)
→ resolved assets resolved-assets=1
  ___ _ __  ___ _ __   ___  ___
 / __| '_ \/ __| '_ \ / _ \/ __|
| (__| | | \__ \ |_) |  __/ (__
 \___|_| |_|___/ .__/ \___|\___|
   mondoo™     |_|
cnspec> platform {*}
Query encountered errors:
12 errors occurred:
    * rpc error: code = InvalidArgument desc = package analysis is not supported for the provided platform
    * rpc error: code = InvalidArgument desc = package analysis is not supported for the provided platform
    * rpc error: code = InvalidArgument desc = package analysis is not supported for the provided platform
    * rpc error: code = InvalidArgument desc = package analysis is not supported for the provided platform
    * rpc error: code = InvalidArgument desc = package analysis is not supported for the provided platform
    * rpc error: code = InvalidArgument desc = package analysis is not supported for the provided platform
    * rpc error: code = InvalidArgument desc = package analysis is not supported for the provided platform
    * rpc error: code = InvalidArgument desc = package analysis is not supported for the provided platform
    * rpc error: code = InvalidArgument desc = package analysis is not supported for the provided platform
    * rpc error: code = InvalidArgument desc = package analysis is not supported for the provided platform
    * rpc error: code = InvalidArgument desc = package analysis is not supported for the provided platform
    * rpc error: code = InvalidArgument desc = package analysis is not supported for the provided platform
platform: {
  arch: "arm64"
  kind: "baremetal"
  virtualization: platform.virtualization id = platform.virtualization
  name: "macos"
  labels: {}
  fqdn: ""
  platform.cves.list: rpc error: code = InvalidArgument desc = package analysis is not supported for the provided platform
  runtime: ""
  vulnerabilityReport: rpc error: code = InvalidArgument desc = package analysis is not supported for the provided platform
  build: "22D68"
  title: "macOS, bare metal"
  platform.advisories.list: rpc error: code = InvalidArgument desc = package analysis is not supported for the provided platform
  family: [
    0: "darwin"
    1: "bsd"
    2: "unix"
    3: "os"
  ]
  version: "13.2.1"
  runtimeEnv: ""
  release: "13.2.1"
}
cnspec>

Desktop (please complete the following information):

tas50 commented 1 year ago

The errors printed ahead of data seem to be 4x the actual error in the data. Running os.base shows 4 errors for the single os.base.rebootpending value that can't be returned