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

[ BUG ] Get-FalconHorizonIom and Get-FalconHorizonIoa - Cannot convert JSON because of duplicated keys #309

Open
guy-user opened this issue May 10, 2023 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@guy-user
Copy link

guy-user commented May 10, 2023

Describe the bug
When I run Get-FalconHorizonIom -All -Detailed, the following error is produced. The same behavior occurs when using Get-FalconHorizonIoa, but the affected fields may be different.

Invoke-Falcon : Cannot convert the JSON string because a dictionary that was converted from the string contains the duplicated keys 'Name' and 'name'.
At C:\Users\XXX\Documents\WindowsPowerShell\Modules\psfalcon\2.2.5\public\detects.ps1:301 char:9
+         Invoke-Falcon @Param -Inputs $PSBoundParameters
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Invoke-Falcon], InvalidOperationException
    + FullyQualifiedErrorId : DuplicateKeysInJsonString,Invoke-Falcon

Environment (please complete the following information):
OS Name: Microsoft Windows Server 2016 Standard
OS Version: 10.0.14393 N/A Build 14393

PowerShell: 5.1.14393.5582
PSFalcon: 2.2.5
PowerShell_transcript.YYY.aVhUzt8n.20230510224339.txt

@guy-user guy-user added the bug Something isn't working label May 10, 2023
@bk-cs bk-cs changed the title [ BUG ] Get-FalconHorizonIom - Cannot convert the JSON string because a dictionary that was converted from the string contains the duplicated keys 'Name' and 'name'. [ BUG ] Get-FalconHorizonIom and Get-FalconHorizonIoa - Cannot convert JSON because of duplicated keys May 10, 2023
@bk-cs
Copy link
Collaborator

bk-cs commented May 10, 2023

Thanks for the report, and I'm sorry for the trouble this has caused. This error is caused by the results returned from the APIs below, and it's not strictly a PSFalcon problem.

GET /detects/entities/iom/v2
GET /detects/entities/ioa/v1

Some of the individual results are returning with varying case, which causes an error when PowerShell attempts to convert the result from JSON to an object. The API shouldn't be doing this, so I'm going to investigate this within CrowdStrike. Additionally, I'll investigate whether there's a way to correct the problem using PSFalcon.

@guy-user
Copy link
Author

guy-user commented May 11, 2023 via email

@bk-cs
Copy link
Collaborator

bk-cs commented Jul 18, 2023

Thanks for your patience as I worked with internal teams to resolve this issue. We believe this is fixed and you should have been asked to re-test. Please let me know if this is still a problem.

@guy-user
Copy link
Author

Unfortunately I am still seeing the same errors originally reported for both IOA and IOM:

IOA: Cannot convert the JSON string because a dictionary that was converted from the string contains the duplicated keys 'Tagging' and 'tagging'.

IOM: Cannot convert the JSON string because a dictionary that was converted from the string contains the duplicated keys 'Name' and 'name'.

@bk-cs
Copy link
Collaborator

bk-cs commented Jul 26, 2023

After doing some investigating with CrowdStrike support and the development team, the core issue seems to be that the data we're receiving with varying case is coming directly from the cloud provider (AWS in this case). CrowdStrike isn't in control of the case provided in the results, because it's passing the data through.

PowerShell Core includes the ability to -ConvertAsHashtable when using ConvertFrom-Json which supposedly would resolve this, but PSFalcon also supports PowerShell Desktop--meaning that fix can't be used. I'll either need to redesign how PSFalcon converts Json results using some other method, or do some sort of string search to find and replace these results when they occur.

@guy-user
Copy link
Author

Let me know if you have a beta version I can try out 👍

@guy-user guy-user reopened this Jul 27, 2023
@guy-user
Copy link
Author

guy-user commented Aug 3, 2023

Hi there - do you have any sort of indication on how long a fix might take? Just want to have a feel how much longer we may be impacted on this one so I can report to mgmt.

I realise anything you can indicate here is not a commitment or guarantee of any sort.

@bk-cs
Copy link
Collaborator

bk-cs commented Aug 7, 2023

Unfortunately, no. PSFalcon uses ConvertTo-Json which is unable to deal with this varying case. There's only one other way that I've seen that will convert from Json, and I tried using it early in PSFalcon development but found it unreliable.

Between regular PSFalcon updates/fixes and my preparation for Fal.Con in September, I'm not sure when this will be complete.

@bk-cs
Copy link
Collaborator

bk-cs commented Nov 22, 2023

I still have this on my to-do list if I can figure out a way to solve it...

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