3 ms·
A few years back, I wanted to refactor something in the quite large codebase I was working on at the time. I stumbled on a class that was very short and simple
by ThePadawan 5y ago
A few years back, I wanted to refactor something in the quite large codebase I was working on at the time.
I stumbled on a class that was very short and simple. If you know enterprise code, that should immediately make alarm bells ring.
And yes, indeed, all this code did was provide a (world-visible) API endpoint which returned the result of "SELECT id FROM <table with millions of rows>" as a JSON array of numbers.
IIRC it was used for something theoretically reasonable like "figure out if this search index contains all rows from that table".
But I'm sure there were less hacky ways to achieve the same result. Maybe even put permissions or firewalls on it.
- politelemon 5y agoAlong similar lines, I once found a very simple class. It was an endpoint which executed a stored procedure. The name of the stored procedure was passed in as a query string parameter. There was no validation being done. It also ran system stored procedures; if you're not familiar with that, think admin and housekeeping type functions on the database. We couldn't immediately disable or firewall it as it had embedded its roots deep, and a lot of things calling it didn't know they were calling it.