dvwright / xss-mw

XssMw is an middleware designed to "auto remove XSS" from user submitted input, it’s written in Go and targets the Gin web framework.
MIT License
33 stars 12 forks source link

Remove test for multi-part form request #10

Open ghost opened 4 years ago

ghost commented 4 years ago

Hello!

In the line of code referenced you ask if that section of code is needed. I would say no.

https://github.com/dvwright/xss-mw/blob/7a0dab86d8f63202fbeb1023838a538132de1102/xss.go#L376

I am supporting a legacy application which sends data using a multi-part form. When it finishes sending, it sends a final request without any data, just form fields. I don't have access to the source, but I assume it's done in some sort of loop and when it runs out of data to send, it sends a field to indicate that no more data is coming but doesn't change the way it formats the request. This causes the application to fail as it doesn't get the response it expects.

So, I would say that it should be removed, or at least a flag to enable ignoring empty multi-part data.

Thanks!