OpenFeign / OpenFeign/feign

shouldLogRequestHeader and shouldLogResponseHeader is not enough to control headers log in FULL mode

Open
#2,586 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
9.8k
Forks
1.9k
Avg merge
1d 2h
Merged PRs (30d)
41

Description

There is an implementation to control request and response headers with shouldLogRequestHeader and shouldLogResponseHeader.

It's working for logs but …

There is a line in the implementation which logs the whole response body also with headers.

I would also like to control these headers. Filter out particular headers in that particular log.

I am using FULL logging and debug mode.

The reason why I filter out the headers is to avoid security sensitive headers like tokens etc.

I would like to see that shouldLogResponseHeader is controlling also this line of the log too without any other implementation.

Here is how the log looks like

-10-04T10:36:50.206+02:00 DEBUG 131409 --- [demo] [           main] feign.Logger                             : [Client#get] {

  "args": {},

  "headers": {

    "Accept": "*/*",

    "Host": "[httpbin.org](http://httpbin.org/)",

    "User-Agent": "Java/21.0.1",

    "X-Amzn-Trace-Id": "Root=1-66ffa922-324f4c83482b70b4579853ac"

  },

  "origin": "88.212.19.236",

  "url": "https://httpbin.org/get"
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in core/src/main/java/feign/Logger.java at the response logging line linked in the issue, and trace how response headers are currently filtered. The change is done when headers included in the FULL-mode response-body log also obey shouldLogResponseHeader, preventing selected sensitive headers from appearing there.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.