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. 173: Log Injection #351

Merged
3 commits merged into from
Sep 30, 2024
Merged

Conversation

yacosta738
Copy link
Collaborator

Fixes https://github.com/dallay/lyra/security/code-scanning/173

To fix the log injection issue, we need to sanitize the user input before logging it. Specifically, we should remove any newline characters from the email address to prevent log injection attacks. This can be achieved by replacing newline characters with an empty string.

  1. Modify the registerNewUser method in UserRegistrator.kt to sanitize the registerUserCommand.email before logging it.
  2. Add a utility function to sanitize the input by removing newline characters.
  3. Ensure that the logging statement uses the sanitized email.

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>
Signed-off-by: Yuniel Acosta Pérez <[email protected]>
Copy link

Job Summary for Gradle

Commit Stage 🤖 :: code-coverage
Gradle Root Project Requested Tasks Gradle Version Build Outcome Build Scan®
lyra koverXmlReport 8.7 Build Scan published
lyra projects 8.7 Build Scan published

@yacosta738 yacosta738 changed the title Fix code scanning alert no. 173: Log Injection fix: code scanning alert no. 173: Log Injection Sep 30, 2024
Copy link

codecov bot commented Sep 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.52%. Comparing base (284aeb0) to head (67daac0).
Report is 10 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #351   +/-   ##
=======================================
  Coverage   91.52%   91.52%           
=======================================
  Files         360      360           
  Lines        4344     4344           
  Branches      374      374           
=======================================
  Hits         3976     3976           
  Misses        237      237           
  Partials      131      131           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yacosta738 yacosta738 closed this pull request by merging all changes into main in d0189d8 Sep 30, 2024
@yacosta738 yacosta738 deleted the autofix/alert-173-d2fd95c38f branch September 30, 2024 19:05
yacosta738 pushed a commit that referenced this pull request Sep 30, 2024
## [1.14.1](v1.14.0...v1.14.1) (2024-09-30)

### Bug Fixes

* code scanning alert no. 173: Log Injection [#351](#351) ([f527add](f527add))
* code scanning alert no. 174: Log Injection [#352](#352) ([b4a1013](b4a1013))
* code scanning alert no. 175: Log Injection ([#347](#347)) ([05a2c01](05a2c01))
* code scanning alert no. 317: Log Injection ([4537476](4537476))
yacosta738 pushed a commit that referenced this pull request Sep 30, 2024
## [1.14.1](v1.14.0...v1.14.1) (2024-09-30)

### Bug Fixes

* code scanning alert no. 173: Log Injection [#351](#351) ([f527add](f527add))
* code scanning alert no. 174: Log Injection [#352](#352) ([b4a1013](b4a1013))
* code scanning alert no. 175: Log Injection ([#347](#347)) ([05a2c01](05a2c01))
* code scanning alert no. 317: Log Injection ([4537476](4537476))
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