CrowdStrike / psfalcon

PowerShell for CrowdStrike's OAuth2 APIs
The Unlicense
362 stars 67 forks source link

[ BUG ] Get-Falconhost with InstanceID Filter Gives Error #153

Closed oracle701 closed 2 years ago

oracle701 commented 2 years ago

Describe the bug Running the Get-Falconhost filter based on the instance_id gives the error "Get-FalconHost: Cannot validate argument on parameter 'Filter'. 'instance_id' is not a valid property." I tried on the latest version of the module, but same issue.

To Reproduce Run the command [Get-FalconHost -Filter "instance_id:''"]

Expected behavior Under hosts and Host Groups, it list that Get-Falconhost can filter based on the instance_id.

Environment (please complete the following information):

bk-cs commented 2 years ago

Thank you for the report!

In v2.1.5, I added a new function that is meant to validate FQL queries to provide errors in cases where a user attempts to build a -Filter that is going to rejected by the API, because I found several cases where the APIs did not provide explicit error messages.

I used the Falcon Host and Host Group Management API to build out the list of accepted properties, which doesn't contain instance_id.

After testing, I verified that instance_id is an accepted property for both filter and sort.

Please replace Public\devices.ps1 in your local module with the contents of this file: https://raw.githubusercontent.com/CrowdStrike/psfalcon/master/Public/devices.ps1

Once complete, instance_id will be no longer produce the not a valid property error. This change will be included with the v2.1.7 release.

oracle701 commented 2 years ago

I updated that file and I can now run that command with no errors. Thank you very much! I can complete the project I am working on now :-).

bk-cs commented 2 years ago

Thanks for the confirmation! I'm going to leave the issue open in case other users run into the same issue before the v2.1.7 release.

bk-cs commented 2 years ago

Closing due to v2.1.7 release.