Commit Graph

443 Commits

Author SHA1 Message Date
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
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
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
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
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
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 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 c186d40675
use official upstream yaml library v3
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-16 22:38:22 +01:00
tuunit 6720d8da60
add duration test
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-16 22:38:18 +01:00
Jan Larwig 676f56a35e
apply review suggestions
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-16 22:38:03 +01:00
tuunit 7c20001045
introduce mapstructure decoder for yaml parsing
remove color output in tests for better readability in github actions

bugfix: remove google as default provider for alpha options

fix conversion flow for toml to yaml

revert ginkgo color deactivation

revert claim- and secret source back to pointers

regenerate alpha config

Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-16 22:37:37 +01:00
Raúl Sampedro 7cf69b27fa
fix: NewRemoteKeySet is not using DefaultHTTPClient (#3197)
* fix: NewRemoteKeySet is not using DefaultHTTPClient

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

* doc: add changelog entry

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

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-11-11 21:08:08 +01:00
Jan Larwig fcf4e7947b
fix: hmacauth dependency licensing issue (#3253)
* fix: upstream licensing issue by adopting hmacauth library and changing asserting library for its test cases

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

* fix: golang code quality and linting issues for hmacauth

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

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-09 20:14:54 +01:00
Michi Gysel 22053dcade
fix: validation of refreshed sessions using the access_token in the OIDC provider (#1933)
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-08 13:49:48 +01:00
Jan Larwig f3f30fa976
Merge commit from fork
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-08 12:52:31 +01:00
Jan Larwig 5993067505
Merge commit from fork
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-08 12:42:45 +01:00
Drew Foehn 87827435ce
feat: added organizationId/employee id as preferred username (#3237)
Signed-off-by: Drew Foehn <drew@pixelburn.net>
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-11-07 19:44:32 +01:00
David Symonds 110d51d1d7
test: replace mock pkg/clock with narrowly targeted stub clocks. (#3238)
The package under pkg/clock is github.com/benbjohnson/clock, which is
archived. It's also way more complex than is what is actually needed
here, so we can entirely remove the dependency and remove the helper
package.

Fixes #2840.

Signed-off-by: David Symonds <dsymonds@gmail.com>
2025-10-28 10:05:02 +01:00
stagswtf 51e80f24ef
fix: use GetSecret() in ticket.go makeCookie to respect cookie-secret-file (#3228)
* fix: use GetSecret() in ticket.go makeCookie

The makeCookie method in ticket.go was using t.options.Secret directly, which
meant cookie-secret-file was not being respected. Updated to use GetSecret()
which handles both cookie-secret and cookie-secret-file properly.

Also added test coverage for cookie-secret-file functionality.

Fixes #3224

Signed-off-by: stagswtf <142280349+stagswtf@users.noreply.github.com>

* docs: update CHANGELOG.md for cookie-secret-file fix

Signed-off-by: stagswtf <142280349+stagswtf@users.noreply.github.com>

* correct PR link and undo file formatting

Signed-off-by: stagswtf <142280349+stagswtf@users.noreply.github.com>

* fix: error wrapping

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

---------

Signed-off-by: stagswtf <142280349+stagswtf@users.noreply.github.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-10-28 08:37:25 +01:00
jet f18a0b7b07
feat: allow disable-keep-alives configuration in upstream (#3156)
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-08-19 07:56:16 +02:00
Kevin Kreitner 4c86a4d574
feat: add Cidaas provider (#2273)
* Add sensible logging flag to default setup for logger

* Fix default value flag for sensitive logging

* Remove sensitive logging changes

* Add Cidaas provider

* Update CHANGELOG.md

* Add required groups scope to defaults

* Fix tests

* Remove if block with protected resource

* Fix linting

* Adjust provider sorting, fixes

* Directly handle error return

Co-authored-by: Jan Larwig <jan@larwig.com>

* Use less deep nesting

Co-authored-by: Jan Larwig <jan@larwig.com>

* Directly handle returned error

Co-authored-by: Jan Larwig <jan@larwig.com>

* Pass provider options to Cidaas provider

Co-authored-by: Jan Larwig <jan@larwig.com>

* Add import for provider options

* Fix tests

* Fix linting

* Add Cidaas doc page

* Add Cidaas provider doc page to overview

* Fix link in docs

* Fix link in docs

* Add link to Cidaas

* fix provider order in docs and changelog position

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

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Teko012 <112829523+Teko012@users.noreply.github.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Kevin Kreitner <kevinkreitner@gmail.com>
2025-08-12 17:41:45 +02:00
Jan Larwig 9ffafad4b2
Merge commit from fork
Signed-off-by: Jan Larwig <jan@larwig.com>
2025-07-30 19:46:58 +02:00
nobletrout f4b33b64bd
feat: differentiate between "no available key" and error for redis sessions (#3093)
* add some better error handling

* add changelog entry

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

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-07-24 08:33:06 +02:00
Sourav Agrawal e75a258299
feat: make google-groups argument optional (#3138)
add test cases

update documentation

refactor code and some cleanup

update changelog

Signed-off-by: Jan Larwig <jan@larwig.com>
2025-07-24 07:55:54 +02:00
Sandy Chen dc8b1623a2
feat(cookie): add feature support for cookie-secret-file (#3104)
* feat: add feature support for cookie-secret-file

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-Authored-By: Sandy Chen <Yuxuan.Chen@morganstanley.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-07-22 18:59:55 +02:00
Ashkan Daie 137e59d526
fix: regex substitution for $ signs in upstream path handling before running envsubst (#2524)
* Perform a regex replace of $NUM to $$NUM before running envsubst

* Perform a regex replace of $NUM to $$NUM before running envsubst

* add test case; fix linter warnings; add method documentation

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

* add changelog entry

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

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-07-22 08:52:23 +02:00
Conrad Hoffmann a88306be98
feat: add SourceHut (sr.ht) provider (#2359)
* Add SourceHut (sr.ht) provider

* fix changelog entry

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

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-07-22 08:16:32 +02:00
Jan Larwig b57c82181d
feat(cookie) csrf per request limit (#3134)
* Allow setting maximum number of csrf cookies, deleting the oldest if necessary

* Add a test for multiple CSRF cookies to remove the old cookie

* Add docs/changelog

* If limit is <=0 do not clear

Signed-off-by: test <bert@transtrend.com>

* Better docs

Co-authored-by: Jan Larwig <jan@larwig.com>

* direct check of option value

Co-authored-by: Jan Larwig <jan@larwig.com>

* direct use of option value

Co-authored-by: Jan Larwig <jan@larwig.com>

* sort based on clock compare vs time compare

Co-authored-by: Jan Larwig <jan@larwig.com>

* clock.Clock does not implement Compare, fix csrf cookie extraction after rename

Signed-off-by: Bert Helderman <bert@transtrend.com>

* Linter fix

* add method signature documentation and slight formatting

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

* fix: test case for csrf cookie limit and flag

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

---------

Signed-off-by: Bert Helderman <bert@transtrend.com>
Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: test <bert@transtrend.com>
Co-authored-by: bh-tt <71650427+bh-tt@users.noreply.github.com>
2025-07-20 16:44:42 +02:00
Daniel Givens 0e1dc9bb84
fix: return error for empty Redis URL list (#3101)
* fix: return error for empty Redis URL list

* add changelog entry

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

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-07-17 09:23:28 +02:00
Edward Viaene abb0a35bf3
feat: bump to go1.24.5 and full dependency update (#3116)
* upgrade to go1.24.5

dependency updates

lint fixes

chore(deps): upgrade github.com/spf13/viper to v1.20.1

Note that this upgrade also implied to upgrade github.com/mitchellh/mapstructure
(nowadays unmaintained: https://gist.github.com/mitchellh/90029601268e59a29e64e55bab1c5bdc)
to github.com/go-viper/mapstructure/v2.

fix: adapt tests to match mapstructure v2 error messages

pkg/apis/options/load_test.go: skip tests on Go 1.23

Add a compile guard for Go < 1.24 for the pkg/apis/options/load_test.go
because the LoadYAML test depends on error messages produced by
encoding/json that changed slightly (names of embedded structs are now
reported). As we updated the test for go1.24, the test now fails on
1.23, but just for a slight difference, so we disable the test there.

fix: adapt tests to match mapstructure v2 error messages

remove pre 1.24 disclaimer

add changelog entry

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

Co-Authored-By: Olivier Mengué <dolmen@cpan.org>

* add exclusion for 'avoid meaningless package names' in .golangci.yml

* chore(dep): upgrade all dependencies

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

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Olivier Mengué <dolmen@cpan.org>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-07-13 21:55:57 +02:00
Olivier Mengué 1225d611e9
chore(lint): fix staticcheck issues (#3061)
* chores: fix staticcheck QF1012

Fix use of fmt.Sprintf when writing to a writer.
https://staticcheck.dev/docs/checks/#QF1012
https://github.com/oauth2-proxy/oauth2-proxy/issues/3060

* chores: fix staticcheck QF1003

Use switch instead of multiple if/else.
https://staticcheck.dev/docs/checks/#QF1003
https://github.com/oauth2-proxy/oauth2-proxy/issues/3060

* chores: exclude staticcheck QF1008 for now

We aim to migrate golangci-lint to v2
Let's disable QF1008 (Omit embedded fields from selector expression)
for now.
https://staticcheck.dev/docs/checks/#QF1008

* chores: fix golangci config: run.deadline -> timeout

Rename config option to match v1 documentation: deadline -> timeout.
https://golangci.github.io/legacy-v1-doc/usage/configuration/#run-configuration

This error has been spotted by golangci-lint v2 migration tool.

* chores: fix staticcheck QF1012
2025-05-26 12:29:34 +02:00
Evan Carroll bae509d2ec
docs: clear up multiple-providers is unimplemented (#3046)
* docs: clear up multiple-providers is unimplemented

Currently this configuration option is held up by #926. So users don't
assume this solution will work for them, and later find the feature is
not yet implemented -- own the shortcoming clearly.

* doc: add note about missing multi provider implementation to versioned docs

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2025-04-28 23:52:27 +02:00
ikarius b7ff804506
feat: ability to parse JWT encoded profile claims (#3014)
* fix: parse JWT profile claims

* Comment with OIDC specs reference

* fix: formatting

* Updated changelog

---------

Co-authored-by: Jan Larwig <jan@larwig.com>
2025-04-28 16:39:09 +02:00
Justin Ryan 8abdbb5a18
Add --bearer-token-login-fallback option (#2924)
* add --deny-invalid-bearer-tokens

* update changelog

* PR feedback, update api-routes description

* update --api-routes description

* revert load_test fix that I needed locally

---------

Co-authored-by: Justin Ryan <j.ryan@mwam.com>
2025-04-21 13:40:39 +01:00
Michael Cornel f6b95c0df8
feat: allow to set non-default authorization request response mode (#3001)
* Update Go version in devcontainer

* Add option to change response mode in authorization request

* Fix option name

* Update docs and changelog

* Rename config value to underscore

* Add unit tests for added parameter

* Move change to upcoming release

* Generate alpha config

---------

Co-authored-by: Michael Cornel <michael@stieler.it>
2025-03-31 10:04:19 +02:00
Evan Gibler b2c69e25eb
feat: update HashNonce to use crypto/sha256 (#2967)
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
2025-03-25 21:12:37 +01:00
Olivier Mengué 8a8fcab580 deps: remove tools/reference-gen from go.mod
Remove github.com/oauth2-proxy/tools/reference-gen from dependencies.
Instead we are now running it with "go run" with a version suffix.

Long version:
- github.com/oauth2-proxy/tools/reference-gen is removed from
  tools/tool/go
- in pkg/apis/options/doc.go we now run reference-run with a version
  suffix (go run package@version) with the version comming from go.mod.
- the "//go:generate" line is split in 2 lines (using the -command
  flag) for readability
- "go mod tidy" for cleaning dependencies from go.mod, go.sum

Note: we are not upgrading reference-gen here. That will be a further
separate change.
2025-03-19 00:37:11 +01:00
Matthias Penner a393ea3ca0 pkg/cookies: use 'Max-Age' instead of 'Expires' for cookie expiration 2025-02-24 11:14:51 +01:00