-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove ldap caching and move to the Zitadel v2 API #79
Conversation
For UKE we'll need to make sure to test this with a dry run |
The UKE source should be unaffected, because it doesn't need to parse external IDs from Zitadel. But yeah, probably prudent to do dry runs for the first sync after updating in general, this is a pretty big change. |
20a194f
to
35148f4
Compare
Remaining before this can be merged:
|
There is a clash between CSV and LDAP at this point. When we import CSV, it wrongly deletes Zitadel users not present in the CSV (or rather users that it couldn't match). |
Ideal behavior would of course be that switching between LDAP/CSV is possible, but this is not a use case we actually currently have, so while not ideal, it's probbaly fine for this to happen.
Yes, this is already a planned feature, see #75. We should do that as a separate task, though, as mixing the sources will for now be unsupported. We should probably make sure with product that this is indeed fine, however. |
Okay, in that case, we can merge the updated tests from: #80 |
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #79 +/- ##
==========================================
+ Coverage 86.76% 92.01% +5.25%
==========================================
Files 7 8 +1
Lines 1352 1277 -75
==========================================
+ Hits 1173 1175 +2
+ Misses 179 102 -77
Continue to review full report in Codecov by Sentry.
|
edd027e
to
6f6db25
Compare
When we merge this we should tag a new version and notify Niklas |
6f6db25
to
da89731
Compare
18842a2
to
65d5928
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of things I noticed, meaning as points of discussion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good for manual tests now.
a40c9cd
to
8289424
Compare
1e099d5
to
b9d9048
Compare
be32f1b
to
c00730f
Compare
c00730f
to
519ddba
Compare
Closes: #24
Closes: #53
Closes: #30
WIP because there are some things to clear up still. The tests will all fail here, but with some fudging of the sources almost all tests pass.
There are a few things that need to be discussed/covered:
Multi-source config/test suite
Previously, we wanted to support specifying multiple sources simultaneously, since that came somewhat for free. With the removal of the cache, however, only the UKT source uses email addresses to identify users, and in fact only it has a concept of "removed" users, which means that it fundamentally needs to be handled separately from the other sources. Trying to support multi-source definitions is much more tricky with this limitation, so I believe we should not do so.
This is the cause of most of the remaining failures; the test suite was written around the assumption that we can just dump all kinds of sources into one big config file, and for getting this over the line I've ignored also rewriting the test suite so far, instead testing by only having the respective source actively usable in code for the time being.
External user ID encoding
Since we universally use the external user IDs to uniquely identify users now, and we actually pull data from Zitadel instead of just pushing, we now need to re-ingest the user IDs we've written to the nickname field. Unfortunately, because of ldap3's odd behavior of silently converting byte-typed values to strings when they can be, but otherwise returning bytes, we need to base64-encode these IDs.
So far we've just encoded any values that were bytes, and left strings alone - alas, apparently you can end up with strings randomly being valid base64 values (e.g.
starttls
). This means that we do not have a way to distinguish between IDs that were encoded and IDs that were not - when we get unlucky, this can make it impossible to uniquely identify a user, since decoding stringly-typed IDs can sometimes result in valid values.Fixing this in the current implementation is easy (simply prefix encoded strings with a prefix, or encode all values, since UTF-8 strings are also valid byte strings), but backwards compatibility is a problem, since users with encoded IDs already exist in production.
It's possible that there is no way around runs in which some users will be deleted and immediately re-created.
Zitadel version
Due to the various recent Zitadel bugs, we need to update the Zitadel version in this PR. I've currently gone with the latest (
2.64.1
), but maybe we want another version?Remaining tasks: