zitadel/internal/api/grpc/admin
Livio Spring 3d071fc505
feat: trusted (instance) domains (#8369)
# Which Problems Are Solved

ZITADEL currently selects the instance context based on a HTTP header
(see https://github.com/zitadel/zitadel/issues/8279#issue-2399959845 and
checks it against the list of instance domains. Let's call it instance
or API domain.
For any context based URL (e.g. OAuth, OIDC, SAML endpoints, links in
emails, ...) the requested domain (instance domain) will be used. Let's
call it the public domain.
In cases of proxied setups, all exposed domains (public domains) require
the domain to be managed as instance domain.
This can either be done using the "ExternalDomain" in the runtime config
or via system API, which requires a validation through CustomerPortal on
zitadel.cloud.

# How the Problems Are Solved

- Two new headers / header list are added:
- `InstanceHostHeaders`: an ordered list (first sent wins), which will
be used to match the instance.
(For backward compatibility: the `HTTP1HostHeader`, `HTTP2HostHeader`
and `forwarded`, `x-forwarded-for`, `x-forwarded-host` are checked
afterwards as well)
- `PublicHostHeaders`: an ordered list (first sent wins), which will be
used as public host / domain. This will be checked against a list of
trusted domains on the instance.
- The middleware intercepts all requests to the API and passes a
`DomainCtx` object with the hosts and protocol into the context
(previously only a computed `origin` was passed)
- HTTP / GRPC server do not longer try to match the headers to instances
themself, but use the passed `http.DomainContext` in their interceptors.
- The `RequestedHost` and `RequestedDomain` from authz.Instance are
removed in favor of the `http.DomainContext`
- When authenticating to or signing out from Console UI, the current
`http.DomainContext(ctx).Origin` (already checked by instance
interceptor for validity) is used to compute and dynamically add a
`redirect_uri` and `post_logout_redirect_uri`.
- Gateway passes all configured host headers (previously only did
`x-zitadel-*`)
- Admin API allows to manage trusted domain

# Additional Changes

None

# Additional Context

- part of #8279 
- open topics: 
  - "single-instance" mode
  - Console UI
2024-07-31 18:00:38 +03:00
..
custom_text_converter.go feat(idp): provide option to auto link user (#7734) 2024-04-10 15:46:30 +00:00
custom_text.go feat: SMS and email OTP texts (#6281) 2023-08-09 05:49:12 +00:00
domain_policy.go fix: handle UserLoginMustBeDomain changes correctly (#4765) 2022-12-06 09:01:31 +01:00
event_test.go fix(ListEvents): add aggregate types to filter if not set (#7490) 2024-03-05 15:44:51 +00:00
event.go fix(ListEvents): add aggregate types to filter if not set (#7490) 2024-03-05 15:44:51 +00:00
export.go feat(cnsl): docs link can be customized and custom button is available (#7840) 2024-05-13 16:01:50 +02:00
failed_event_converter.go feat(eventstore): increase parallel write capabilities (#5940) 2023-10-19 12:19:10 +02:00
failed_event.go feat(eventstore): increase parallel write capabilities (#5940) 2023-10-19 12:19:10 +02:00
feature.go perf(oidc): optimize token creation (#7822) 2024-05-16 07:07:56 +02:00
iam_member_converter_test.go remove negated integration tags 2023-04-26 19:55:13 +03:00
iam_member_converter.go chore(v2): move to new org (#3499) 2022-04-26 23:01:45 +00:00
iam_member_integration_test.go refactor(fmt): run gci on complete project (#7557) 2024-04-03 10:43:43 +00:00
iam_member.go perf: remove owner removed columns from projections for oidc (#6925) 2023-11-20 17:21:08 +02:00
iam_settings_converter.go feat(console): add new step to activate SMTP provider (#7956) 2024-05-22 11:23:35 +02:00
iam_settings_integration_test.go feat(oidc): token exchange impersonation (#7516) 2024-03-20 10:18:46 +00:00
iam_settings.go feat: SMTP Templates (#6932) 2024-04-11 09:16:10 +02:00
idp_converter_test.go remove negated integration tags 2023-04-26 19:55:13 +03:00
idp_converter.go feat(saml): allow setting nameid-format and alternative mapping for transient format (#7979) 2024-05-23 05:04:07 +00:00
idp.go feat(eventstore): increase parallel write capabilities (#5940) 2023-10-19 12:19:10 +02:00
import_integration_test.go perf(import): do not check for existing grant ID (#8164) 2024-06-20 13:31:58 +00:00
import.go fix(import): add tracing spans to all import related functions (#8160) 2024-06-19 12:56:33 +02:00
information_integration_test.go feat: option to disallow public org registration (#6917) 2023-11-22 09:29:38 +00:00
information.go chore(v2): move to new org (#3499) 2022-04-26 23:01:45 +00:00
instance_converter.go feat: trusted (instance) domains (#8369) 2024-07-31 18:00:38 +03:00
instance.go feat: trusted (instance) domains (#8369) 2024-07-31 18:00:38 +03:00
label_policy_converter.go feat: add attribute to only enable specific themes (#6798) 2023-10-26 05:54:09 +00:00
label_policy.go fix: return absolute asset urls (#3676) 2022-05-20 10:30:12 +02:00
language_converter.go feat: restrict languages (#6931) 2023-12-05 11:12:01 +00:00
language.go refactor(fmt): run gci on complete project (#7557) 2024-04-03 10:43:43 +00:00
lockout_converter.go feat: provide option to limit (T)OTP checks (#7693) 2024-04-10 09:14:55 +00:00
lockout.go chore(v2): move to new org (#3499) 2022-04-26 23:01:45 +00:00
login_policy_converter.go feat: allow to force MFA local only (#6234) 2023-07-20 04:06:16 +00:00
login_policy.go fix: keep user idp links (#7079) 2023-12-19 10:25:50 +00:00
milestone_converter.go refactor(fmt): run gci on complete project (#7557) 2024-04-03 10:43:43 +00:00
milestone.go perf: query projected milestones for onboarding view (#6760) 2023-10-25 11:16:34 +00:00
notification_policy.go feat: add notification policy and password change message (#5065) 2023-01-25 09:49:41 +01:00
notification_provider.go chore(v2): move to new org (#3499) 2022-04-26 23:01:45 +00:00
oidc_settings_converter.go fix: correct oidcsettings management (#4413) 2022-09-27 12:53:49 +02:00
oidc_settings.go fix: correct oidcsettings management (#4413) 2022-09-27 12:53:49 +02:00
oneof.go feat: protos refactoring 2021-03-09 10:30:11 +01:00
org_converter.go fix: allow sorting of MyProjectOrgs (by name) (#7970) 2024-05-17 09:52:15 +02:00
org.go feat: trusted (instance) domains (#8369) 2024-07-31 18:00:38 +03:00
password_age_converter.go chore(v2): move to new org (#3499) 2022-04-26 23:01:45 +00:00
password_age.go fix(query): realtime data on defined requests (#3726) 2022-06-14 07:51:00 +02:00
password_complexity_converter.go chore(v2): move to new org (#3499) 2022-04-26 23:01:45 +00:00
password_complexity.go fix(query): realtime data on defined requests (#3726) 2022-06-14 07:51:00 +02:00
privacy_policy_converter.go feat(cnsl): docs link can be customized and custom button is available (#7840) 2024-05-13 16:01:50 +02:00
privacy_policy.go fix(query): realtime data on defined requests (#3726) 2022-06-14 07:51:00 +02:00
restrictions_integration_allow_public_org_registrations_test.go fix: consider oidc session events for authN milestones (#8089) 2024-06-12 06:49:14 +02:00
restrictions_integration_allowed_languages_test.go fix: remove default TOS and privacy links (#8122) 2024-07-25 08:39:10 +02:00
restrictions.go feat: restrict languages (#6931) 2023-12-05 11:12:01 +00:00
server_integration_test.go feat: impersonation roles (#7442) 2024-02-28 10:21:11 +00:00
server.go feat: trusted (instance) domains (#8369) 2024-07-31 18:00:38 +03:00
sms_converter.go refactor: rename config structs (#5459) 2023-03-16 17:24:30 +00:00
sms.go feat(eventstore): increase parallel write capabilities (#5940) 2023-10-19 12:19:10 +02:00
smtp_converters.go feat: SMTP Templates (#6932) 2024-04-11 09:16:10 +02:00
smtp.go feat: send test mail (#7968) 2024-06-20 19:51:42 +00:00
user_converter.go fix: make user creation errors helpful (#5382) 2023-03-14 19:20:38 +00:00
view_converter.go feat(eventstore): increase parallel write capabilities (#5940) 2023-10-19 12:19:10 +02:00
view.go feat(eventstore): increase parallel write capabilities (#5940) 2023-10-19 12:19:10 +02:00