zitadel/internal
Livio Spring ea2246f4bf
fix(saml): improve error handling (#8928)
# Which Problems Are Solved

There are multiple issues with the metadata and error handling of SAML:
- When providing a SAML metadata for an IdP, which cannot be processed,
the error will only be noticed once a user tries to use the IdP.
- Parsing for metadata with any other encoding than UTF-8 fails.
- Metadata containing an enclosing EntitiesDescriptor around
EntityDescriptor cannot be parsed.
- Metadata's `validUntil` value is always set to 48 hours, which causes
issues on external providers, if processed from a manual down/upload.
- If a SAML response cannot be parsed, only a generic "Authentication
failed" error is returned, the cause is hidden to the user and also to
actions.

# How the Problems Are Solved

- Return parsing errors after create / update and retrieval of an IdP in
the API.
- Prevent the creation and update of an IdP in case of a parsing
failure.
- Added decoders for encodings other than UTF-8 (including ASCII,
windows and ISO, [currently
supported](efd25daf28/encoding/ianaindex/ianaindex.go (L156)))
- Updated parsing to handle both `EntitiesDescriptor` and
`EntityDescriptor` as root element
- `validUntil` will automatically set to the certificate's expiration
time
- Unwrapped the hidden error to be returned. The Login UI will still
only provide a mostly generic error, but action can now access the
underlying error.

# Additional Changes

None

# Additional Context

reported by a customer

(cherry picked from commit ffe9570776)
2024-12-03 11:39:48 +01:00
..
actions fix: correctly check denied domains and ips for actions (#8810) 2024-10-23 07:33:43 +02:00
activity feat: trusted (instance) domains (#8369) 2024-07-31 18:00:38 +03:00
admin/repository/eventsourcing feat(cmd): mirror (#7004) 2024-05-30 09:35:30 +00:00
api fix(saml): improve error handling (#8928) 2024-12-03 11:39:48 +01:00
auth/repository fix: only allow domain discovery if no organization was preselected (#8748) 2024-10-10 15:29:53 +00:00
auth_request/repository fix(login): correctly reload policies on auth request (#7839) 2024-04-24 10:54:55 +02:00
authz fix: internal check of JWT access tokens (#8486) 2024-08-26 09:26:13 +00:00
cache perf(cache): pgx pool connector (#8703) 2024-10-04 13:15:41 +00:00
command fix(saml): improve error handling (#8928) 2024-12-03 11:39:48 +01:00
config feat(v3alpha): read actions (#8357) 2024-08-12 22:32:01 +02:00
crypto feat(v3alpha): web key resource (#8262) 2024-08-14 14:18:14 +00:00
database perf(cache): pgx pool connector (#8703) 2024-10-04 13:15:41 +00:00
domain fix: pass sessionID to OTP email link (#8745) 2024-10-10 13:53:32 +00:00
eventstore fix(eventstore): set application name during push to instance id (#8914) 2024-11-18 08:22:48 +01:00
execution feat: add schema user create and remove (#8494) 2024-08-28 19:46:45 +00:00
feature perf(oidc): disable push of user token meta-event (#8691) 2024-09-26 16:22:10 +02:00
form refactor: rename package errors to zerrors (#7039) 2023-12-08 15:30:55 +01:00
i18n fix(middleware): init translation messages (#7778) 2024-04-16 15:46:13 +02:00
iam refactor: cleanup unused code (#7130) 2024-01-02 14:26:31 +00:00
id feat(cmd): Added machine ID mode to zitadel start up logs (#8251) 2024-07-16 09:53:57 +00:00
idp fix(saml): improve error handling (#8928) 2024-12-03 11:39:48 +01:00
integration chore: improve integration tests (#8727) 2024-10-23 07:33:35 +02:00
logstore perf: project quotas and usages (#6441) 2023-09-15 16:58:45 +02:00
migration fix(setup): improve search query to use index (#8898) 2024-11-13 08:52:48 +01:00
net perf: project quotas and usages (#6441) 2023-09-15 16:58:45 +02:00
notification chore: improve integration tests (#8727) 2024-10-23 07:33:35 +02:00
org refactor: cleanup unused code (#7130) 2024-01-02 14:26:31 +00:00
project refactor: cleanup unused code (#7130) 2024-01-02 14:26:31 +00:00
protoc merge main into next 2023-10-19 12:34:00 +02:00
qrcode docs(legal): Updated agreements and policies v2 (#3823) 2022-06-15 08:30:58 +02:00
query fix(actions): preserve order of execution (#8895) 2024-11-15 08:28:35 +01:00
renderer fix(login): (re)allow HTML in custom login texts (#7575) 2024-03-15 16:29:10 +01:00
repository fix: twilio code generation and verification (#8728) 2024-10-07 10:04:14 +02:00
static Merge remote-tracking branch 'origin/main' into next 2024-10-11 11:16:54 +02:00
statik chore: initial version of a devcontainer (#6352) 2023-08-15 10:49:05 +02:00
telemetry feat: enable application performance profiling (#8442) 2024-08-16 13:26:53 +00:00
test refactor(fmt): run gci on complete project (#7557) 2024-04-03 10:43:43 +00:00
user fix: add domain as attribute to list user auth methods (#8718) 2024-10-10 16:50:53 +00:00
v2 fix(eventstore): revert precise decimal (#8527) (#8679) 2024-09-25 06:31:46 +02:00
view/repository refactor(fmt): run gci on complete project (#7557) 2024-04-03 10:43:43 +00:00
webauthn fix: add domain as attribute to list user auth methods (#8718) 2024-10-10 16:50:53 +00:00
zerrors fix(crypto): reject decrypted strings with non-UTF8 characters. (#8374) 2024-08-06 13:58:53 +02:00