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

cnspec exits when too much args are specified #171

Closed
czunker opened this issue Nov 8, 2022 · 2 comments
Closed

cnspec exits when too much args are specified #171

czunker opened this issue Nov 8, 2022 · 2 comments

Comments

@czunker
Copy link
Contributor

czunker commented Nov 8, 2022

Describe the bug
When we call cnspec from inside a GitHub action, the action might add an empty arg to the command, e.g.:

/usr/bin/docker run ... mondoo/cnspec  "scan" "docker" "image" "mondoo-test:0.1.0" "--output" "compact" "--score-threshold" "0" "--log-level" "debug" ""

This results in an error:

...
Status: Downloaded newer image for mondoo/cnspec:latest
Error: accepts 1 arg(s), received 2
Usage:
...

This happens, because the action allows the user to specify additional args/parameters:
https://github.com/mondoohq/actions/pull/40/files#diff-d39e3d8374eded08ccdff5f7a8615006dd4d646d94f4eea996e30dca97790669R42

But, when nothing is specified it results in an empty arg "".

To Reproduce
Steps to reproduce the behavior:

  1. Re-run the job linked below
  2. Wait
  3. See error

Expected behavior
cnspec should ignore the empty arg.

Additional context

Failed action job: https://github.com/mondoohq/actions/actions/runs/3419398794/jobs/5692869897

Looks similar to this one: actions/runner#924

czunker added a commit to mondoohq/cnquery that referenced this issue Nov 8, 2022
Fixes mondoohq/cnspec#171

Signed-off-by: Christian Zunker <[email protected]>
@czunker
Copy link
Contributor Author

czunker commented Nov 8, 2022

The fix mondoohq/cnquery#453 would be needed for each action command.

The other option would be to remove the optional args from the GitHub action.

@scottford-io / @chris-rock Opinions?

@chris-rock
Copy link
Member

That is a problem that needs to be fixed in the GitHub action. This would add a wrong behaviour to cnquery / cnspec

czunker added a commit to mondoohq/actions that referenced this issue Nov 9, 2022
Fixes mondoohq/cnspec#171

Signed-off-by: Christian Zunker <[email protected]>
@czunker czunker closed this as completed Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants