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. 155: Log Injection #573

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jordanpadams
Copy link
Member

Fixes https://github.com/NASA-PDS/registry-api/security/code-scanning/155

To fix the log injection issue, we need to sanitize the user-provided input before logging it. The best way to do this is to remove any potentially harmful characters from the input string. Specifically, we should replace newline characters with spaces to prevent log forging. Additionally, we should ensure that the user input is clearly marked in the log entry to avoid confusion.

  1. Sanitize the user-provided input by replacing newline characters with spaces.
  2. Update the log message to use the sanitized input.

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>
@jordanpadams jordanpadams marked this pull request as ready for review November 14, 2024 01:25
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