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

Return codes inconsistent with scan results #580

Open
huornlmj opened this issue Jan 19, 2024 · 2 comments
Open

Return codes inconsistent with scan results #580

huornlmj opened this issue Jan 19, 2024 · 2 comments
Labels
Projects

Comments

@huornlmj
Copy link

Describe the bug
If I run kubesec scan score-1-pod-automount-sa-set-to-false.yml, kubesec reports "message": "Passed with a score of 1 points", and if I check kubesec's exit code I get a '0':

$ echo $?
0

However, if I run a scan against a manifest that scores 0, kubesec also reports it as a pass: "message": "Passed with a score of 0 points", but the exit code is now '2':

$ echo $?
2

A fail with a negative score value in Kubsec ("message": "Failed with a score of -4 points") also yields an exit code of '2':

$ echo $?
2

Expected behaviour
If Kubsec reports a "Passed" message then the exit code should be consistent between a pass of 0 and any other positive integer pass.

Screenshots
If applicable, add screenshots to help explain your problem.

Other information

$ kubesec version
version 2.14.0
git commit edd68f6ffde5651c1c1460a8b6d83c7f62e4f5aa
build date 2023-11-21T15:48:03Z
@huornlmj huornlmj added the bug label Jan 19, 2024
@controlplane-bot controlplane-bot added this to To Do in Kubesec Jan 19, 2024
@06kellyjac
Copy link
Member

thanks for raising this

We'll likely have a score of 0 pass properly with an exit with code 0, rather than change 0 to be a fail.

I'll double check how kubesec has behaved in the past.

@06kellyjac
Copy link
Member

image

I've not bothered with before 2.2.0 because it's using gopkg rather than go modules but this is a long-standing issue

I'll check changing the exit code of a score 0 to exit 0 is ok

@06kellyjac 06kellyjac moved this from To Do to In Progress in Kubesec Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Kubesec
  
In Progress
Development

No branches or pull requests

2 participants