fix: care non-null terminated chunk data #2097
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I encountered a broken JSON audit log when used sanitizeArg on the body.
{"transaction":{"time":"17/May/2019:03:58:01 +0000","transaction_id":"AcVcAcAcAcAcAzAcAcWQ4cAc","remote_address":"172.17.0.1","remote_port":37868,"local_address":"127.0.0.1","local_port":80},"request":{"request_line":"POST / HTTP/1.1","headers":{"Host":"test.modsec.com","User-Agent":"curl/7.54.0","Accept":"*/*","Content-Type":"application/json","Content-Length":"41"},"body":["{\"password\":\"****\",\"user_id\":\"../../../\"}f�#IV"]},"response":{"protocol":"HTTP/1.1","status":405,"headers":{"Content-Type":"text/html","Content-Length":"173","Connection":"keep-alive"},"body":"<html>\r\n<head><title>405 Not Allowed</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>405 Not Allowed</h1></center>\r\n<hr><center>nginx/1.15.0</center>\r\n</body>\r\n</html>\r\n"},"audit_data":{"messages":["Warning. Unconditional match in SecAction. [file \"/etc/nginx/modsecurity.d/rules/modsecurity.conf\"] [line \"265\"] [id \"101\"]"],"handler":"IIS","stopwatch":{"p1":45,"p2":78,"p3":1,"p4":0,"p5":2,"sr":0,"sw":0,"l":0,"gc":0},"response_body_dechunked":true,"producer":"ModSecurity for nginx (STABLE)/2.9.3 (http://www.modsecurity.org/)","server":"ModSecurity Standalone","sanitized":{"args":["password"]},"engine_mode":"ENABLED"}}I fixed this problem.