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

Censor write only variables logging and added a new callback to sanitize any logging that would be passed to the existing message_callback #911

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

WilcodenBesten
Copy link
Contributor

Describe your changes

  1. Added optional callback to sanitize all logging before being passed to the existing message_callback. Can be used to remove secrets from log lines.
  2. Added DeviceModel::get_mutability so the mutability of a component variable can be checked before the value change is logged. This prevents write-only varaiables to be logged

Checklist before requesting a review

  • I have performed a self-review of my code
  • [n/a] I have made corresponding changes to the documentation
  • [n/a] If OCPP 2.0.1: I have updated the OCPP 2.0.1 status document
  • I read the contribution documentation and made sure that my changes meet its requirements

@WilcodenBesten
Copy link
Contributor Author

WilcodenBesten commented Dec 12, 2024

The log line here: https://github.com/EVerest/libocpp/blob/main/lib/ocpp/common/websocket/websocket_libwebsockets.cpp#L996 can still leak secrets as it's not filtered. You could argue that it's debug so that's not needed, but better safe then sorry imo.

Would love to here you're opinion on that.

EDIT: as discussed during call today: remove it

@WilcodenBesten WilcodenBesten force-pushed the sensor-write-only-variables branch 2 times, most recently from 9f75036 to bd8f5f4 Compare December 16, 2024 07:53
…riable can be checked before the value change is logged. This prevents write-only varaiables to be logged

Signed-off-by: Wilco den Besten <[email protected]>
…o the existing message_callback. Can be used to remove secrets from log lines

Signed-off-by: Wilco den Besten <[email protected]>
@@ -60,6 +60,7 @@ class MessageLogging {
std::filesystem::path security_log_file;
std::ofstream security_log_os;
std::mutex output_file_mutex;
std::function<std::string(const std::string& message)> sanitize_message_callback;
Copy link
Contributor

Choose a reason for hiding this comment

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

As discussed in the last WG meeting, lets drop this callback from this PR and just merge the write only variable logging changes. I'll follow up with a generic solution

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.

3 participants