Commit Graph
2535 Commits
Author SHA1 Message Date
Vlad Klokun db34183fc1 style: shorten receiver names in JSONPrinter 2022-12-22 15:00:59 +02:00
Vlad Klokun 8f3af71c84 style: shorten receiver names in HTML Printer 2022-12-22 15:00:59 +02:00
Vlad Klokun 116aee0c9c style: shorten receiver names in PrettyPrinter 2022-12-22 15:00:59 +02:00
Vlad Klokun e5d44f741d docs: clarify new meaning of the --format CLI flag 2022-12-22 15:00:59 +02:00
Vlad Klokun f005cb7f80 feat: always print to (T)UI using PrettyPrinter
Prior to this change, `pretty-printer` was a special type of Printer
that wrote output to `Stdout`, unless explicitly asked to write to a
given file. Kubescape used `pretty-printer` as an output format by
default. This behavior created the following inconsistencies:
- When invoked as `kubescape scan`, Kubescape would use `pretty-printer`
  by default, and it would output the scan resluts in the
  `pretty-printer` format to `Stdout`.
- When invoked as `kubescape scan --format=pretty-printer`, the behavior
  would be as above.
- When invoked as `kubescape scan --format=FORMAT`, where `FORMAT` is any
  format except for `pretty-printer`, Kubescape would write the results
  to a sensible default file for the selected format. This is in
  contrast to how `--format=pretty-printer` would still output to
  `os.Stdout`, and not an output file.
- When invoked as `kubescape scan --format=ANY_FORMAT --output=FILENAME`, where
  `ANY_FORMAT` is any format, including `pretty-printer`, Kubescape
  would write the results to the provided `FILENAME` in the given
  `ANY_FORMAT`, and not write any results to `Stdout`.

The aforementioned situation complicates life for users running
Kubescape in CI, where Kubescape would skip writing the results to
`Stdout` and only write to the provided output file.

Moreover, with the addition of support for multiple output formats and,
hence, files, this introduces the following ambiguity:
- When invoked as `kubescape scan --format=json,pdf,pretty-printer
  --output=FILENAME`, should Kubescape treat `pretty-printer` as a
  format for the output file, or just an instruction to also print the
  results to `Stdout`?

To fix these inconsistencies and ambiguities, this commit introduces the
following changes:

- Kubescape will always print results to `Stdout` using the
  PrettyPrinter format.

- The `--format` CLI flag will control the format(s) in which the results
  will be written to one or many *output* files. This breaks the
  previous behavior that running `kubescape scan
  --format=pretty-printer` would not produce an output file, and only
  write to `Stdout`. After this change, the same invocation will still
  write to `Stdout`, but also produce a `report.txt` file in the
  PrettyPrinter format.
2022-12-22 15:00:59 +02:00
Vlad Klokun 9ae9d35ccb style: GetFormatsFormats 2022-12-22 15:00:59 +02:00
Vlad Klokun cb38a4e8a1 style: go fmt the project
- Fixes style inside the project with `go fmt`
2022-12-22 15:00:59 +02:00
Vlad Klokun eb6d39be42 style: shorten receiver names in ResultsHandler 2022-12-22 15:00:59 +02:00
Vlad Klokun 3160d74c42 style: shorten receiver names for Prometheus printer 2022-12-22 15:00:59 +02:00
Vlad Klokun 5076c38482 refactor: tidy up printing to multiple outputs
This change:

- Simplifies printing to multiple outputs.
- Adds a comment on why we keep the Print → Score → Submit order when
  outputting results.
2022-12-22 15:00:59 +02:00
Vlad Klokun 73c55fe253 fix: revert the overriden ScanningTarget when submitting reports
Before this change, we used to override a scan info `ScanningTarget` to
submit a result that is compatible with the backend for Kubescape.
However, previously we forgot to change back to the original value.

When printing scan results, if the correct order of events (Print →
Score → Submit) was not enforced, this broke the SARIF printer so that
it did not output results due to incorrect `basePath` for the results.

This change reverts to the original `ScanningTarget` value after
submitting the results and fixes the SARIF printer.
2022-12-22 15:00:59 +02:00
suhasgumma f48f81c0b5 Add logs for some formats 2022-12-22 15:00:59 +02:00
Suhas GummaandVlad Klokun 81c1c29b7c Update core/pkg/resultshandling/printer/printresults.go
Co-authored-by: Vlad Klokun <vladklokun@users.noreply.github.com>
2022-12-22 15:00:59 +02:00
suhasgumma 874aa38f68 Handle Output Extensions Gracefully 2022-12-22 15:00:59 +02:00
suhasgumma b9caaf5025 Add logs for some formats 2022-12-22 15:00:59 +02:00
suhasgumma 61c120de0e Support getting outputs in multiple formats 2022-12-22 15:00:59 +02:00
kooomix de3408bf57 minor fix 2022-12-22 14:09:27 +02:00
David Wertenteil 8d32032ec1 Merge branch 'cloud-name-breakdown' of github.com:dwertent/kubescape into cloud-name-breakdown 2022-12-22 13:33:23 +02:00
David Wertenteil 42ed787f7b update go mod in httphandler 2022-12-22 13:32:27 +02:00
David Wertenteil ccdba85b3c Merge branch 'dev' into cloud-name-breakdown 2022-12-22 11:57:47 +02:00
David Wertenteil c59f7691dc Breakdown cloud-cluster name 2022-12-22 11:43:45 +02:00
kooomix cf87c2d30b Fixed test 2022-12-21 19:25:22 +02:00
kooomix b547814dec DownloadInfo, PolicyIdentifier add Identity, remove ID and Name 2022-12-21 19:17:29 +02:00
kooomix b476a72e04 Merge branch 'dev' of github.com:kooomix/kubescape into dev 2022-12-21 17:02:24 +02:00
kooomix 4f6f85710a Merge pull request #988 from kooomix/opa_utils-v.0.0.216
opa-utils v0.0.216
2022-12-21 16:06:34 +02:00
kooomix 47c23de160 opa-utils v0.0.216 2022-12-21 15:46:53 +02:00
kooomix bc85844ec0 Merge branch 'kubescape:dev' into dev 2022-12-21 15:31:07 +02:00
kooomix 134d854722 opa-utils v0.0.216 2022-12-21 15:29:58 +02:00
David Wertenteil e3522c19cc Merge pull request #986 from dwertent/master
Cosmetic changes
2022-12-20 10:33:21 +02:00
David Wertenteil 967fc3fe81 ignore resource if it is not found v2.0.392 2022-12-19 19:00:21 +02:00
David Wertenteil 896a0699ec remove image vuln warning 2022-12-18 13:45:43 +02:00
David Wertenteil a53375204e remove --verbose flag from default 2022-12-18 13:44:12 +02:00
David Wertenteil b1392361f8 remove emoji from display 2022-12-18 13:42:58 +02:00
David Wertenteil 7b4fbffae2 Merge pull request #976 from mkilchhofer/explicit_allowPrivilegeEscalation
chore: Explicit set allowPrivilegeEscalation=true
2022-12-18 08:09:35 +02:00
David Wertenteil 34e7b9f2ad Merge pull request #978 from kubescape/maintainers
Update maintainers
2022-12-18 08:08:20 +02:00
David Wertenteil f0080bdeae Merge pull request #979 from craigbox/code-of-conduct
Adopt CNCF Code of Conduct.
2022-12-18 08:07:39 +02:00
Craig Box 0eb27389da Adopt CNCF Code of Conduct.
Signed-off-by: Craig Box <craigb@armosec.io>
2022-12-16 21:46:31 +13:00
craigbox 2c5eed9ee2 Update maintainers
- Add self
- Remove e-mail addresses & job roles
2022-12-16 21:19:02 +13:00
yiscah 87e2986024 start developing port forward to host scanner (doesn't work yet) 2022-12-15 19:03:44 +02:00
David Wertenteil 2c1a5bd032 Merge pull request #977 from kubescape/revert-973-dev
Revert "Excluding controlPlaneInfo from error message in case no data recieved."
2022-12-15 17:48:32 +02:00
David Wertenteil 298f8346e9 validate downloaded framework v2.0.391 2022-12-15 17:13:14 +02:00
kooomix 1897c5a4ba Revert "Excluding controlPlaneInfo from error message in case no data recieved." 2022-12-15 16:17:39 +02:00
Marco Kilchhofer 57e435271e chore: Explicit set allowPrivilegeEscalation=true
The value of allowPrivilegeEscalation followed implicit default of Kubernetes:
> AllowPrivilegeEscalation is true always when the container is:
> 1) run as Privileged
> 2) has CAP_SYS_ADMIN

For users still using PodSecurityPolicy (or a follow-up product like OPA Gatekeeper or
Kyverno), there might be mutating admission controllers which defaults this field to
`false` if unset. A value of `false` would then conflict with `privileged: true`.

Signed-off-by: Marco Kilchhofer <mkilchhofer@users.noreply.github.com>
2022-12-14 22:27:05 +01:00
kooomix 7e9b430347 test fix 2022-12-14 14:22:46 +02:00
kooomix ca5b3e626b test fix 2022-12-14 14:08:32 +02:00
kooomix 3a404f29fa control scan by id 2022-12-14 13:42:52 +02:00
kooomix 16073d6872 download control only by id 2022-12-14 13:06:04 +02:00
Rotem Refael dce563d2f5 Merge pull request #973 from kooomix/dev
Excluding controlPlaneInfo from error message in case no data recieved.
v2.0.390
2022-12-14 11:02:55 +02:00
kooomix 8d556a5b84 minor 2022-12-14 10:48:01 +02:00
kooomix a61063e5b8 revert opa-utils version 2022-12-14 10:45:24 +02:00