turbot / steampipe-plugin-wiz

Use SQL to instantly query Wiz resources. Open source CLI. No DB required.
https://hub.steampipe.io/plugins/turbot/wiz
Apache License 2.0
3 stars 1 forks source link

Wiz queries return decoding error: "invalid character '<'" #12

Closed bretlowery closed 9 months ago

bretlowery commented 1 year ago

Describe the bug Wiz queries return: Error: decoding response: invalid character '<' looking for beginning of value (SQLSTATE HV000)

Steampipe version (steampipe -v) Steampipe v0.21.1

To reproduce

  1. Install steampipe
  2. Add Wiz plugin (Latest v downloaded 10/16/2023)
  3. Configure Wiz credentials for Steampipe
  4. Run any query
    
    > select
    id,
    status,
    severity,
    created_at
    from
    wiz_issue
    where
    severity = 'CRITICAL';

Error: decoding response: invalid character '<' looking for beginning of value (SQLSTATE HV000)



**Expected behavior**
Results are returned

**Additional context**
Brand-new Steampipe install; verified Wiz credentials via Postman
bretlowery commented 1 year ago

I suspect the Wiz API is returning an error that Steampipe is unable to handle.

bretlowery commented 1 year ago

Found it: if the Wiz API endpoint is set to the wrong tenant endpoint (e.g. by specifying the wrong two-digit value in the XX in https://api.usXX.app.wiz.io/graphql) this is returned. Is there any way to make that a more user-friendly error message?

misraved commented 1 year ago

Welcome to Steampipe @bretlowery and thank you so much for creating the issue with such great details 👍.

The API does return a very weird message, do we only get it if we specify the wrong two-digit values in the XX in https://api.usxx.app.wiz.io/graphql)? Are there more scenarios where we are likely to receive this error?

bretlowery commented 1 year ago

If it’s failing in the angle bracket, quite possibly, but not sure of specifics.

github-actions[bot] commented 10 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

misraved commented 9 months ago

Apologies for the radio silence on this issue @bretlowery !!

As you mentioned, the error is returned by the Wiz API without any clear instructions on what failed. When I tamper the url config argument, I get the following error -

select
  id,
  status,
  severity,
  created_at
from
  wiz_issue
where
  severity = 'CRITICAL';

Error: wiz: failed to parse token response: invalid character 'U' looking for beginning of value (SQLSTATE HV000)

+----+--------+----------+------------+
| id | status | severity | created_at |
+----+--------+----------+------------+
+----+--------+----------+------------+