DataTables / DataTablesSrc

DataTables source repository
https://datatables.net
MIT License
587 stars 422 forks source link

prevent lengthMenu manipulation through the dom #230

Open DrAlghazali opened 1 year ago

DrAlghazali commented 1 year ago

this will add a way to prevent a server hit on large tables if the end user has changed the length value through the dom

lengthMenu

AllanJard commented 1 year ago

Thanks for the PR. I've wondered about this sort of thing before, but never implemented it as it is still trivial to bypass. Just intercepting the XHR request and then modifying the value, or changing the initialisation objects of DataTables. As a result, I'm inclined not to pull this in because it is still easy to bypass, and thus just adds a little extra weight to the code base.

Is this a problem you've run into - people requesting more data than they should? The only "real" fix is to make use that the page length is 10 / 25 / 50 / whatever at the server-side and enforcing it there.

DrAlghazali commented 1 year ago

thank you Allan, yes the server the side is main way to go with this kind of issues. it was meant to make a quick fix for such an issue from the core client side. I already have implemented a server side fix for this on my Editor code