apache / apache/apisix

feat: loki-logger should not log authorization headers

Open
#13,452 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Lua
Stars
17.1k
Forks
2.9k
Avg merge
3d 16h
Merged PRs (30d)
63

Description

### Description

As a apisix user, I have enabled loki-logger (without overriding `log_format`) and I have quickly noticed, that all headers are being logged - including `request_headers_authorization`, `request_headers_x_userinfo`,`request_headers_x_access_token`.

According to very common security practices, such data should not be logged. While we have possibility to override what's being logged via `log_format` - I would expect *defaults* to follow security practices.

In ideal scenario, we should introduce a parameter to the plugin configuration, which contains list of HTTP headers to be dropped, and it should by default include `Authorization`, `X-Userinfo`, `X-Access-Token` fields.

This could possibly apply to other logger plugins, too.

Contributor guide

Open the contributing guide

Research direction

Start by locating the loki-logger plugin's configuration and default log format handling. Confirm how request headers become logged fields, then define the dropped-header configuration and its defaults for Authorization, X-Userinfo, and X-Access-Token. Done means those headers are excluded by default, overrides remain possible, and tests cover the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
observability-sre, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.