Skip to content

Potential fix for code scanning alert no. 43: Clear-text logging of sensitive information#1

Merged
eman merged 5 commits intomainfrom
alert-autofix-43
Oct 10, 2025
Merged

Potential fix for code scanning alert no. 43: Clear-text logging of sensitive information#1
eman merged 5 commits intomainfrom
alert-autofix-43

Conversation

@eman
Copy link
Copy Markdown
Owner

@eman eman commented Oct 10, 2025

Potential fix for https://github.com/eman/nwp500-python/security/code-scanning/43

To fix the problem, we should avoid logging topic strings that include sensitive data such as the MAC address. Instead, log a generic error message and optionally include only non-sensitive information (e.g., device type, an anonymized topic, or an index). If identification context is needed, consider redacting or masking the MAC address (e.g., showing only the final octet, or replacing with a placeholder).
Specifically, in examples/test_mqtt_messaging.py, replace the print statement on line 125 so that it doesn't log the full topic string.
No additional imports are required.
If context is useful for debugging, log the device type and the subscription attempt index, but exclude the MAC address.


Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…ensitive information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Owner Author

@eman eman left a comment

Choose a reason for hiding this comment

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

accepting the generated fix.

eman and others added 4 commits October 9, 2025 20:04
Co-authored-by: eman <19387+eman@users.noreply.github.com>
Fix broken lint test by installing dependencies and correcting code formatting
@eman eman marked this pull request as ready for review October 10, 2025 03:13
@eman eman merged commit e848aa6 into main Oct 10, 2025
10 checks passed
@eman eman deleted the alert-autofix-43 branch October 15, 2025 18:20
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.

2 participants