Commit Graph

2292 Commits

Author SHA1 Message Date
Stefan Markmann cf5d34acf6
revert: "fix: skip provider button auth only redirect (#3309)" (#3314)
This reverts commit 9c61c49ec2.

The original fix broke nginx deployments using `auth_request`. When `/oauth2/auth` returns 302,
nginx's `auth_request` module treats this as an internal error:

    [error] auth request unexpected status: 302 while sending to client

nginx then returns **500 Internal Server Error** to the browser.

> If the subrequest returns a 2xx response code, the access is allowed. If it returns 401 or 403,
> the access is denied with the corresponding error code. Any other response code returned by the
> subrequest is considered an error.
https://nginx.org/en/docs/http/ngx_http_auth_request_module.html

The nginx `auth_request` module has strict semantics (non-negotiable):

| Subrequest status | nginx behavior |
|---|---|
| 2xx | Allow request |
| 401 / 403 | Deny → trigger `error_page` |
| **Any other status** | **Internal error → 500** |

The `/oauth2/auth` endpoint is used as a **policy oracle** (yes/no decision),
not as a browser-facing endpoint. It cannot return redirects.

Any nginx deployment with:
- `skip-provider-button=true`
- Using `auth_request` directive

Will receive 500 errors instead of the expected authentication flow.

The correct fix for #334 is a **documentation update**, not a code change:

```nginx
error_page 401 = @oauth2_signin;

location @oauth2_signin {
    return 302 /oauth2/sign_in?rd=$scheme://$host$request_uri;
}
```

This keeps `/oauth2/auth` as a pure 401/2xx oracle and lets nginx perform the proper 302 redirect to the browser.

- Original Issue: #334
- Regression introduced in PR: #3309

Signed-off-by: Stefan Markmann <stefan@markmann.net>
Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2026-01-18 00:36:08 +01:00
Jan Larwig 7bf586c898
Merge pull request #3313 from oauth2-proxy/release/v7.14.1
release v7.14.1
2026-01-17 16:22:29 +01:00
Jan Larwig 8f52b14eda
doc: changelog entry for v7.14.1
Signed-off-by: Jan Larwig <jan@larwig.com>
2026-01-17 16:15:54 +01:00
github-actions[bot] 3ed3baf59f update to release version v7.14.1 2026-01-17 15:08:04 +00:00
Jan Larwig 56b5c08596
Merge pull request #3312 from oauth2-proxy/chore/gomod
chore(deps): update go1.25.6 and dependencies
2026-01-17 16:07:31 +01:00
Jan Larwig 5020c33124
ci: fix qlty coverage upload
Signed-off-by: Jan Larwig <jan@larwig.com>
2026-01-17 16:01:19 +01:00
Jan Larwig cc0b48d5ec
ci: fix linter warnings for preallocation
Signed-off-by: Jan Larwig <jan@larwig.com>
2026-01-17 16:01:14 +01:00
Jan Larwig 844e4e3b0c
chore(deps): upgrade to go1.25.6; upgrade all go dependencies
Signed-off-by: Jan Larwig <jan@larwig.com>
2026-01-17 15:25:59 +01:00
Sourav Agrawal 59f4e42a5a
fix: static upstreams failing validation due to `passHostHeader` and `proxyWebSockets` defaults being set incorrectly (#3302)
* fix: static upstream validation failure

Signed-off-by: Sourav Agrawal <souravagr01@gmail.com>

* fix: enforcement of defaults compatible with static upstreams

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Sourav Agrawal <souravagr01@gmail.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2026-01-17 15:15:19 +01:00
Stefan Markmann 9c61c49ec2
fix: skip provider button auth only redirect (#3309)
* fix: Return 302 redirect from AuthOnly when skip-provider-button is true

When SkipProviderButton is enabled and a user needs to login, the AuthOnly
endpoint now returns a 302 redirect directly to the OAuth provider instead
of returning 401.

This fixes an issue with nginx auth_request architecture where 401 triggers
error_page handling, which can break redirect flows because nginx overrides
the status code (e.g., to 403), and browsers don't follow Location headers
for non-3xx responses.

Fixes: #334
Signed-off-by: Stefan Markmann <stefan@markmann.net>

* update docs and changelog

Signed-off-by: Stefan Markmann <stefan@markmann.net>

* test: Add specific OAuth redirect assertions per code review feedback

Improve TestAuthOnlyEndpointRedirectWithSkipProviderButton to verify
that the Location header actually redirects to the OAuth provider's
authorize endpoint with required parameters (client_id, redirect_uri,
state), not just that a Location header exists.

Signed-off-by: Stefan Markmann <stefan@markmann.net>

* refactor: Flatten AuthOnly error handling structure

Move the SkipProviderButton check outside of the nested err != nil block
using an if-else structure. This makes the special case more visible and
reduces nesting depth without changing behavior.

Signed-off-by: Stefan Markmann <stefan@markmann.net>

* doc: backport to v7.14.x

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Stefan Markmann <stefan@markmann.net>
Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2026-01-17 14:35:44 +01:00
Jan Larwig 707e6c4a1c
Merge pull request #3308 from oauth2-proxy/release/v7.14.0
release v7.14.0
2026-01-17 11:15:40 +01:00
Jan Larwig 1f29953b7b
docs: add todo for revamping the usage / naming of PassHostHeader
Signed-off-by: Jan Larwig <jan@larwig.com>
2026-01-17 11:06:24 +01:00
Jan Larwig 3bc1a5373a
doc: extend the alpha config changelog notice
Signed-off-by: Jan Larwig <jan@larwig.com>
2026-01-17 11:06:24 +01:00
Jan Larwig a360cb3875
docs: backport integrations split to v7.14.x & v7.13.x
Signed-off-by: Jan Larwig <jan@larwig.com>
2026-01-17 11:06:19 +01:00
Jan Larwig f46dcc77a8
doc: cncf onboarding and sponsor update
Signed-off-by: Jan Larwig <jan@larwig.com>
2026-01-17 11:04:43 +01:00
Jan Larwig 34c2712c99
doc: add changelog and migration guide for v7.14.0 alpha config changes
Signed-off-by: Jan Larwig <jan@larwig.com>
2026-01-17 11:04:42 +01:00
github-actions[bot] 3124bf7bda
update to release version v7.14.0 2026-01-17 11:04:42 +01:00
github-actions[bot] d16a0c4d47
add new docs version 7.14.x 2026-01-17 11:04:42 +01:00
Shriya Kamat Tarcar 86c2469806
docs: clarify secret file format requirements (#3311)
* docs: clarify secret file format requirements

Signed-off-by: shri3016] <shriyaktarcar@gmail.com>

* doc: backport to v7.13 and v7.12

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: shri3016] <shriyaktarcar@gmail.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2026-01-17 11:04:16 +01:00
Pascal 1d6721f7ba
fix: WebSocket proxy to respect PassHostHeader setting (#3290)
* Fix WebSocket proxy to respect PassHostHeader setting

When PassHostHeader is set to false, the regular HTTP proxy correctly
sets the Host header to the upstream backend URL. However, the WebSocket
proxy was not respecting this setting, causing WebSocket connections to
fail when backend services validate the Host header.

This commit:
- Adds passHostHeader parameter to newWebSocketReverseProxy()
- Applies setProxyUpstreamHostHeader() when PassHostHeader=false
- Ensures consistent behavior between HTTP and WebSocket proxies

Fixes #3288

Signed-off-by: Pascal Schmiel <pascal.schmiel@gmail.com>

* chore(): add tests, update changelog

Signed-off-by: Pascal Schmiel <pascal.schmiel@gmail.com>

---------

Signed-off-by: Pascal Schmiel <pascal.schmiel@gmail.com>
2026-01-16 20:30:16 +01:00
Pierluigi Lenoci 3c22bc7877
docs: split integration.md into separate integration guides (#3299)
* docs: add Kubernetes Dashboard integration guide for Azure Entra ID

Add comprehensive documentation for integrating oauth2-proxy with
Kubernetes Dashboard on Azure Kubernetes Service (AKS) using Azure
Entra ID authentication.

Changes:
- Add new section "Kubernetes Dashboard on AKS" to ms_entra_id.md
  with complete configuration examples including:
  - Architecture overview and integration flow
  - Alpha configuration for oauth2-proxy Helm chart
  - Dashboard Ingress with proper auth annotations
  - RBAC configuration (user-based and group-based)
  - Troubleshooting guide for common issues
  - Workload Identity (passwordless) setup

- Add reference link in integration.md pointing to the new section
  for users looking for Kubernetes Dashboard integration examples

This addresses common issues users face when integrating Dashboard
with Entra ID, particularly:
- Missing Authorization header in auth-response-headers
- Insufficient buffer sizes for large Entra ID tokens
- RBAC permission configuration
- Group claims setup

Closes: oauth2-proxy/manifests#348
Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>

* docs: split integration.md into separate integration guides

Split the monolithic integration.md file into a structured integrations
directory with individual pages for each tool as requested by maintainer.

Changes:
- Create new docs/configuration/integrations/ directory structure
- Split content into separate files:
  - nginx.md: Nginx auth_request directive configuration
  - traefik.md: Traefik v2 ForwardAuth middleware setup
  - caddy.md: Caddy v2 forward_auth directive configuration
  - kubernetes-dashboard.md: K8s Dashboard integration (with deprecation notice)
  - headlamp.md: Headlamp integration guide (recommended alternative)
- Transform integration.md into an index/overview page linking to all integrations
- Update docs/sidebars.js to use new Integration Guides category structure

The content has been preserved as-is from the original file, only
reorganized into separate files for better maintainability and
navigation. Added deprecation notice for Kubernetes Dashboard per
0ba796dce6

Addresses maintainer feedback from PR #3299

Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>

* fix: restore Kubernetes Dashboard tip box in nginx integration docs

Add back the tip box referencing the Kubernetes Dashboard Azure Entra ID
integration example that was present in the original integration.md file.

This ensures all content from the original file is preserved in the split
documentation structure.

Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>

* refactor: move Kubernetes Dashboard details to integration guide

Move the detailed Kubernetes Dashboard integration content from the
ms_entra_id provider documentation to the integrations section where
it logically belongs.

Changes:
- Move complete K8s Dashboard guide from ms_entra_id.md to
  integrations/kubernetes-dashboard.md (architecture, configuration,
  RBAC, troubleshooting, Workload Identity)
- Replace detailed section in ms_entra_id.md with brief reference
  to integration guide
- Reorder sidebar: Headlamp before Kubernetes Dashboard
- Update integration.md index to show Headlamp first (recommended),
  Dashboard last (deprecated)

This improves documentation organization by keeping integration guides
in the integrations/ directory and provider docs focused on provider
configuration.

Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>

* docs: move integration.md to integrations/index.md

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2026-01-16 09:37:52 +01:00
Michi Gysel 49536035a2
fix: session refresh handling in OIDC provider (#3267)
* Fix session refresh handling in OIDC provider

- `s.Refreshed` was always `false` as the session object was not updated
- `ValidateURL` is, by default, not configured for OIDC providers. Access token validation now only happens when a validation endpoint is available.

Signed-off-by: Michael Gysel <michael.gysel@unblu.com>

* Update changelog

Signed-off-by: Michael Gysel <michael.gysel@unblu.com>

---------

Signed-off-by: Michael Gysel <michael.gysel@unblu.com>
2026-01-14 23:18:27 +01:00
dawg b4eb611c07
feat: more aggressively truncate logged access_token (#3264)
* partly address #2120 and more aggressively truncate access_token

- leaking half of the access token to the logs seems problematic from
  a security point of view
- also noisier than necessary logging
- fixed by truncating to at most first 5 chars (e.g. `ya29.`)

Signed-off-by: Martin Nowak <code@dawg.eu>

* feat: more aggressively truncate logged access_token; add unit test and changelog

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Martin Nowak <code@dawg.eu>
Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2026-01-14 23:12:51 +01:00
renovate[bot] f3dcffed27
chore(deps): update traefik docker tag to v2.11.35 (#3295)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-14 22:28:27 +01:00
Drew Foehn 3c37312f3c
fix: added conditional so default is not always set and env vars are honored #3303 (#3304)
Signed-off-by: Drew Foehn <drew@pixelburn.net>
2026-01-14 22:18:52 +01:00
Shriya Kamat Tarcar a8e208430e
docs: add Cisco Duo SSO provider documentation (#3306)
* docs: add Cisco Duo SSO provider documentation

Signed-off-by: Jan Larwig <jan@larwig.com>

* doc: backport to versioned docs 7.13 and fix alphabetical order of entries

Signed-off-by: Jan Larwig <jan@larwig.com>

* doc: improved clarity for the cisco duo configuration steps

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2026-01-14 22:17:15 +01:00
NirronCD a2f2223d2b
doc: improved clarity and correctness of proxy behaviour (#3305)
* doc: adjust regarding description of behaviour

Signed-off-by: NirronCD <nirron@rietto.com>

* doc:changed style, added suggested

Signed-off-by: NirronCD <nirron@rietto.com>

* doc: minor fix to docusaurus metadata syntax

Signed-off-by: NirronCD <nirron@rietto.com>

* docs: improved clarity for how the proxy behaves in different scenarios

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: NirronCD <nirron@rietto.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2026-01-14 21:26:50 +01:00
renovate[bot] 0100ca9403
chore(deps): update alpine docker tag to v3.23.2 (#3296)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-06 19:42:27 +01:00
renovate[bot] 854a74793b
chore(deps): update dependency golangci/golangci-lint to v2.7.2 (#3254)
* chore(deps): update dependency golangci/golangci-lint to v2.7.2

* chore(linter): fix gocritic deprecation message issue

Signed-off-by: Jan Larwig <jan@larwig.com>

* chore(lint): fix var-naming: avoid package names that conflict with Go standard library package names (revive)

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2026-01-04 10:23:26 +01:00
renovate[bot] 6a0d821df8
chore(deps): update actions/checkout action to v6 (#3273)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-24 11:31:18 +01:00
renovate[bot] 12564e02d0
chore(deps): update docker-compose (#3272)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-24 11:30:58 +01:00
Jan Larwig 699f367115
chore(deps): upgrade gomod and bump to golang v1.25.5 (#3292)
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-12-24 11:30:23 +01:00
renovate[bot] 4956bab3fe
chore(deps): update module golang.org/x/crypto to v0.45.0 [security] (#3266)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-24 10:55:38 +01:00
Jan Larwig e27921ee80
Merge pull request #2628 from tuunit/use-mapstructures-for-parsing-and-merging
structured config #1: introduce mapstructure decoder for yaml parsing
2025-11-28 18:14:11 +01:00
Jan Larwig aee540a277
doc: fix mapstructure configuration comments
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-28 17:20:15 +01:00
Jan Larwig 15041dd116
feat: migrate google used organization id and header normalization booleans to pointers
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-16 22:39:01 +01:00
Jan Larwig 0eec65e230
refactor: ptr.Ptr to ptr.To
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-16 22:38:59 +01:00
Jan Larwig 137decb1ec
adapting unit tests and fixing minor issues introduced with the derefing
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-16 22:38:57 +01:00
Jan Larwig 638fba417f
deref everything but now with default constants
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-16 22:38:56 +01:00
Jan Larwig ceb9a387b1
deref everything... but why?
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-16 22:38:54 +01:00
Jan Larwig 527c72f23f
feat: add ensure defaults to all migrated structs
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-16 22:38:52 +01:00
Jan Larwig 51b1fd0510
chore(deps): replace with forked official yaml library
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-16 22:38:51 +01:00
Jan Larwig 9d70e04262
feat: migrate all alpha config booleans to pointers
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-16 22:38:49 +01:00
Jan Larwig 50414356e8
return nil directly
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-16 22:38:47 +01:00
Jan Larwig 955ab6b41b
fix test setup and add local image build make target
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-16 22:38:46 +01:00
Jan Larwig 48bd2d7d38
fix merge problems and test cases
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-16 22:38:44 +01:00
Jan Larwig 810f629ee8
revert: secrets as []byte instead of string
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-16 22:38:42 +01:00
Jan Larwig aaf1889b97
fix alpha config
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-16 22:38:40 +01:00
Jan Larwig 18fc898129
resolve cipher deprecation and update mapstructures v2
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-16 22:38:29 +01:00
tuunit 4c0dd28f12
fix alpha config example
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-16 22:38:26 +01:00