Repository navigation
fix(kratos): keep a user_metadata key named email, username or phone from overwriting the identifier trait - #138
Merged
Conversation
…from overwriting the identifier trait
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #79
Problem
The Kratos connector copied
user_metadatainto the identity's traits after settingemail,usernameandphonefrom the user's identifiers, so auser_metadatakey with one of those names silently overwrote the identifier trait.Change
buildTraitsnow copiesuser_metadatafirst and sets the identifier traits afterwards, so the user's own identifiers win. The colliding value is still kept inmetadata_public.validatereports auser_metadatakey namedemail,usernameorphonefor Kratos, and points to ametadata:mapping route to move or drop it. The check applies with or without--schema-file.validatereference andmetadatamapping section).Tests
Unit tests cover the precedence in
buildIdentityand the new validation rule (including thatapp_metadatais unaffected).go test ./pkg/connector/kratos/andgo vet ./...pass; the live Kratos test was not run.