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

only_associated qualifier in inspector2_member table is not correctly evaluated #2387

Open
sbldevnet opened this issue Jan 29, 2025 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@sbldevnet
Copy link

Describe the bug
The only_associated attribute in the inspector2_member table does not properly check the value of the qualifier. Instead, it retrieves the type of the qualifier but does not verify the actual value. This results in input.OnlyAssociated always being set to true, regardless of the provided input.

https://github.com/turbot/steampipe-plugin-aws/blob/main/aws/table_aws_inspector2_member.go#L110C1-L117C3

Since getQualsValueByColumn function retrieves the type but does not extract the actual value, the logic does not work as intended.

Steampipe version (steampipe -v)
v1.0.2

Plugin version (steampipe plugin list)
v1.5.0

To reproduce

  1. Run a query with only_associated = 'false'. E.g:
select
  member_account_id, region,
  delegated_admin_account_id,
  relationship_status,
  updated_at
from
  aws_inspector2_member
where
 only_associated = 'false'
  1. The result still filters members as if only_associated = true.

Expected behavior
The only_associated qualifier should correctly determine whether to list only associated members (true) or all members (false). The logic should properly extract and evaluate the actual value of only_associated instead of relying on its type.

Additional context

@sbldevnet sbldevnet added the bug Something isn't working label Jan 29, 2025
@sbldevnet
Copy link
Author

I'd be happy to create a PR to fix this issue, but I have a question before proceeding.

Why is the only_associated value defined as a string instead of a boolean in the table definition? If it were a boolean, it would be easier to use and avoid unnecessary conversions. However, changing it now might be a breaking change.
If keeping it as a string is necessary, I could fix the issue by directly comparing the value of only_associated instead of checking the operator type.

@ParthaI ParthaI self-assigned this Jan 29, 2025
@ParthaI
Copy link
Contributor

ParthaI commented Feb 10, 2025

Hello @sbldevnet,

Apologies for the delayed response. The table uses the ListMembers API, which does not include the only_associated value in its response. Instead, we were populating this column based on the value provided in the query parameter.

It looks like we missed updating the column data type during table development. I agree that the correct approach would be to change the column type to boolean, even though it would introduce a breaking change.

Thanks for catching this! We appreciate your input.

@ParthaI ParthaI assigned sbldevnet and unassigned ParthaI Feb 20, 2025
@sbldevnet
Copy link
Author

Hi @ParthaI I'm having some problems trying to make it work as expected.
After updating the column type to proto.ColumnType_BOOL, if the value is false, then d.EqualsQuals["only_associated"] value is nil instead of false. If the value is true then it receives it.

The default behavior of this API call if the value is not specified is the same as is specified as true, so it's important to pass it explicitly when the value is false.

Any thoughts on why it doesn't get the false boolean value?

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