Commit graph

458 commits

Author SHA1 Message Date
Caleb Doxsey
d6b02441b3
authorize: return 403 on invalid sessions (#5536) 2025-03-19 14:41:28 -06:00
Caleb Doxsey
4c9398e95b
config: fix layered bearer_token_format and idp_access_token_allowed_audiences (#5533) 2025-03-19 10:04:48 -06:00
Denis Mishin
5ef16bcd28
metrics: reduce gc pressure (#5530) 2025-03-18 13:48:49 -04:00
Kenneth Jenkins
562101ae03
remove the legacy identity manager (#5528) 2025-03-17 11:59:02 -07:00
Denis Mishin
c4a5502f49
websockets: disable http2 connect (#5516) 2025-03-13 09:46:08 -04:00
Kenneth Jenkins
e1eca4e97c
config: fix jwt_issuer_format conversion (#5524)
Remove the previous conversion logic in NewPolicyFromProto() for the 
jwt_issuer_format field. This would prevent the new "unset" state from
working correctly. Add a unit test to verify that all three values
(unset, "hostOnly" and "uri") will successfully round trip to the proto
format and back again.

Also add a test case for the Options.ApplySettings() method to verify 
that an unset jwt_issuer_format will not overwrite the existing value
(if any) in the settings.
2025-03-12 16:13:16 -07:00
Kenneth Jenkins
ad183873f4
add global jwt_issuer_format option (#5508)
Add a corresponding global setting for the existing route-level
jwt_issuer_format option. The route-level option will take precedence
when set to a non-empty string.
2025-03-11 14:11:50 -07:00
Caleb Doxsey
c280119498
policy: support emails from directory user (#5504) 2025-02-27 13:39:28 -07:00
Caleb Doxsey
cb5ee48323
config: preserve existing user when creating sessions from idp token (#5502)
* config: preserve existing user when creating sessions from idp token

* fix
2025-02-27 09:05:31 -07:00
Caleb Doxsey
1f30dead31
fileutil: reimplement file watcher (#5498)
* remove context, add close

* update tests

* cleanup

* fileutil: reimplement file watcher

* remove test, simplify tree set code, fix data race
2025-02-26 09:21:06 -07:00
Caleb Doxsey
a9e26b155d
identity: disable session refresh for idp token sessions, fix query cache invalidation (#5495) 2025-02-24 15:33:23 -07:00
Caleb Doxsey
f15400493d
singleflight incoming idp token session creation (#5491) 2025-02-24 08:24:57 -07:00
Caleb Doxsey
fbd1f34110
fileutil: add directory helpers, atomic file writing (#5477) 2025-02-19 07:56:38 -07:00
Caleb Doxsey
b9fd926618
authorize: support authenticating with idp tokens (#5484)
* identity: add support for verifying access and identity tokens

* allow overriding with policy option

* authenticate: add verify endpoints

* wip

* implement session creation

* add verify test

* implement idp token login

* fix tests

* add pr permission

* make session ids route-specific

* rename method

* add test

* add access token test

* test for newUserFromIDPClaims

* more tests

* make the session id per-idp

* use type for

* add test

* remove nil checks
2025-02-18 13:02:06 -07:00
Joe Kralicky
81a52db749
tracing: add missing check for otel_exporter_otlp_endpoint in envoy trace config (#5472)
add missing check for otel_exporter_otlp_endpoint in envoy trace config
2025-02-04 13:29:06 -05:00
Kenneth Jenkins
efe3cef2e4
config: escape % signs in local reply format string (#5460)
Since v0.26, Pomerium configures Envoy to use a custom HTML error page
format string for most errors served by Envoy itself. This format string
uses %COMMAND% directives to include details about the error.

The HTML error page template also includes any branding options set via
the corresponding Enterprise settings. We need to ensure that any %
signs in the branding options strings are escaped to %% so that Envoy
will not interpret them as the start of a %COMMAND% directive, which
could lead to Envoy rejecting the format string as invalid.
2025-02-03 14:31:06 -08:00
Caleb Doxsey
1e9a09269b
config: add support for http3 advertise port (#5466) 2025-02-03 13:58:57 -07:00
Caleb Doxsey
2754d20a2d
config: handle SIGHUP (#5459) 2025-01-31 18:31:47 -07:00
Caleb Doxsey
dc9a6bdb81
replace xxhash with xxh3 (#5457)
* update config file paths hash

* update filemgr

* use xxh3 for hashutil.Hash

* update hashutil digest, fix trace buffer test

* update comments

* update namegen, go mod tidy
2025-01-31 08:44:08 -07:00
Joe Kralicky
5e94b2f8f1
Refactor trace config to match supported otel options (#5447)
* Refactor trace config to match supported otel options

* use duration instead of int64 for otel timeouts

* change 'trace client updated' log level to debug
2025-01-30 11:59:19 -05:00
Joe Kralicky
6ea51149f9
tracing: adjust envoy otel trace batching settings to match go sdk (#5446) 2025-01-24 14:51:07 -05:00
Joe Kralicky
396c35b6b4
New tracing system (#5388)
* update tracing config definitions

* new tracing system

* performance improvements

* only configure tracing in envoy if it is enabled in pomerium

* [tracing] refactor to use custom extension for trace id editing (#5420)

refactor to use custom extension for trace id editing

* set default tracing sample rate to 1.0

* fix proxy service http middleware

* improve some existing auth related traces

* test fixes

* bump envoyproxy/go-control-plane

* code cleanup

* test fixes

* Fix missing spans for well-known endpoints

* import extension apis from pomerium/envoy-custom
2025-01-21 13:26:32 -05:00
Kenneth Jenkins
832742648d
config: add new OTLP tracing fields (#5421)
Add new tracing options fields to the Settings proto and Options struct.

Co-authored-by: Joe Kralicky <joekralicky@gmail.com>
2025-01-17 14:56:42 -08:00
Kenneth Jenkins
3a2e6ce10a
config: fix JWT groups filter option (#5429)
When applying the settings proto, update the JWT groups filter option
only if the filter set is non-empty.

This is important when deploying Pomerium via the Ingress Controller in
combination with Pomerium Enterprise. In this scenario there is a
settings proto applied from both Ingress Controller and the Enterprise
console, and we want to make sure the one from Ingress Controller does
not overwrite the filter settings from Enterprise.
2025-01-16 08:53:06 -08:00
Caleb Doxsey
8bc86fe06f
config: add route name, description and logo (#5424)
* config: add route name, description and logo

* remove name generation
2025-01-14 14:55:14 -07:00
Joe Kralicky
dfd2457bb6
envoy: add internal_address_config to address deprecation warning (#5425) 2025-01-14 16:51:04 -05:00
Caleb Doxsey
5ff53ef2b1
importutil: refactor GenerateRouteNames to allow for protobuf or config routes (#5427)
* importutil: refactor GenerateRouteNames to allow for protobuf or config routes

* test via NewPolicyFromProto
2025-01-14 14:50:00 -07:00
Joe Kralicky
e5ede2d167
remove test code from config/options_test.go (#5423) 2025-01-14 14:00:38 -05:00
Joe Kralicky
6502d68162
config: set default tracing sample rate to 1.0 (#5422)
The previous default sample rate of 0.0001 is very low, so traces are
unlikely to be visible after enabling them until many thousands of
requests have been sent. This could be confusing to users.
2025-01-14 13:50:22 -05:00
Caleb Doxsey
c571769adc
config: add source ppl field (#5419) 2025-01-14 10:13:56 -07:00
Kenneth Jenkins
21b9e7890c
authorize: add filter options for JWT groups (#5417)
Add a new option for filtering to a subset of directory groups in the
Pomerium JWT and Impersonate-Group headers. Add a JWTGroupsFilter field
to both the Options struct (for a global filter) and to the Policy
struct (for per-route filter). These will be populated only from the
config protos, and not from a config file.

If either filter is set, then for each of a user's groups, the group
name or group ID will be added to the JWT groups claim only if it is an
exact string match with one of the elements of either filter.
2025-01-08 13:57:57 -08:00
Kenneth Jenkins
04585af9ef
config: generate fallback cert only as last resort (#5250)
Currently Pomerium will always generate a wildcard certificate for use 
as a fallback certificate.

If any other certificate is configured, this fallback certificate will 
not normally be presented, except in the case of a TLS connection where 
the client does not include the Server Name Indication (SNI) extension.
All modern browsers support SNI, so in practice this certificate should
never be presented to end users.

However, some network scanning tools will probe connections by IP 
addresses (without SNI), and so this fallback certificate may be
presented. The presence of this certificate may be flagged as a problem
in some automated vulnerability scans.

Let's avoid generating this fallback certificate if Pomerium has any 
other certificate configured (unless specifically requested by the Auto
TLS option). This should prevent false positive reports from these
particular vulnerability scans.
2024-12-19 09:46:59 -08:00
Caleb Doxsey
4a5b737763
config: fix lost branding settings when there are multiple configuration sources (#5401) 2024-12-19 08:47:28 -07:00
Kenneth Jenkins
84da474816
config: minor cleanup in GenerateCatchAllCertificate (#5397)
GenerateCatchAllCertificate() appears to return the same result whether
or not DeriveInternalDomainCert is nil. Let's remove this conditional.
2024-12-18 13:21:48 -08:00
Caleb Doxsey
71bcb4f28e
UDP support (#5390) 2024-12-11 13:07:31 -07:00
Caleb Doxsey
f426403bcb
envoy: enable extended connect (#5387)
* envoy: enable extended connect

* add explicit connect

* update config
2024-12-04 14:54:27 -07:00
Denis Mishin
2bb70258c3
authorize/log: remove audit logging (#5369) 2024-11-22 14:32:52 -05:00
Caleb Doxsey
5d69b925be
HTTP/3 Support (#5349)
* wip

* http3 support

* add integration test

* move some quic code

* fix codec type

* casing

* add alt-svc header

* add quic unit test
2024-11-19 08:48:30 -07:00
Caleb Doxsey
20a9be891f
envoyconfig: cleanup (#5350)
* envoyconfig: cleanup

* remove listener access log for mtls for insecure server which can't use mtls

* use new functions

* rename method

* refactor common code
2024-11-18 09:50:23 -07:00
Joe Kralicky
177f789e63
change Policy.Matches to accept a URL pointer (#5360) 2024-11-07 14:55:44 -05:00
Joe Kralicky
ebd9eea30e
Optimize Policy RouteID (#5359) 2024-11-06 12:31:52 -05:00
Joe Kralicky
c8b6b8f1a9
config: only validate redirect response code when non-nil (#5358)
* config: only validate redirect response code when non-nil

* update unit tests

---------

Co-authored-by: Kenneth Jenkins <51246568+kenjenkins@users.noreply.github.com>
2024-11-05 15:57:59 -05:00
Joe Kralicky
526e2a58d6
New integration test fixtures (#5233)
* Initial test environment implementation

* linter pass

* wip: update request latency test

* bugfixes

* Fix logic race in envoy process monitor when canceling context

* skip tests using test environment on non-linux
2024-11-05 14:31:40 -05:00
Kenneth Jenkins
3d958ff9c5
config: fix redirect response code (#5346) 2024-11-05 10:38:02 -08:00
Joe Kralicky
fe31799eb5
Fix many instances of contexts and loggers not being propagated (#5340)
This also replaces instances where we manually write "return ctx.Err()"
with "return context.Cause(ctx)" which is functionally identical, but
will also correctly propagate cause errors if present.
2024-10-25 14:50:56 -04:00
Joe Kralicky
a42e286637
Add new jwt issuer format route option (#5338) 2024-10-25 13:07:47 -04:00
Caleb Doxsey
9e9ed8853f
ppl: more flexible matchers (#5336)
* ppl: more flexible matchers

* make the string list matcher "is" match arrays with only a single item

* re-use has

* default list matcher to has
2024-10-25 07:56:57 -06:00
Caleb Doxsey
d2c14cd6d2
logging: remove ctx from global log methods (#5337)
* log: remove warn

* log: update debug

* log: update info

* remove level, log

* remove contextLogger function
2024-10-23 14:18:52 -06:00
Joe Kralicky
1ccaf1b22b
config: suppress unused warnings for all fields in embedded route envoy options (#5330) 2024-10-22 16:46:22 -04:00
Kenneth Jenkins
11054a943d
config: set_response_headers is not unknown (#5326)
Most fields in the config.Options struct are populated by the
mapstructure package, but the SetResponseHeaders field is handled
separately. As a result, when the set_response_headers key is present,
it also shows up as an unknown config option.

Add this key to the ignoreConfigFields map, to avoid logging an
incorrect "unknown config option" message when set.
2024-10-15 12:40:14 -07:00