Create github action for flagging sql-related commits #5338
Replies: 2 comments
-
At the moment, SQL code is spread out through the codebase in a really messy fashion. In some places, we construct SQL query strings using interpolation, and I'm pretty sure SQL injection (i.e. unsafe interpolation of user-controlled values into our queries) is possible somewhere. I don't think there is going to be a reasonably comprehensive way to catch every SQL-related piece of code to alert changes to, not until a major upheaval of the database implementation. |
Beta Was this translation helpful? Give feedback.
-
Adding onto this, security is one of my areas. SQL injections are a problem if the database itself being manipulated by another party is a problem. With beets, this isn't technically a security problem without other bugs in the SQL system. The worst case from an injection would be inserting or deleting records; in essence, corrupting the database. Bad but not technically a security issue unless you consider, possibly, the details of your music library to be a secret worth protecting. There are also linters and tools which detect and manage SQL best practices in Python code specifically. We could definitely either enable those with our current linters or add them to the CI. |
Beta Was this translation helpful? Give feedback.
-
SQL feels more fragile/risky to me than most computer code in beets. Maybe this is superstition but SQL involves:
So I think we should do 2 things:
Detecting a sql change
There may be an off the shelf action for this. If not, just flag "SQL" (case insensitive) in a line of code that changed. Doesn't have to be perfect, just one round of defense.
Beta Was this translation helpful? Give feedback.
All reactions