Commit Graph
94 Commits
Author SHA1 Message Date
Tim MöhlmannandGitHub df57a64ed7 fix(oidc): ignore public key expiry for ID Token hints (#7293)
* fix(oidc): ignore public key expiry for ID Token hints

This splits the key sets used for access token and ID token hints.
ID Token hints should be able to be verified by with public keys that are already expired.
However, we do not want to change this behavior for Access Tokens,
where an error for an expired public key is still returned.

The public key cache is modified to purge public keys based on last use,
instead of expiry.
The cache is shared between both verifiers.

* resolve review comments

* pin oidc 3.11
2024-01-29 15:11:52 +00:00
Tim MöhlmannandGitHub af4e0484d0 fix: uniform oidc errors (#7237)
* fix: uniform oidc errors

sanitize oidc error reporting when passing package boundary towards oidc.

* add should TriggerBulk in get audiences for auth request

* upgrade to oidc 3.10.1

* provisional oidc upgrade to error branch

* pin oidc 3.10.2
2024-01-18 07:10:49 +01:00
2ccb7baf85 chore(deps): upgrade all go deps (#7227)
* chore(deps): upgrade all go deps

Also `go mod tidy`.
Added comments with URLs for package version lists to makefile commands.

* Update Makefile

Co-authored-by: Livio Spring <[email protected]>

---------

Co-authored-by: Livio Spring <[email protected]>
2024-01-16 09:27:09 +00:00
Tim MöhlmannandGitHub c0b355e24a fix: pass configured slog to oidc server (#7229) 2024-01-16 06:37:36 +00:00
0a65e20507 docs(examples): symfony php guide (#7171)
* docs(examples): symfony php guide

* hopefully fix vercel

* complete guide

* add guide to navigation

Co-authored-by: Stefan Benz <[email protected]>
2024-01-15 17:49:41 +00:00
Tim MöhlmannandGitHub 62cb29aba9 fix(query): separate login policy queries (#7174)
This change moves IDPLoginPolicyLinks out of the scan function Login Policy queries in order to prevent potential deadlocks.
2024-01-08 21:13:46 +00:00
Tim MöhlmannandGitHub 45ccdcfa99 fix(oidc): nil check for client secret (#7115)
This fixes a nil pointer panic when client basic auth is attempted on a client without secret in introspection.
2023-12-28 13:31:41 +00:00
Tim MöhlmannandGitHub 3483ec470d fix(oidc): ignore unknown language tag in userinfo unmarshal (#7108)
This change upgrades oidc to include the fix into zitadel.
2023-12-22 12:52:01 +00:00
Tim MöhlmannandGitHub 85eb2eda0b fix(oidc): refresh token for device authorization (#7104)
fix(oidc); refresh token for device authorization

Due to a mis-alignment of OIDC interface and concrete implementations in zitadel, requesting a refresh token for device authorization would fail.
This change adds the possibility to to use the op.IDTokenRequest directly.
Also, the UserAgentID is dropped as required parameter, as devices do not have a user agent.
2023-12-21 13:57:33 +00:00
fe1337536f fix(db): add additional connection pool for projection spooling (#7094)
* fix(db): add additional connection pool for projection spooling

* use correct connection pool for projections

---------

Co-authored-by: Livio Spring <[email protected]>
2023-12-20 16:13:04 +00:00
Tim MöhlmannandGitHub e22689c125 feat(oidc): id token for device authorization (#7088)
* cleanup todo

* pass id token details to oidc

* feat(oidc): id token for device authorization

This changes updates to the newest oidc version,
so the Device Authorization grant can return ID tokens when
the scope `openid` is set.
There is also some refactoring done, so that the eventstore can be
queried directly when polling for state.
The projection is cleaned up to a minimum with only data required for the login UI.

* try to be explicit wit hthe timezone to fix github

* pin oidc v3.8.0

* remove TBD entry
2023-12-20 13:21:08 +01:00
Tim MöhlmannandGitHub 1adfca9d28 fix(crypto): allow parsing of cost int from env string (#7061)
fic(crypto): allow parsing of cost int from env string
2023-12-15 11:16:05 +00:00
f680dd934d refactor: rename package errors to zerrors (#7039)
* chore: rename package errors to zerrors

* rename package errors to gerrors

* fix error related linting issues

* fix zitadel error assertion

* fix gosimple linting issues

* fix deprecated linting issues

* resolve gci linting issues

* fix import structure

---------

Co-authored-by: Elio Bischof <[email protected]>
2023-12-08 15:30:55 +01:00
Tim MöhlmannandGitHub 2e505f40f9 fix(oidc): return clients without instance settings (#7036) 2023-12-07 09:43:45 +00:00
Tim MöhlmannandGitHub ec03340b67 perf(oidc): optimize client verification (#6999)
* fix some spelling errors

* client credential auth

* implementation of client auth

* improve error handling

* unit test command package

* unit test database package

* unit test query package

* cleanup unused tracing func

* fix integration tests

* errz to zerrors

* fix linting and import issues

* fix another linting error

* integration test with client secret

* Revert "integration test with client secret"

This reverts commit 0814ba522f0e2254bd8beaaf97d83ad1dc01228d.

* add integration tests

* client credentials integration test

* resolve comments

* pin oidc v3.5.0
2023-12-05 17:01:03 +00:00
51cfb9564a chore(user/v2): solve test TODO that depended on session tokens (#6973)
Closes #6022,

Co-authored-by: Livio Spring <[email protected]>
2023-12-05 15:28:17 +00:00
24b05dc88c fix(authz): add logging to access token verification errors (#6976)
* fix(authz): add logging to access token verification errors

Related to #6949

* use logging fields

---------

Co-authored-by: Livio Spring <[email protected]>
2023-11-27 15:35:08 +00:00
Tim MöhlmannandGitHub 115d944d38 chore: add database questions to bug report template (#6975)
* chore: add database questions to bug report template

Sometimes we get bug reports that are only reproducible when zitadel is running against a certain database.
This change adds database related questions to the issue template, as it is something people don't tend to describe in the detail fields.

* fix syntax error
2023-11-27 08:23:49 +01:00
Tim MöhlmannandGitHub 72bc3ffe14 fix(oidc): add missing fields to introspection (#6967)
during QA I found some user info and org ID was missing.
This change adds those missing fields.
2023-11-23 16:17:50 +02:00
2f91679623 chore(Makefile): add go generate target (#6944)
This change adds a core_generate_all make target.
It installs the required tools and runs generate on the complete project.

`golang/mock` is no longer maintained and a fork is available
from the Uber folks. So the latter is used as tool.
All the mock files have been regenerated and are part of the PR.

The obsolete `tools` directory has been removed,
as all the tools are now part of specific make targets.

Co-authored-by: Silvan <[email protected]>
2023-11-22 10:56:43 +00:00
Tim MöhlmannandGitHub 2de7ce99c5 chore(docs): improve on password hashing (#6951) 2023-11-22 10:29:06 +00:00
ba9b807854 perf(oidc): optimize the introspection endpoint (#6909)
* get key by id and cache them

* userinfo from events for v2 tokens

* improve keyset caching

* concurrent token and client checks

* client and project in single query

* logging and otel

* drop owner_removed column on apps and authN tables

* userinfo and project roles in go routines

* get  oidc user info from projections and add actions

* add avatar URL

* some cleanup

* pull oidc work branch

* remove storage from server

* add config flag for experimental introspection

* legacy introspection flag

* drop owner_removed column on user projections

* drop owner_removed column on useer_metadata

* query userinfo unit test

* query introspection client test

* add user_grants to the userinfo query

* handle PAT scopes

* bring triggers back

* test instance keys query

* add userinfo unit tests

* unit test keys

* go mod tidy

* solve some bugs

* fix missing preferred login name

* do not run triggers in go routines, they seem to deadlock

* initialize the trigger handlers late with a sync.OnceValue

* Revert "do not run triggers in go routines, they seem to deadlock"

This reverts commit 2a03da2127b7dc74552ec25d4772282a82cc1cba.

* add missing translations

* chore: update go version for linting

* pin oidc version

* parse a global time location for query test

* fix linter complains

* upgrade go lint

* fix more linting issues

---------

Co-authored-by: Stefan Benz <[email protected]>
2023-11-21 13:11:38 +01:00
081a0b4cb7 chore(deps): upgrade all go modules (#6895)
* chore(deps): upgrade all go modules

This change upgrades all go.mod dependecies. As well as Makefile tools.

There where some imports that still used the old and deprecated
`github.com/golang/protobuf/ptypes` package.
These have been moved to the equivelant
`google.golang.org/protobuf/types/known` package.

The `internal/proto` package is removed as was only used once.
With a simple refactor in the Validator it became completely obsolete.

* fix validate unit test

* cleanup merge

* update otel

---------

Co-authored-by: Livio Spring <[email protected]>
2023-11-13 10:41:29 +00:00
Tim MöhlmannandGitHub 42a2c0093d fix: use x-zitadel-forwarded header (#6900)
fix: use x-zitadel-forward header
2023-11-10 15:02:53 +00:00
Tim MöhlmannandGitHub b3ff359fc1 fix(system-api): use distinct in intances filter query (#6867) 2023-11-07 06:12:16 +00:00
Tim MöhlmannandGitHub 0a1da1f02c fix: reset custom texts to default (#6833)
* Revert "fix: add texts after template reset (#6237)"

This reverts commit d937ee3dda.

* fix: reset of custom text template

* add custom bulk limits from issue

https://github.com/zitadel/zitadel/issues/6766#issuecomment-1778721782
2023-10-27 17:43:13 +00:00
Tim MöhlmannandGitHub ad26ca88d7 feat(system api): list instances by domains (#6806)
Allow to list instances by their domains on the system API.

closes #6785
2023-10-25 19:20:12 +00:00
94cf30c547 feat(oidc): use the new oidc server interface (#6779)
* feat(oidc): use the new oidc server interface

* rename from provider to server

* pin logging and oidc packages

* use oidc introspection fix branch

* add overloaded methods with tracing

* cleanup unused code

* include latest oidc fixes

---------

Co-authored-by: Livio Spring <[email protected]>
2023-10-25 15:44:05 +00:00
ab79855cf0 fix(eventstore): prevent allocation of filtered events (#6749)
* fix(eventstore): prevent allocation of filtered events

Directly reduce each event obtained from a sql.Rows scan,
so that we do not have to allocate all events in a slice.

* reinstate the mutex as RWMutex

* scan data directly

* add todos

* fix(writemodels): add reduce of parent

* test: remove comment

* update comments

---------

Co-authored-by: adlerhurst <[email protected]>
2023-10-19 15:21:31 +00:00
Tim MöhlmannandGitHub 3bbcc3434a chore(deps): upgrade to oidc v3 (#6737)
This pr upgrades oidc to v3 . Function signature changes have been migrated as well. Specifically there are more client calls that take a context now. Where feasable a context is added to those calls. Where a context is not (easily) available context.TODO() is used as a reminder for when it does.

Related to #6619
2023-10-17 15:19:51 +00:00
Tim MöhlmannandGitHub 0af1c65c4c fix: allow unused keys in hasher config (#6724) 2023-10-13 13:11:20 +00:00
Tim MöhlmannandGitHub c71bf85b7a feat(api/v2): store user agent details in the session (#6711)
This change adds the ability to set and get user agent data, such as fingerprint, IP, request headers and a description to the session. All fields are optional.

Closes #6028
2023-10-12 12:16:59 +00:00
Tim MöhlmannandGitHub d380627e80 feat(passwap): base64 standard encoding for pbkdf2 (#6629)
Upgrade passwap to include the above feature.
2023-09-27 08:00:46 +02:00
Tim MöhlmannandGitHub e6d273b328 chore(deps): bump oidc (#6607)
* chore(deps): bump oidc

Include the Issuer from Frowarded header feature

* use the new constructor
2023-09-22 11:05:11 +02:00
Tim MöhlmannandGitHub 9266f8f00b fix(command): allow email as username (#6565)
Fixes #6460

Made the username checks consistent with create human user.
2023-09-15 15:29:29 +00:00
Tim MöhlmannandGitHub b7d8dc2d72 chore(make): use a timestamp suffix to the default version (#6559)
When doing local builds, the `VERSION` was always set to `development`.
When running this local build, database migration would be skipped,
as the version did not change.

This change suffixes `developement` with the dynamic timestamp from `now`,
so that migrations are always executed
when developing.
2023-09-14 13:30:59 +00:00
5c6a3e968a chore(devcontainer): upgrade go (#6558)
Devcontainer fails to build as we have some 1.21 specific code.

Co-authored-by: Livio Spring <[email protected]>
2023-09-14 12:15:47 +00:00
Tim MöhlmannandGitHub 5d568d82d1 fix(defaults): uncomment Verifiers (#6557)
It seems that options that are completely commented
out do not get parsed from the envionment variables.
This was also to the case for the
`ZITADEL_SYSTEMDEFAULTS_PASSWORDHASHER_VERIFIERS` option.
This change just uncomments the yaml option, so that users
can use the envorment variable to set a list of verifiers they wish to
enable.
2023-09-14 11:25:48 +00:00
Tim MöhlmannandGitHub 241befc185 fix(sessions/v2): resolve tOTP TODO for Auth Methods (#6470)
Fixes #6450
2023-09-01 12:53:10 +00:00
Tim Möhlmann 4f7254f121 fix(deps): upgrade oidc and otel (#6468) 2023-09-01 15:52:53 +03:00
Tim MöhlmannandGitHub 87cdd20d72 fix(deps): upgrade oidc and otel (#6468) 2023-09-01 10:32:13 +00:00
0017542aa2 feat(api/v2): implement TOTP session check (#6362)
* feat(api/v2): implement TOTP session check

* add integration test

* correct typo in projection test

* fix event type typos

---------

Co-authored-by: Livio Spring <[email protected]>
2023-08-15 09:50:42 +00:00
Tim MöhlmannandGitHub cc4499ec2d fix(make): add buf command to core_grpc_dependencies (#6319) 2023-08-14 21:16:20 +03:00
Tim MöhlmannandGitHub 86af67d1be feat(api/v2): implement U2F session check (#6339) 2023-08-11 15:36:18 +00:00
Tim MöhlmannandLivio Spring 61742139e0 fix: always update the timestamp in trigger (#6326)
* always reset timestamp

* re-enable test

(cherry picked from commit 3c7b603650)
2023-08-08 09:13:00 +02:00
Tim MöhlmannandLivio Spring 27513b7bfd fix: trigger session by id in verifySessionToken (#6325)
(cherry picked from commit 11b5a73551)
2023-08-08 09:12:59 +02:00
Tim MöhlmannandGitHub 3c7b603650 fix: always update the timestamp in trigger (#6326)
* always reset timestamp

* re-enable test
2023-08-04 16:17:16 +00:00
Tim MöhlmannandGitHub 11b5a73551 fix: trigger session by id in verifySessionToken (#6325) 2023-08-04 18:16:27 +03:00
Tim MöhlmannandGitHub 4d09409328 feat(crypto): add pbkdf2 support (#6303)
This change brings pbkdf2 support for password hashing and verification.
2023-08-02 11:27:18 +00:00
4589ddad4a feat: integrate passwap for human user password hashing (#6196)
* feat: use passwap for human user passwords

* fix tests

* passwap config

* add the event mapper

* cleanup query side and api

* solve linting errors

* regression test

* try to fix linter errors again

* pass systemdefaults into externalConfigChange migration

* fix: user password set in auth view

* pin passwap v0.2.0

* v2: validate hashed password hash based on prefix

* resolve remaining comments

* add error tag and translation for unsupported hash encoding

* fix unit test

---------

Co-authored-by: Livio Spring <[email protected]>
2023-07-14 09:49:57 +03:00
Tim MöhlmannandGitHub 112f672266 chore: cleanup command/crypto (#5883)
* chore: cleanup command/crypto

* cleanup unused function mockEmailCode
2023-07-10 08:07:10 +00:00
c0e45b63d8 fix: reset the call timestamp after a bulk trigger (#6080)
* reproduce #5808

Add an integration test that imports and gets N amount of human users.
- With N set to 1-10 the operation seems to succeed always
- With N set to 100 the operation seems to fail between 1 and 7 times.

* fix merge issue

* fix: reset the call timestamp after a bulk trigger

With the use of `AS OF SYSTEM TIME` in queries,
there was a change for the query package not
finding the latest projection verson after
a bulk trigger.
If events where processed in the bulk trigger,
the resulting row timestamp would be after the call
start timestamp.
This sometimes resulted in consistency issues when
Set and Get API methods are called in short succession.
For example a Import and Get user could sometimes result in a Not Found
error.

Although the issue was reported for the Management API user import,
it is likely this bug contributed to the flaky integration and e2e tests.

Fixes #5808

* trigger bulk action in GetSession

* don't use the new context in handler schedule

* disable reproduction test

---------

Co-authored-by: Livio Spring <[email protected]>
2023-07-07 08:15:05 +00:00
Tim MöhlmannandGitHub 1461977d93 Merge branch 'main' into rename-topt 2023-06-23 19:09:39 +03:00
Tim Möhlmann 56e33ce1a7 fix: rename OTP to TOTP in v2 alpha user api
This change renames the v2 user OTP registration endpoints and objects
to TOTP.
Also the v2 related code paths have been renamed to TOTP.

This change was discussed during the sprint review.
2023-06-22 12:06:32 +02:00
83da9cada7 fix(v2): typo in register u2f endpoint summary (#6059)
Co-authored-by: Fabi <[email protected]>
2023-06-20 11:06:57 +00:00
Tim MöhlmannandGitHub 09aafb35eb feat(v2): implement user register OTP (#6030)
* feat(v2): implement user register OTP

* feat(v2): implement user verify OTP

* session: retry on permission denied
2023-06-20 10:36:21 +00:00
Tim MöhlmannandGitHub 2e323e8044 feat(v2): register user u2f (#6020) 2023-06-15 05:32:40 +00:00
Tim MöhlmannandGitHub 5693e40930 chore(v2): user register factors proto definitions (#6017)
* chore(v2): user register factors proto definitions
* use uri
2023-06-12 13:24:51 +00:00
Tim MöhlmannandGitHub 6907b52b32 chore(deps): update oidc (#6002) 2023-06-09 15:18:14 +00:00
Tim MöhlmannandGitHub 18f761d404 fix: re-apply register Passkey API v2 (#5990)
Revert "fix: REVERT register Passkey API v2"
2023-06-08 07:39:11 +00:00
Tim MöhlmannandGitHub f456168a74 feat: session v2 passkey authentication (#5952) 2023-06-07 17:28:42 +02:00
Tim MöhlmannandGitHub da95cf32bf fix: REVERT register Passkey API v2 (#5981)
Reverts zitadel/zitadel#5873
2023-06-06 08:35:54 +02:00
Tim Möhlmann 56e5d1a9a8 fix linting error 2023-06-06 00:05:46 +02:00
Tim Möhlmann 7692d2cb8d preserve reused code 2023-06-05 23:30:10 +02:00
Tim Möhlmann cea0595328 Revert "feat: implement register Passkey user API v2 (#5873)"
This reverts commit a301c40f9f.
2023-06-05 18:43:51 +02:00
Tim MöhlmannandGitHub d5eaa8fa16 fix: display loginname in machine client credentials (#5936) 2023-05-26 13:04:45 +00:00
Tim MöhlmannandGitHub a301c40f9f feat: implement register Passkey user API v2 (#5873)
* command/crypto: DRY the code

- reuse the the algorithm switch to create a secret generator
- add a verifyCryptoCode function

* command: crypto code tests

* migrate webauthn package

* finish integration tests with webauthn mock client
2023-05-24 10:22:00 +00:00
Tim MöhlmannandGitHub 6839a5c203 chore: update oidc (#5918) 2023-05-24 08:11:56 +00:00
Tim MöhlmannandGitHub 62e35b266d chore: exclude generated files from coverage (#5884) 2023-05-17 14:22:16 +00:00
Tim Möhlmann 1461d9ec6d Merge branch 'main' into grcp-server-reflect 2023-05-07 16:47:52 +02:00
Tim Möhlmann 62b4c31834 add server reflection to Probes list 2023-05-07 16:47:43 +02:00
Tim MöhlmannandGitHub e772ae55ab chore: integration test base (#5739)
Add integrations tests for the gRPC API, primarily targeted at `v2` but
can also be used for legacy. Provides a crude framework that runs a
server, prepares a client and exposes the underlying resources such as
`command` and `query` handlers to the tester. The code in
`internal/integration` is written just as a proof of concept and
probably needs to be split up in more reusable chunks when we need more
functionality, like multiple users, organisations, instances etc.

Integrations tests for `user/v2alpha` are also included.

See the added documentation for more details.

Related to #5598
2023-05-04 09:45:04 +02:00
Tim MöhlmannandGitHub 11f0f54ce5 Merge branch 'main' into integration-tests 2023-05-04 09:11:59 +02:00
Tim Möhlmann 5f0c1b5290 resolve comments 2023-05-03 15:10:27 +02:00
Tim Möhlmann 4934d6f4fa Merge branch 'main' into integration-tests 2023-05-02 19:24:37 +03:00
Tim Möhlmann c839cb3ce0 tie loose ends, documentation 2023-05-02 19:24:24 +03:00
Tim Möhlmann f011882b2d Merge branch 'main' into grcp-server-reflect 2023-04-30 14:40:13 +03:00
Tim Möhlmann 498c4436ae inegration tests for user email 2023-04-28 17:44:59 +03:00
Tim Möhlmann 4b7f5ae186 AddHumanUser tests 2023-04-28 14:39:53 +03:00
Tim Möhlmann 11ab645bb7 Merge branch 'main' into integration-tests 2023-04-27 12:47:35 +03:00
Tim Möhlmann bd3820cc6c correct the coverpkg path 2023-04-27 12:03:57 +03:00
Tim Möhlmann 596900aba6 nolint contextcheck in NewTester 2023-04-26 20:49:33 +03:00
Tim Möhlmann 03789d43e5 re-enable PR build 2023-04-26 20:29:43 +03:00
Tim Möhlmann ec8f741e58 coverage reports 2023-04-26 20:12:58 +03:00
Tim Möhlmann e1655c3fbb Revert "temporarily remove other workflow for fast running"
This reverts commit 68200dcbe9.
2023-04-26 20:03:40 +03:00
Tim Möhlmann 1dc46b16b0 remove negated integration tags 2023-04-26 19:55:13 +03:00
Tim Möhlmann 90ba3a8d92 poll on test start 2023-04-26 19:54:47 +03:00
Tim Möhlmann 234186c60c do not run tests in parallel 2023-04-25 18:30:08 +03:00
Tim Möhlmann 68200dcbe9 temporarily remove other workflow for fast running 2023-04-25 18:11:53 +03:00
Tim Möhlmann 79084089ea add github action for integration tests 2023-04-25 18:11:04 +03:00
Tim Möhlmann a22b58f1c0 simple test of a health endpoint 2023-04-25 15:04:35 +03:00
Tim Möhlmann e167365548 chore: test server for direct resource access 2023-04-24 20:40:31 +03:00
5819924275 feat: device authorization RFC 8628 (#5646)
* device auth: implement the write events

* add grant type device code

* fix(init): check if default value implements stringer

---------

Co-authored-by: adlerhurst <[email protected]>
2023-04-19 08:46:02 +00:00
Tim Möhlmann 27e9852367 feat: enable grpc server reflection 2023-04-14 16:34:12 +03:00