feign icon indicating copy to clipboard operation
feign copied to clipboard

Is there any way to replace the feign header 's value as "secret"?

Open MGunel opened this issue 4 years ago • 5 comments

Is there any way to replace the feign header's value in log ? I found the way to exclude headers from logs but I want to replace feign header's value as "secret" .I did this by overriding shouldLogRequestHeader method

MGunel avatar Dec 30 '21 13:12 MGunel

if you want to exclude secret values from the logs, why not configure your logger to mask those. We use logback and use pathMask and valueMask to mask sensitive values in the log.

sakibulalam avatar Jan 03 '22 09:01 sakibulalam

if you want to exclude secret values from the logs, why not configure your logger to mask those. We use logback and use pathMask and valueMask to mask sensitive values in the log.

I use logbook for project but logbook. removeheader does not affect feign log ,because feign log use slf4J by default when it is logging.And So I can see sensitive data in log when request sent. Can Logback framework do it for feign log that automatcally logged?

MGunel avatar Jan 04 '22 11:01 MGunel

I found (https://github.com/OpenFeign/feign/pull/1530)this .It is exculude but I want to replace with"secret"

MGunel avatar Jan 04 '22 11:01 MGunel

@MGunel Logback can be used as implementation of slf4j: you can configure excluding as @sakibulalam said.

For me it is better way than to add masking logic to Feign's Logger.

vitalijr2 avatar Jan 23 '22 06:01 vitalijr2

Echoing @radio-rogal, You will need to provide your own Logger implementation for this sort of customized handling. Our provided Logger implementations do not allow for pattern customization at this time. Could be a good candidate for an enhancement. If this is something you are interested in, feel free to submit a proposal.

kdavisk6 avatar Mar 24 '22 14:03 kdavisk6

Given there's been no update or proposal, I'm assuming you are good.

kdavisk6 avatar Oct 07 '22 21:10 kdavisk6