-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Conditionally Display Message and Header in MessageHandlingException #9416
Comments
For adding the header, I think something like this: Then that would turn off the failedMessage= display in the exception. |
It's fine if you want to make it a setting or something. However, the idea is to condition hide failedMessage in the exception(s). |
This no PII in logs thing is a new security concern. I think it's getting more popular. I suspect a lot of companies have PII in the messages. It would convenient to avoid dumping it to the logs. |
It is hard to continue discussion on StackOverlfow: https://stackoverflow.com/questions/78898981/how-to-remove-pii-from-messagehandlingexception-in-spring-integration Some more info and ideas are here: https://www.skyflow.com/post/how-to-keep-sensitive-data-out-of-your-logs-nine-best-practices. Still not clear why you are pursing the framework to make changes for you since some other tools in your application might not be aware of this feature in this specific library. Another solution where you hide PII at all is via old good Claim Check pattern: https://docs.spring.io/spring-integration/reference/6.4/claim-check.html. We cannot accept your suggestion about |
I would like to force spring integration not to display certain messages/headers, because they may contain PII.
Tell us how it should works
If message header hideMessageDataInException=true
Exception Message should have no "FailedMessage" Section:
org.springframework.messaging.MessageHandlingException: error occurred during processing message in 'MethodInvokingMessageProcessor' [org.springframework.integration.handler.MethodInvokingMessageProcessor@5494e631]
Note: hideMessageDataInException can default to false to maintain existing behavior.
Explain the difference from current behavior
Currently, the exception always includes failedMessage section of error message. We have no way to block failedMessage from appearing, even if the message include PII. We would like to log the exception, but it has PII in it.
org.springframework.messaging.MessageHandlingException: error occurred during processing message in 'MethodInvokingMessageProcessor' [org.springframework.integration.handler.MethodInvokingMessageProcessor@5494e631], failedMessage=GenericMessage [payload=hasPII, headers={hasPII}]
How has this issue affected you?
We are not able to hide PII in the logs.
What are you trying to accomplish?
We would like to log our error message, but not include the failed message in the logs. I get why often it is nice to have the failedMessage in the logs, but there is no way to turn that off.
What other alternatives have you considered?
We could make a custom logger, that check each logged string for failedMessage=GenericMessage... and remove that section of the log message.
Are you aware of any workarounds?
Not really.
The text was updated successfully, but these errors were encountered: