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. 5: Incomplete URL substring sanitization #33

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

SugarD-x
Copy link
Collaborator

Fixes https://github.com/Asshat-Gaming/DummyBot/security/code-scanning/5

To fix the problem, we need to parse the URL and validate the host against a whitelist of allowed hosts. This ensures that the URL is genuinely from SoundCloud and not a malicious URL containing "soundcloud.com" in an unexpected location.

  1. Parse the URL using the url module to extract the host.
  2. Check if the host is exactly "soundcloud.com" or any other allowed subdomains.
  3. Replace the substring check with this more secure host validation.

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>
@SugarD-x SugarD-x marked this pull request as ready for review September 26, 2024 18:40
@SugarD-x SugarD-x merged commit 5ffe8ba into master Sep 26, 2024
2 checks passed
@SugarD-x SugarD-x deleted the autofix/alert-5-5582ac5b28 branch September 26, 2024 18:41
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