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. 2: Log Injection #27

Merged
merged 1 commit into from
Sep 28, 2024

Conversation

shulng
Copy link
Contributor

@shulng shulng commented Sep 28, 2024

Fixes https://github.com/zhinghu/CatSeedLogin/security/code-scanning/2

To fix the log injection issue, we need to sanitize the requestType before logging it. The best way to do this is to remove any potentially harmful characters, such as newlines, from the requestType. This can be done using the replace method to replace newline characters with an empty string. Additionally, we should ensure that the requestType is clearly marked in the log entry to prevent any confusion.

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>
@shulng shulng marked this pull request as ready for review September 28, 2024 15:10
@shulng shulng merged commit d1ccc17 into main Sep 28, 2024
3 checks passed
@shulng shulng deleted the autofix/alert-2-82cc0fe02a branch October 14, 2024 10:00
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