apache / apache/apisix

feat: As a user, I want openid-connect to support hide_credentials, so that the bearer token is not forwarded to upstream services that don't need it

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

Description

### Description

### TL;DR

Introduce a `hide_credentials` attribute to `openid-connect`.

### Problem

The `openid-connect` plugin currently forwards the incoming `Authorization` / `X-Access-Token` header to the upstream unchanged, after validating the bearer token. This often unnecessarily exposes the access token to backend services, both violating the principle of least privilege and widening the blast radius of a compromised upstream 👀

### Feature Request

Add a `hide_credential` attribute (set to `false` by default) to `openid-connect` plugin, mirroring the behaviour already supported by other `*-auth` plugins.
When `hide_credentials = true`, after the token is extracted and validated, the plugin would clear the **source** header before the request is proxied upstream.

### Notes/Considerations

- How would this integrate with `set_access_token_header` (set to `true` by default)? In my opinion, they should be independent: `hide_credentials` hides the original header, `set_access_token_header` adds "back" the token to `X-Access-Token` header (or `Authorization` if `access_token_in_authorization_header = true`), if `set_access_token_header = true`.

Contributor guide

Open the contributing guide

Research direction

Start by locating the openid-connect plugin and reviewing how other *-auth plugins implement hide_credentials. Trace token extraction and validation, then verify that the source header is cleared when requested while set_access_token_header behavior remains independent. Add or update coverage for both settings and confirm the proxied request headers match the issue description.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
api, authentication
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.