Skip to content

Conversation

@Devasy
Copy link
Owner

@Devasy Devasy commented Sep 18, 2024

Fixes https://github.com/Devasy23/FaceRec/security/code-scanning/78

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>
Copy link

@senior-dev-bot senior-dev-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback from Senior Dev Bot

Comment on lines 392 to 399
"""
logging.info('Deleting Employee')
logging.debug(f"Deleting for EmployeeCode: {EmployeeCode}")
sanitized_employee_code = re.sub(r'\D', '', str(EmployeeCode))
logging.debug(f"Deleting for EmployeeCode: {sanitized_employee_code}")
client2.find_one_and_delete(collection2, {'EmployeeCode': EmployeeCode})

return {'Message': 'Successfully Deleted'}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CODE REVIEW

Good job on sanitizing the EmployeeCode before logging! However, ensure that the original variable remains unchanged for further operations. Alternatively, consider logging the sanitized value conditionally based on the logging level to avoid unnecessary processing.

sanitized_employee_code = re.sub(r'\D', '', str(EmployeeCode))
if logging.getLogger().isEnabledFor(logging.DEBUG):
    logging.debug(f"Deleting for EmployeeCode: {sanitized_employee_code}")

@sonarqubecloud
Copy link

pre-commit-ci bot and others added 2 commits September 18, 2024 16:06
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@Devasy Devasy linked an issue Sep 18, 2024 that may be closed by this pull request
1 task
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.

Fix code scanning alert - Log Injection

2 participants