bithavoc / express-winston

express.js middleware for winstonjs
https://www.npmjs.com/package/express-winston
MIT License
796 stars 187 forks source link

#66 nested request and response whitelist support #213

Closed kapalex closed 4 years ago

kapalex commented 5 years ago

This is a minimal solution as suggested by @mbonig in #66. This will work as expected for the default response/request filters. For user implementations that whitelist nested values it will be up to the user to implement the functionality correctly (if not nested whitelist is present it should work as usual).

To the point made in #66 about passing the filter a trimmed object - I would argue this isn't required, and is already not what you expect today, even without nesting.

bithavoc commented 5 years ago

summoning @golopot

bithavoc commented 5 years ago

@kapalex we'll be able to merge as soon as we can get some tests

kapalex commented 4 years ago

@golopot sorry for the delay, added a test for each case

since it's been a while I've merged with master to make sure there are no issues, if you'd rather avoid the clutter I can create a new fork and reapply the changes in a new pull request

@vim-daniel couldn't quite understand the issue, could you elaborate?

vim-daniel commented 4 years ago

@kapalex well let's say that we have the following response whitelist 'body.id' 'body.someObj.id'

the code before my suggestion will include the body only if one the records in the whitelist is exactly 'body'

and if we add a 'body' record for the whitelist it'll include the whole body, so to support dot notation response whitelist we need to check if one of the records in the response whitelist starts with 'body'

kapalex commented 4 years ago

@vim-daniel good point, I'll add the changes

kapalex commented 4 years ago

This got kind of cluttered, going to reopen pull request with a clean fork.