CrowdStrike / psfalcon

PowerShell for CrowdStrike's OAuth2 APIs
The Unlicense
350 stars 66 forks source link

[ BUG ] `400: The ids parameter must be present...` error when using Turkish display language #370

Closed bk-cs closed 1 week ago

bk-cs commented 9 months ago

Describe the bug When using Turkish as your default display language, the following error is produced when using various PSFalcon commands: {"code":400,"message":"The \u0027ids\u0027 parameter must be present at least once."}

To Reproduce Install the Turkish language pack, set it as default, and attempt to use PSFalcon commands like Add-FalconSensorTag, Get-FalconHost -Detailed, etc.

Environment (please complete the following information):

bk-cs commented 9 months ago

The initial bug report for this issue was specifically related to the Add-FalconSensorTag command, but after some testing I was able to reproduce it with any command that took identifier values and submitted them as part of a Json body.

The issue is due to how Turkish represents an uppercase i and that regex matching in PowerShell is not case insensitive by default when using Turkish (or possibly any language other than English). PSFalcon uses a private function called Build-Content to convert a user's input into a properly formatted Json body, which basically works like this:

This failed in Turkish because ids would never match Ids (but does in English). The simplest fix seems to be to update all of the commands to use a lowercase alias when switching Id, to convert it to ids (rather than the current Ids), which will behave as expected. The fix will be included in the next release.

bk-cs commented 1 week ago

This fix is included in the 2.2.7 release.