drf-tracking icon indicating copy to clipboard operation
drf-tracking copied to clipboard

With LoggingMixin, view functions get masked values for keys like "Key" and "Password"

Open ozgurakcali opened this issue 7 years ago • 8 comments

LoggingMixin overrides request data for fields such as "password", "key" etc. not only while saving the request log, but before the request is processed. My view got a long string of asterixes instead of the user provided value for fields "Key" and "Password". Took me a good 2 hours to find the issue.

ozgurakcali avatar Aug 21 '17 13:08 ozgurakcali

Hello @ozgurakcali, this bug should be fixed with my change in #66, try to get drf-tracking from the master branch and not from PIPY to see if it is solved.

Sorry for the bug, that's entirely my fault

triat avatar Aug 21 '17 14:08 triat

Hi @triat , thanks for your reply. Will try that.

ozgurakcali avatar Aug 21 '17 14:08 ozgurakcali

Let me know if it worked better @ozgurakcali

triat avatar Aug 21 '17 16:08 triat

I encountered this same issue, that sensitive fields were not only masked for logging but also overwritten with asterisks prior to being processed by the view, thus causing the view to fail.

I grabbed your latest code from master (as suggested above) and can confirm that it fixes the issue of sensitive fields being overwritten. Thank you! However, that branch appears to have another issue with the _clean_data() function:

python3.6/site-packages/rest_framework_tracking/mixins.py", line 64, in initial
self.request.log.data = self._clean_data(self.request.data.dict())
AttributeError: 'list' object has no attribute 'dict'

This appears to occur when a JSON list is passed into the request, since _clean_data() appears to assume the data is a dict. FYI

Gnorizo avatar Oct 23 '17 23:10 Gnorizo

Ya. I ran into the same issue just using the branch from PIP install. Also took me forever to figure out why this was happening.

selected-pixel-jameson avatar Nov 16 '17 00:11 selected-pixel-jameson

Maybe @avelis can do a release as there is a bug in the actual version ?

triat avatar Nov 16 '17 07:11 triat

That would be awesome. @avelis

selected-pixel-jameson avatar Nov 16 '17 13:11 selected-pixel-jameson

I can confirm that this issue is solved with new release 1.4.0. I've also spent a lot of time figuring this out...

stevanmilic avatar Jan 28 '18 15:01 stevanmilic