semaphore
semaphore copied to clipboard
Fix code scanning alert no. 8: Database query built from user-controlled sources
Fixes https://github.com/semaphoreui/semaphore/security/code-scanning/8
To fix the problem, we need to ensure that user-controlled values are safely embedded into the SQL query. This can be achieved by using parameterized queries or prepared statements. Specifically, we should avoid directly concatenating the orderColumn and orderDirection into the query string. Instead, we can use the squirrel library's methods to safely construct the query.
- Modify the
getObjectsByReferrerfunction to use parameterized queries for theORDER BYclause. - Ensure that the
orderColumnandorderDirectionvalues are safely embedded into the query using thesquirrel.Exprmethod.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.