falconpy icon indicating copy to clipboard operation
falconpy copied to clipboard

[ BUG ] Large file uploads using UploadSampleV3 fail depending on syntax used

Open jshcodes opened this issue 9 months ago • 0 comments

Describe the bug The Service Class method handler for the UploadSampleV3 operation can fail when uploading files of ~ 10mb or larger. A 414 error (Request-URI Too Large) is generated.

[!NOTE] This issue only impacts developers using the Service Class method for this operation.

Failure response
{
    "status_code": 414,
    "headers": {
        "Server": "nginx",
        "Date": "Thu, 16 May 2024 14:06:39 GMT",
        "Content-Type": "application/json",
        "Content-Length": "118",
        "Connection": "close",
        "Strict-Transport-Security": "max-age=31536000; includeSubDomains"
    },
    "body": {
        "meta": {
            "powered_by": "crowdstrike-api-gateway-nginx"
        },
        "errors": [
            {
                "code": 414,
                "message": "414: Request-URI Too Large"
            }
        ]
    }
}

This is caused by the conversion handler for formData payloads falling back to leverage the query string unnecessarily.

To Reproduce

  • Construct an instance of the Sample Uploads Service Class.
  • Attempt to upload a file larger than 10mb using the UploadSampleV3 API operation (upload_sample method).
    • Make sure to leverage keywords to provide the necessary method arguments.

Expected behavior The conversion of keyword arguments crafts a properly constructed formData payload, not a query string payload, and does not exceed the maximum URI length.

Environment (please complete the following information):

  • OS: All supported
  • Python: All supported
  • FalconPy: <= v1.4.3

Additional context Thanks go out to @Destom for reporting this issue! 🙇

jshcodes avatar May 16 '24 14:05 jshcodes