Commit graph

42 commits

Author SHA1 Message Date
Caleb Doxsey
a1eb75a8fe
add support for pomerium.request.headers for set_request_headers (#5563)
* add support for pomerium.request.headers for set_request_headers

* add peg grammar
2025-04-07 10:32:03 -06: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
Kenneth Jenkins
b0f89fc688
authorize: log JWT groups filtering (#5432)
Add a new Authorize Log Fields option for logging the number of groups
removed during JWT groups filtering. This will be enabled by default.

Additionally, when the log level is Debug (or more verbose), store and
log the IDs of any groups removed during JWT groups filtering.
2025-01-27 12:11:52 -08:00
Kenneth Jenkins
e9786f9719
authorize: filter only by group ID (#5437)
Change the JWT groups filtering behavior:
- to filter only by group ID (not group name)
- and only for groups sourced from directory sync (groups from a 
  "groups" claim will not be filtered)

This avoids the need to fetch all group names up front, which should 
improve performance in specific circumstances.
2025-01-24 14:43:45 -08: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
Caleb Doxsey
fb7b61a677
cleanup headers (#5408)
* cleanup headers

* return issuer format errors

* go mod
2025-01-06 09:52:29 -07:00
Kenneth Jenkins
683c5a2eac
authorize: change handling of empty groups claim (#5394)
Make sure to serialize the JWT "groups" claim as an empty list rather
than a JSON null. This matches the behavior of Pomerium v0.27.2 and
earlier, and should provide better compatibility with some third-party
libraries.
2024-12-11 12:55:04 -08:00
Caleb Doxsey
37017e2a5b
authorize: rewrite header evaluator to use go instead of rego (#5362)
* authorize: rewrite header evaluator to use go instead of rego

* cache signed jwt

* re-add missing trace

* address comments
2024-11-07 13:07:16 -07:00
Caleb Doxsey
ef12fda55c
authorize: additional header evaluator tests (#5363)
* authorize: additional header evaluator tests

* add groups to jwt test
2024-11-07 09:22:35 -07:00
Joe Kralicky
4f0ff35b4c
Decouple audience claim value from issuer format (#5345) 2024-10-25 16:21:19 -04:00
Joe Kralicky
e1880ba20f
Add new request header variable 'pomerium.jwt' (#5339) 2024-10-25 14:35:42 -04:00
Joe Kralicky
a42e286637
Add new jwt issuer format route option (#5338) 2024-10-25 13:07:47 -04:00
Caleb Doxsey
27947b19cb
core/config: add kubernetes_service_account_token_file (#5322)
* core/config: add kubernetes_service_account_token_file

* fix loading of token file
2024-10-10 14:53:45 -06:00
Kenneth Jenkins
dbedfc586f
add mTLS UserPrincipalName SAN match (#5177)
Add a new 'user_principal_name' type to the downstream mTLS
match_subject_alt_names option. This corresponds to the 'OtherName' type
with type-id 1.3.6.1.4.1.311.20.2.3 and a UTF8String value.
Add support for UserPrincipalName SAN matching to the policy evaluator.
2024-07-26 10:23:19 -07:00
Caleb Doxsey
d55cb097cc
core/ui: add user info link (#5158)
* core/ui: add user info link

* open in new window

* fix header test
2024-06-28 14:07:24 -06:00
Caleb Doxsey
bf1d228131
core/authorize: use uuid for jti, current time for iat and exp (#5147)
* core/authorize: use uuid for jti, current time for iat and exp

* exclude the jtis

* Update authorize/evaluator/headers_evaluator_test.go

Co-authored-by: Kenneth Jenkins <51246568+kenjenkins@users.noreply.github.com>

---------

Co-authored-by: Kenneth Jenkins <51246568+kenjenkins@users.noreply.github.com>
2024-06-25 11:31:00 -06:00
Caleb Doxsey
1a5b8b606f
core/lint: upgrade golangci-lint, replace interface{} with any (#5099)
* core/lint: upgrade golangci-lint, replace interface{} with any

* regen proto
2024-05-02 14:33:52 -06:00
Caleb Doxsey
8b3a79152b
core/kubernetes: fix impersonate group header (#5090)
* core/kubernetes: fix impersonate group header

* formatting
2024-04-26 15:26:41 -06:00
Kenneth Jenkins
fd84075af1
config: remove set_authorization_header option (#4489)
Remove the deprecated set_authorization_header option entirely. Add an
entry to the removedConfigFields map with a link to the relevant
Upgrading page section.
2023-08-29 09:02:08 -07:00
Kenneth Jenkins
e8b489eb87
authorize: rework token substitution in headers (#4456)
Currently Pomerium replaces dynamic set_request_headers tokens
sequentially. As a result, if a replacement value itself contained a
supported "$pomerium" token, Pomerium may treat that as another
replacement, resulting in incorrect output.

This is unlikely to be a problem given the current set of dynamic
tokens, but if we continue to add additional tokens, this will likely
become more of a concern.

To forestall any issues, let's perform all replacements in one pass,
using the os.Expand() method. This does require a slight change to the
syntax, as tokens containing a '.' will need to be wrapped in curly
braces, e.g. ${pomerium.id_token}.

A literal dollar sign can be included by using $$ in the input.
2023-08-14 15:28:10 -07:00
Kenneth Jenkins
5568606f03
config: support client certificate SAN match (#4453)
Add a new match_subject_alt_names option to the downstream_mtls settings
group. This setting can be used to further constrain the allowed client
certificates by requiring that certificates contain a Subject
Alternative Name of a particular type, matching a particular regex.

When set, populate the corresponding match_typed_subject_alt_names
setting within Envoy, and also implement a corresponding check in the
authorize service.
2023-08-11 13:27:12 -07:00
Kenneth Jenkins
0fcc3f16de
authorize: allow client certificate intermediates (#4451)
Update the isValidClientCertificate() method to consider any
client-supplied intermediate certificates. Previously, in order to trust
client certificates issued by an intermediate CA, users would need to
include that intermediate CA's certificate directly in the client_ca
setting. After this change, only the trusted root CA needs to be set: as
long as the client can supply a set of certificates that chain back to
this trusted root, the client's certificate will validate successfully.

Rework the previous CRL checking logic to now consider CRLs for all
issuers in the verified chains.
2023-08-10 09:33:29 -07:00
Kenneth Jenkins
f7e0b61c03
authorize: client cert fingerprint in set_request_headers (#4447)
Add support for a new token $pomerium.client_cert_fingerprint in the
set_request_headers option. This token will be replaced with the SHA-256
hash of the presented leaf client certificate.
2023-08-09 08:34:51 -07:00
Kenneth Jenkins
74e648630f
authorize: remove JWT timestamp format workaround (#4321)
Update OPA to v0.54.0, which changes the JSON serialization behavior for
large integers. Remove the formatting workaround and the unit test that
verified that the workaround was still needed.
2023-06-30 11:54:46 -07:00
Kenneth Jenkins
e7703a1891
add JWT timestamp formatting workaround (#4270)
Rego will sometimes serialize integers to JSON with a decimal point and
exponent. I don't completely understand this behavior.

Add a workaround to headers.rego to convert the JWT "iat" and "exp"
timestamps to a string and back to an integer. This appears to cause
Rego to serialize these values as plain integers.

Add a unit test to verify this behavior. Also add a unit test that will
fail if the Rego behavior changes, making this workaround unnecessary.
2023-06-16 10:36:00 -07:00
Caleb Doxsey
5be322e2ef
config: add support for $pomerium.id_token and $pomerium.access_token in set_request_headers (#4219)
* config: add support for $pomerium.id_token and $pomerium.access_token in set_request_headers

* lint

* Update authorize/evaluator/headers_evaluator_test.go

Co-authored-by: Denis Mishin <dmishin@pomerium.com>

* fix spelling

---------

Co-authored-by: Denis Mishin <dmishin@pomerium.com>
2023-06-01 16:00:02 -06:00
Kenneth Jenkins
6df4fba832
authorize: populate issuer even when policy is nil (#4211) 2023-05-30 17:07:27 -07:00
Caleb Doxsey
18bc86d632
config: add support for wildcard from addresses (#4131)
* config: add support for wildcards

* update policy matching, header generation

* remove deprecated field

* fix test
2023-04-25 13:34:38 -06:00
Caleb Doxsey
1dee325b72
authorize: move sign out and jwks urls to route, update issuer for JWT (#4046)
* authorize: move sign out and jwks urls to route, update issuer for JWT

* fix test
2023-03-08 12:40:15 -07:00
Caleb Doxsey
c178819875
move directory providers (#3633)
* remove directory providers and support for groups

* idp: remove directory providers

* better error messages

* fix errors

* restore postgres

* fix test
2022-11-03 11:33:56 -06:00
Caleb Doxsey
f61e7efe73
authorize: use query instead of sync for databroker data (#3377) 2022-06-01 15:40:07 -06:00
Caleb Doxsey
c19048649a
authorize: add support for cidr lookups (#3277) 2022-04-19 16:18:34 -06:00
Caleb Doxsey
d299b42509
authorize: add name claim (#3238) 2022-04-05 12:08:00 -06:00
Caleb Doxsey
99b9a3ee12
authorize: add support for passing access or id token upstream (#3047)
* authorize: add support for passing access or id token upstream

* use an enum
2022-02-17 09:28:31 -07:00
Caleb Doxsey
0786c7fc45
authorize: use session.user_id in headers (#2571) 2021-09-03 14:51:09 -06:00
Caleb Doxsey
33f5190572
config: remove signature_key_algorithm (#2557)
* config: remove signature_key_algorithm

* typo

* add more tests
2021-09-02 11:36:43 -06:00
Caleb Doxsey
de1ed61b9a
authorize: fix google cloudrun header audience (#2558) 2021-09-02 09:55:06 -06:00
Caleb Doxsey
ef55829cb0
authorize: fix X-Pomerium-Claim-Groups (#2539) 2021-08-26 20:29:57 -06:00
Caleb Doxsey
a64e5b5fa1
authorize: add sid to JWT claims (#2420)
* authorize: add sid to JWT claims

* fix import ordering
2021-08-02 16:11:05 -06:00
Caleb Doxsey
f9675f61cc
deps: upgrade to go-jose v3 (#2284) 2021-06-10 09:35:44 -06:00
wasaga
40ddc2c4b3
jwt: round timestamp (#2258) 2021-06-01 14:12:45 -07:00
Caleb Doxsey
dad35bcfb0
ppl: refactor authorize to evaluate PPL (#2224)
* ppl: refactor authorize to evaluate PPL

* remove opa test step

* add log statement

* simplify assignment

* deny with forbidden if logged in

* add safeEval function

* create evaluator-specific config and options

* embed the headers rego file directly
2021-05-21 09:50:18 -06:00