Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code scanning alert no. 9: Database query built from user-controlled sources #589

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

adubovikov
Copy link
Member

Fixes https://github.com/sipcapture/homer-app/security/code-scanning/9

To fix the problem, we should ensure that user-provided values are safely embedded into the SQL query using parameterized queries. GORM already provides a way to safely handle user input by using maps in the Where method. However, we should explicitly use parameterized queries to ensure that the values are properly escaped.

We will modify the Get, Delete, and Update methods in the UserSettingsService to use parameterized queries with named placeholders. This will ensure that the user-provided values are safely embedded into the SQL query.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…led sources

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@adubovikov adubovikov marked this pull request as ready for review January 7, 2025 11:58
@adubovikov adubovikov merged commit 522f234 into master Jan 7, 2025
5 checks passed
@adubovikov adubovikov deleted the alert-autofix-9 branch January 7, 2025 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant