-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
add option to configure externally supplied implementation for sensitive data masking #1150
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JohnMTu thanks for the pull request (apologies for the delay), I have a few comments:
- could you please create a JIRA issue for the feature in question?
- the
MaskSensitiveHelper
is intended to do exactly what the suggestedMaskSensitiveMasker
abstraction does, I think this is not needed and could be solved with the ability to provide customMaskSensitiveHelper
instance
@reta : This is ticket i just made https://issues.apache.org/jira/browse/CXF-8831 Having option to provide own instance of MaskSensitiveHelper subclass would be also fine for me. Only not so nice thing might be, that method setSensitiveElementNames is invoked from AbstractLoggingInterceptor#setSensitiveElementNames and LoggingFeature and LoggingFeature.Portable. Do you want to do stuff yourself, or should i provide it? thanks |
Thank you @JohnMTu !
I think extracting interface would be cleaner in general
Yes, the delegation model could be used instead (in this regards, subclassing would be simpler than interface extraction), but preserving backward compatibility is necessary.
Up to you, would be great if you finish the change since this is your idea and most of the work is done already. I am not sure you have time though (no pressure).
Thanks to you! |
i didn't forget, just no time atm. But is in my list. |
@JohnMTu could you please rebase against latest |
…mentations and remove SensitiveDataMasker
hello, @reta: so far i removed "final" from maskSensitiveHelper field and added setters. Hence subclasses can be passed. In next step i tried to extract interface. Here I realized there is some inconsistency, as configuration used for hiding data is in once case on Interceptor org.apache.cxf.ext.logging.AbstractLoggingInterceptor#sensitiveProtocolHeaderNames while in other case it's near to implementation in org.apache.cxf.ext.logging.DefaultMaskSensitiveHelper#replacementsJSON (and replacementsXML). Best would be to cleanup it and keep it next to implementation, but unfortunately that would mean to change to some public methods, e.g. Anyway, i'm not sure, if even change MaskSensitiveHelper to from class to interface is allowed in terms of backward compatibility. Please give me some hints, So here is my attempt: Unfortunately github doesn't show rename of MaskSensitiveHelper to DefaultMaskSensitiveHelper and instead shows diff against extracted interface .. but when checking commit by commit, rename is visible. Not sure how it would look like, if squash would be used. Please check. |
Hey @JohnMTu
I think this is great!
That would be a breaking change sadly, if subclassing works, that would be the best option (for now) |
then lets stick to subclassing. And for rest, if you want, put come cleanup TODO for next major version or so. |
So i suggest, from https://github.com/JohnMTu/cxf/compare/3.5.x-fixes...JohnMTu:cxf:CXF-8831_extract_interface?expand=1 i would take at least changes in rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/DefaultLogEventMapper.java and in rt/features/logging/src/main/java/org/apache/cxf/ext/logging/AbstractLoggingInterceptor.java extend setSensitiveDataHelper with call to hence also 2nd usage can be replaced with subclass. |
Sure, would you like to make this changes in scope of this pull request or open another one? |
i can do it here, but only in 2 weeks. What is better for you? |
Let me merge this one and you will be able to work on the next improvements at your own pace, thank you |
…ive data masking (#1150) * add interface to hide sensitive data in message * add option to configure externally supplied implementation for sensitive data masking * add option to configure externally supplied implementation for sensitive data masking * make maskSensitiveHelper non-final and settable to allow custom implementations and remove SensitiveDataMasker
…ive data masking (#1150) * add interface to hide sensitive data in message * add option to configure externally supplied implementation for sensitive data masking * add option to configure externally supplied implementation for sensitive data masking * make maskSensitiveHelper non-final and settable to allow custom implementations and remove SensitiveDataMasker
Current feature to hide sensitive data is not good enough for us.
E.g. we have interfaces containing key-value like structures and we want to hide only values of element where key value is some concrete value etc.
Hence would like to make it possible to plug in own implementation.