Commit Graph

1204 Commits

Author SHA1 Message Date
Nick Meves 514db45d1a
Allow OIDC Bearer Tokens without emails
This reverts to functionality before #499 where an OIDC
provider could be used with `--skip-jwt-bearer-tokens` and
tokens without an email or profileURL would still be valid.
This logic mirrors `middleware.createSessionStateFromBearerToken`
which used to be the universal logic before #499.
2020-08-14 13:31:38 -07:00
Joel Speed 8515da3e91
Merge pull request #714 from grnhse/redis-sentinel-password
Support Password & SentinelPassword in Redis session store
2020-08-14 14:09:54 +01:00
Nick Meves 51a9062044
Support Password & SentinelPassword in Redis session store 2020-08-11 12:22:05 -07:00
Nick Meves 35ed7a313b
Merge pull request #719 from grnhse/gosec-x-oauth-basic-skip
Add `x-oauth-basic` nosec annotation & address gosec unhandled errors
2020-08-11 11:56:07 -07:00
Nick Meves b6e78efc1e
Add `x-oauth-basic` nosec annotation & address gosec unhandled errors 2020-08-10 15:15:16 -07:00
Phil Taprogge d69fd6af22
Allow Logging to stdout with separate Error Log Channel (#718)
* Add dedicated error logging writer

* Document new errors to stdout flag

* Update changelog

* Thread-safe the log buffer

* Address feedback

* Remove duplication by adding log level

* Clean up error formatting

* Apply suggestions from code review

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-08-10 11:44:08 +01:00
Nick Meves 33e04cc52f
Merge pull request #690 from grnhse/gosec-findings-fixes
Address gosec findings
2020-08-09 08:24:37 -07:00
Nick Meves a1358d2070
Panic on any logger errors
Any template errors instead of IO
errors are caught in validation.
2020-08-09 07:55:41 -07:00
Nick Meves e88d29f16a
Refactor SignInMessage out of main 2020-08-09 07:55:41 -07:00
Nick Meves 46cc21d8cf
Skip gosec linting on tests 2020-08-09 07:55:41 -07:00
Nick Meves 45222395e0
Attempt to log still on template errors 2020-08-09 07:55:40 -07:00
Nick Meves 542bf1fad1
Add gosec to .golangci.yml 2020-08-09 07:55:40 -07:00
Nick Meves ad52587ae6
Document GoSec nosec skip comments 2020-08-09 07:55:40 -07:00
Nick Meves 2bb0160bf3
Streamline error page usage 2020-08-09 07:55:40 -07:00
Nick Meves 1c8c5b08d7
Handle cookie signing errors 2020-08-09 07:55:40 -07:00
Nick Meves 65c228394f
Address gosec findings
Mostly handling unhandled errors appropriately.
If logging to STDERR fails, we panic. Added #nosec
comments to findings we are OK with.
2020-08-09 07:55:39 -07:00
Joel Speed 7b21f53aad
Merge pull request #689 from grnhse/finicky-logging-time-test
Fix time issue causing finicky failures in logging tests
2020-08-07 08:32:17 +01:00
Nick Meves 81ec9edf53
Fix time issue causing finicky failures in logging tests 2020-08-06 15:44:05 -07:00
Nick Meves 0cf0fd88e8
Merge pull request #710 from ryandesign/patch-1
Fix typos and other minor edits
2020-08-04 07:58:53 -07:00
Ryan Schmidt 6e31eb28d5
Fix typos and other minor edits 2020-08-04 01:29:00 -05:00
Joel Speed bbf00bc92b
Merge pull request #701 from jhutchings1/patch-1
Add pull request events to CodeQL action
2020-07-29 12:23:08 +01:00
Justin Hutchings 43189a7854
Add pull request events to CodeQL action
This will validate pull requests from forks to ensure that changes don't end up impacting you negatively.
2020-07-28 21:42:21 -07:00
Joel Speed 2318716a89
Merge pull request #699 from grnhse/refactor-persistence-tests
Align persistence ginkgo tests to conventions
2020-07-22 11:23:49 +01:00
Nick Meves 19836f85ac
Align persistence ginkgo tests to conventions 2020-07-21 22:13:17 -07:00
Andy Voltz 88ef888752
Preserve query when building redirect (fix for #695) (#696)
* Add test for GetRedirect to check query and fragments.

* Preserve query and fragment when building redirect.

* Add changelog entry for redirect fix
2020-07-21 16:38:13 +01:00
Joel Speed c5da3dff9c
Merge pull request #561 from oauth2-proxy/provider-urls-refactor
Move provider URLs to package level vars
2020-07-20 11:50:47 +01:00
Nick Meves 9643a0b10c
Centralize Ticket management of persistent stores (#682)
* Centralize Ticket management of persistent stores

persistence package with Manager & Ticket will handle
all the details about keys, secrets, ticket into cookies,
etc. Persistent stores just need to pass Save, Load &
Clear function handles to the persistent manager now.

* Shift to persistence.Manager wrapping a persistence.Store

* Break up the Redis client builder logic

* Move error messages to Store from Manager

* Convert ticket to private for Manager use only

* Add persistence Manager & ticket tests

* Make a custom MockStore that handles time FastForwards
2020-07-19 21:25:13 +01:00
Joel Speed f141f7cea0
Merge pull request #688 from oauth2-proxy/session-middlewares
Refactor session loading to make use of middleware pattern
2020-07-19 20:40:17 +01:00
Joel Speed 1aac37d2b1
Merge pull request #593 from oauth2-proxy/proxy-refactor
Integrate upstream package with OAuth2 Proxy
2020-07-19 20:10:56 +01:00
Joel Speed d4dd34a65a
Move provider URLs to package level vars 2020-07-19 18:34:55 +01:00
Joel Speed 3f00143175
Add changelog entry for session middleware refactor 2020-07-19 17:24:58 +01:00
Joel Speed eb234011eb
Integrate sessions middlewares 2020-07-19 17:24:12 +01:00
Joel Speed 034f057b60
Add session loader from session storage 2020-07-19 17:21:42 +01:00
Joel Speed 7d6f2a3f45
Add Basic Auth session loader middleware 2020-07-19 17:21:42 +01:00
Joel Speed c81a7ed197
Add JWT session loader middleware 2020-07-19 17:21:42 +01:00
Joel Speed 2768321929
Add request scope middleware 2020-07-19 17:21:42 +01:00
Joel Speed d43b372ca9
Use bool pointers for upstream options that default to true 2020-07-19 14:01:36 +01:00
Joel Speed 6b27069812
Add changelog entry for integrating new upstream proxy 2020-07-19 14:01:36 +01:00
Joel Speed 71dc70222b
Break legacy upstream options into LegacyUpstreams struct 2020-07-19 14:01:36 +01:00
Joel Speed 5dbcd73722
Configure OAuth2 Proxy to use new upstreams package and LegacyConfig 2020-07-19 08:17:53 +01:00
Joel Speed e932381ba7
Add LegacyOptions and conversion to new Options
This will be temporary until we switch to structured config, then we can remove the LegacyOptions and conversions
2020-07-19 08:17:53 +01:00
Joel Speed e02f99eb58
Merge pull request #687 from oauth2-proxy/htpasswd-validator
Refactor HTPasswd Validator
2020-07-18 17:29:50 +01:00
Joel Speed e73db7df7b
Add HTPasswd validator refactor to changelog 2020-07-18 11:01:49 +01:00
Joel Speed 2981a5ed1a
Integrate HTPasswdValidator into OAuth2 Proxy 2020-07-18 11:01:49 +01:00
Joel Speed 7d8ee61254
Add HTPasswdValidator to basic authentication package 2020-07-18 11:01:49 +01:00
devopsix 895403cb9b
Document what provider have support for --cookie-refresh. (#543)
Co-authored-by: Dirk Weinhardt <dirk.weinhardt@etl.de>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-07-15 00:05:13 +01:00
Nick Meves abeb0236d8
Strip X-Forwarded auth headers from whitelisted paths (#624)
* Strip X-Forwarded auth headers from whitelisted paths

For any paths that match skip-auth-regex, strip normal
X-Forwarded headers that would be sent based on pass-user-headers
or pass-access-token settings. This prevents malicious injecting
of authentication headers through the skip-auth-regex paths in
cases where the regex might be misconfigured and too open.
Control this behavior with --skip-auth-strip-headers flag. This
flag is set to TRUE by default (this is secure by default, but
potentially breaks some legacy configurations).

Only x-Forwarded headers stripped, left the Authorization header
untouched.

* Strip authorization header if it would be set

* Improve TestStripAuthHeaders test table

* Improve --skip-auth-strip-headers flag documentation
2020-07-14 23:46:44 +01:00
Nick Meves bb5977095f
Add option to remove tokens from cookie sessions (#673)
* Add option to remove tokens from cookie sessions

* Move Minimal to be an option on CookieSession

* Add sessionOptionsDefaults helper
2020-07-14 23:02:10 +01:00
Nick Meves a09eecc6a2
Reduce SessionState size better with MessagePack + LZ4 (#632)
* Encode sessions with MsgPack + LZ4

Assumes ciphers are now mandatory per #414. Cookie & Redis sessions
can fallback to V5 style JSON in error cases. TODO: session_state.go
unit tests & new unit tests for Legacy fallback scenarios.

* Only compress encoded sessions with Cookie Store

* Cleanup msgpack + lz4 error handling

* Change NewBase64Cipher to take in an existing Cipher

* Add msgpack & lz4 session state tests

* Add required options for oauthproxy tests

More aggressively assert.NoError on all
validation.Validate(opts) calls to enforce legal
options in all our tests.
Add additional NoError checks wherever error return
values were ignored.

* Remove support for uncompressed session state fields

* Improve error verbosity & add session state tests

* Ensure all marshalled sessions are valid

Invalid CFB decryptions can result in garbage data
that 1/100 times might cause message pack unmarshal
to not fail and instead return an empty session.
This adds more rigor to make sure legacy sessions
cause appropriate errors.

* Add tests for legacy V5 session decoding

Refactor common legacy JSON test cases to a
legacy helpers area under session store tests.

* Make ValidateSession a struct method & add CHANGELOG entry

* Improve SessionState error & comments verbosity

* Move legacy session test helpers to sessions pkg

Placing these helpers under the sessions pkg removed
all the circular import uses in housing it under the
session store area.

* Improve SignatureAuthenticator test helper formatting

* Make redis.legacyV5DecodeSession internal

* Make LegacyV5TestCase test table public for linter
2020-07-13 20:56:05 +01:00
mkontani dd36138965
docs: Fix required ruby-version (#675)
* fix required ruby-version

Signed-off-by: mkontani <itoama@live.jp>

* add a changelog entry

Signed-off-by: mkontani <itoama@live.jp>

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
2020-07-12 16:09:34 +01:00