What is the idea behind filterSensitiveLog? #1810
Replies: 3 comments 4 replies
-
The method is intended to filter sensitive data from the shapes before logging. It is used by the loggerMiddleware while logging input/output aws-sdk-js-v3/packages/middleware-logger/src/loggerMiddleware.ts Lines 33 to 34 in 4f9e56f The method is not intended for usage by users directly, unless they're writing their custom logger. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the clarification. Given what you wrote it does make it clear that it is not intended to be used the way we are. I do want to ask/suggest if it could be a feature for the future though? It'd be a very helpful function to be able to easily and secure log request parameters for debugging and the like. |
Beta Was this translation helpful? Give feedback.
-
Hello, I was following this discussion for some time and one of the several questions I have is: is it true that aws middleware can be executed only once the command is sent (order and priority of the stack does not matter for this question)? I am asking because I have the use case where I am interested of having two microservices, where 1st generates aws commands based on AI and the 2nd microservice sends them to aws. I do not want get into details of the use case but I am interested in logging commands in the 1st microservice. So question is: is it possible to filter sensitive data on the command using convenient way like @carlnordenfelt suggested
Or something similar? Or I must add the middleware which will be executed only once the command is sent? If not, can any middleware be explicitly be chosen and executed without calling others? What I am asking is totally not responsibility of the aws sdk to expose, but out of curiosity I want to have a bigger picture here. If the middleware can be executed only once the command is sent, then I need completely different approach. Also, I assume my use case is only one of the many when logging is needed but middleware is too big overhead, or won't help at all. |
Beta Was this translation helpful? Give feedback.
-
There is a function exposed called
filterSensitiveLog
.It isn't entirely clear if this method is intended for use by SDK users or not.
I really like the general idea of having access to a function that will automatically filter out Command parameters that are deemed sensitive as it takes away one thing to consider in our services but it appears clunky at the moment.
An example:
If it is intended to be used like this I would personally prefer to not have to require the Request object but rather to use it on the command directly:
log.info('Command Params', cmd.filterSensitiveLog());
It might be that I am getting this all wrong and I shouldn't even be using this method at all.
Some clarification on this would be much appreciated.
Beta Was this translation helpful? Give feedback.
All reactions