CrowdStrike / falconpy

The CrowdStrike Falcon SDK for Python
https://www.falconpy.io
The Unlicense
353 stars 113 forks source link

[ BUG ] FalconContainer output is not fully in JSON format #1207

Open golnaraghi opened 1 month ago

golnaraghi commented 1 month ago

Describe the bug Hi, We have been experimenting with FalconContainer, and wrote a simple code like the one below. The documentation mentions the content type is JSON. However, the output does not seem to be fully in JSON format. I was wondering what can be done about this, or if there is something we can do on our end. Thank you!

To Reproduce Sample code:

#!/usr/bin/env python3
from falconpy import FalconContainer
import sys
CLIENT_ID=sys.argv[1]
CLIENT_SECRET=sys.argv[2]
Image_ID=sys.argv[3]
Image_Digest=sys.argv[4]
falcon = FalconContainer(client_id=CLIENT_ID,
                         client_secret=CLIENT_SECRET
                         )
response = falcon.GetImageAssessmentReport(image_id=Image_ID, digest=Image_Digest)
print(response)

Expected behavior Get an output in JSON format.

Environment (please complete the following information):

jshcodes commented 1 month ago

Hi @golnaraghi -

Can you show us an example of the invalid JSON output (sanitize any sensitive detail please)?

Currently, we're unable to recreate this issue. When we run the code above locally within our test environment we are receiving valid JSON responses.

Note: If you want cleaner terminal output, you can run the dictionary response through json.dumps.

#!/usr/bin/env python3
from falconpy import FalconContainer
import sys
import json
CLIENT_ID=sys.argv[1]
CLIENT_SECRET=sys.argv[2]
Image_ID=sys.argv[3]
Image_Digest=sys.argv[4]
falcon = FalconContainer(client_id=CLIENT_ID,
                         client_secret=CLIENT_SECRET
                         )
response = falcon.GetImageAssessmentReport(image_id=Image_ID, digest=Image_Digest)
print(json.dumps(response, indent=4))