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. 15: Reflected cross-site scripting #466

Merged
merged 4 commits into from
Nov 23, 2024

Conversation

dgkanatsios
Copy link
Collaborator

Fixes https://github.com/PlayFab/thundernetes/security/code-scanning/15

To fix the reflected cross-site scripting vulnerability, we need to sanitize the user-controlled data before including it in the HTTP response. The best way to do this in Go is to use the html.EscapeString function from the html package, which escapes special characters in a string to their corresponding HTML entities.

We will update the notFoundError function in pkg/operator/controllers/allocation_utils.go to escape the msg parameter before including it in the response. Additionally, we will ensure that other error-handling functions (internalServerError, badRequestError, tooManyRequestsError) also escape their msg parameters to prevent similar vulnerabilities.

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

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@dgkanatsios dgkanatsios marked this pull request as ready for review November 23, 2024 01:03
@dgkanatsios dgkanatsios merged commit 67328bd into main Nov 23, 2024
6 of 7 checks passed
@dgkanatsios dgkanatsios deleted the alert-autofix-15 branch November 23, 2024 01:31
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