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

Error when handling JSON output during database failures #665

Open
sbldevnet opened this issue Jan 10, 2025 · 2 comments
Open

Error when handling JSON output during database failures #665

sbldevnet opened this issue Jan 10, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@sbldevnet
Copy link
Contributor

Describe the bug
When running a benchmark and selecting json, as output or as an export format, the process fails if the database encounters errors with the following error message:
Error: invalid character ',' looking for beginning of value

No messages related to this error by enabling debug logs.

Powerpipe version (powerpipe -v)
Powerpipe v1.0.1

To reproduce
Execute a benchmark in Powerpipe with json output or export:

powerpipe benchmark run my_benchmark --output=none --export=findings.json

or

powerpipe benchmark run my_benchmark --output=json

Expected behavior
Powerpipe should handle database errors and return a valid output.

Additional context
This issue occurs due to Steampipe returning error messages. Examples of Steampipe errors that can trigger this behavior include:

  • server error: FATAL: the database system is in recovery mode (SQLSTATE 57P03)
  • failed to connect to `user=steampipe database=steampipe`

Using CSV as output I was able to get an output of the powerpipe execution, including the errors, but the format is also broken.

@sbldevnet sbldevnet added the bug Something isn't working label Jan 10, 2025
@pskrbasu
Copy link
Collaborator

Thank you @sbldevnet for raising this. I will take a look and try to get a fix. Do you have reproduction steps that I can run to replicate this situation easily?

@sbldevnet
Copy link
Contributor Author

@pskrbasu I don't have any deterministic steps. I got that behavior by limiting a steampipe container with low CPU and running a benchmark similar to the AWS Foundational Security Best Practices one with 3 AWS connections.

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
None yet
Development

No branches or pull requests

2 participants