CrowdStrike / psfalcon

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

[ BUG ] Regex Expression Sematic Error in Get-FalconAsset #422

Closed dkang-firmus closed 1 week ago

dkang-firmus commented 1 week ago

Describe the bug In Get-FalconAsset -Id <Asset ID>, there is a regex string handler before it is passed to API for data retrieval. The regex expression is ^[a-fA-F0-9]{32}_\w+$. Whilst some Asset ID coming from Active Directory provider may not match this regex formula. I will give an example here: 0b<CID-REDACTED>dd_ATDufiR7TJI4MGwW4ipsTCV2UXvNC3fiTjBPadcJ-l3l4A ^ Notice there is a hyphen '-' in the near-end of the string. Once run with the PS command it will return with error code saying Asset ID doesn't match the regex ^[a-fA-F0-9]{32}_\w+$.

0b<CID-REDACTED>dd_ATDqgLNM4lEx3__TXQ4fNiKbpptkdVDXQQ_J2YuyPHQugQ ^ This one doesn't have a hyphen thus the PS command will work.

To Reproduce Run the following command, replace with a valid asset ID. The asset ID must have a hyphen in it to trigger the bug: Get-FalconAsset -Id <Asset ID>

Expected behavior The regex notation should be ^[a-fA-F0-9]{32}_[\w\-]+$ instead to also capture hyphen character in the asset ID.

Environment (please complete the following information):

Additional context

Transcript content

bk-cs commented 1 week ago

This was fixed in the v2.2.7 release of PSFalcon. Please uninstall your module and install the latest version:

Uninstall-Module -Name PSFalcon -AllVersions
Install-Module -Name PSFalcon -Scope CurrentUser