If apostrophes or other reserved characters are a problem, then the software was written incorrectly and insecurely, and the developers should be held liable to fix it.
What they are doing wrong is building a SQL query bit by bit, adding user data and fixed command language together into a single “string” that they submit to the SQL engine for interpretation and execution. This is 100% always wrong.
The way to deal with user data safely and securely is to use what is called “parametric SQL”. The developer needs to construct the SQL query statement using tokens to mark where the user data is to be inserted, and not inserting the user’s raw data. The call to SQL then supplies the query string, and a list of parameters containing the user data that the engine will safely insert into the database. The user data must never be interpreted by the SQL parser.
If they were using parameterized calls, they never would have noticed a problem with apostrophes, quotes, semicolons, or other SQL query reserved characters.
Nothing I wrote is new. It’s literally the first lesson taught in Secure Software Development 101; and SQL injection is the first attack taught in ethical hacking courses. It’s been known since the dawn of databases, yet SQL injection attacks are still the #1 vulnerability on the OWASP Top 10 list, and have been since the list was first compiled decades ago. That it’s still #1 is 100% the fault of inadequately trained developers, code reviewers, and organizations that don’t make security a priority. Developers have a responsibility to be better than this, as do the organizations that provide software.
I have no mercy for anyone who deploys crap code that allows for injection attacks. Not in this era of ransomware and cyber attacks. You can make mistakes while learning, either in school or on the job, but you better never deliver something so vulnerable.
EDIT:
I just saw CVE-2024-1597, in which the PostgresSQL JDBC driver, pgjdbc, will convert your nice, safe parameterized SQL statement into a vulnerable, injectable query if you use PreferQueryMode=SIMPLE
.