mentat-is / gulp

g(ULP) - graphical universal log processor
https://gulp.sh
Other
20 stars 3 forks source link

[500] Internal Server Error on Ingestion When `user_id` is Missing #36

Closed Mireg-V closed 1 month ago

Mireg-V commented 1 month ago

Description:

When making a PUT request to ingest a file without providing a user_id, the server returns a 500 Internal Server Error. The error occurs during the validation process for the client_id.

Request:

PUT /ingest_file?plugin=win_evtx.py&operation_id=1&context=cxz&client_id=-1&ws_id=9cb2a559-395d-4c55-ad1c-aa2aedbd7d1d&index=testidx
HTTP/1.1 Accept: / Accept-Encoding: gzip, deflate, br, zstd
Accept-Language: -------------------------
Connection: keep-alive 
Content-Length: 69960 
Content-Type: multipart/form-data; boundary=vw9358tanknxrvlq47ecng 
Host: localhost:8080 
Origin: http://localhost:3000/ 
Referer: http://localhost:3000/ 
Sec-Fetch-Dest: empty 
Sec-Fetch-Mode: cors 
Sec-Fetch-Site: same-site 
User-Agent: ------------------------- 
continue_offset: 0 
sec-ch-ua: ------------------------- sec
-ch-ua-mobile: ?0 
sec-ch-ua-platform: "Windows" 
size: 69632 
token: 1addd5b2-41ff-4e7c-8161-cfffc59a2d95

Response:

"req_id": "72438b43-51d6-4199-ab53-8a9e42429cea",
"timestamp_msec": 1728309163900,
"data": {
    "exception": {
        "name": "ObjectNotFound",
        "msg": "no clients found",
        "trace": "Traceback (most recent call last):\n  File \"/home/mireg/repos/gulp/.venv/lib/python3.12/site-packages/gulp/api/rest/ingest.py\", line 79, in _check_parameters\n    c = await Client.get(\n        ^^^^^^^^^^^^^^^^^\n  File \"/home/mireg/repos/gulp/.venv/lib/python3.12/site-packages/gulp/api/collab/client.py\", line 205, in get\n    raise ObjectNotFound(\"no clients found\")\ngulp.defs.ObjectNotFound: no clients found\n"
    }
}
valerino commented 1 month ago

PUT /ingest_file?plugin=win_evtx.py&operation_id=1&context=cxz&client_id=-1

"client_id": -1 do not exist obviously (indexes start at 1, where 1 is the default one created by gulp when index do not exist). "user_id" is not among the requested parameters.

check https://github.com/rcskunkworks/gulpclient-dotnet/blob/develop/api/ClientIngest.cs#L12 to implement ingestion.