-
Notifications
You must be signed in to change notification settings - Fork 971
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
fix: allow patching some /credentials sub-paths #4277
Conversation
We still need to disallow `/credentials/oidc`, because patching this would lead to subtle bugs.
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.
Maybe we should also have tests that check, that it's not possible to override nested objects by specifying the wrong path.
E.g.
PATCH
{
"op": "replace",
"path": "/credentials/password",
"value": {
"hashed_password": "<hash>"
},
}
Here, /config/
is missing in the path. Which seems like an easy mistake to make, but would render the identity unusable? Or is this caught by the validator?
Invalid keys are ignored, and AFAIK this is how it has always been. I agree that this would be useful, and also to extend the PATCHing to OIDC, but here I'd just like to revert to the previous behaviour first (with the added benefit of a test). Let's move this into a new issue? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4277 +/- ##
==========================================
+ Coverage 78.57% 78.59% +0.01%
==========================================
Files 381 381
Lines 27376 27376
==========================================
+ Hits 21511 21516 +5
+ Misses 4241 4237 -4
+ Partials 1624 1623 -1 ☔ View full report in Codecov by Sentry. |
Not what I meant. The key is technically valid, because the source JSON object the patch is applied against, has the following structure: {
"credentials": {
"password": {
"config": {
"hashed_password": "<hash>",
}
}
}
} But after applying the faulty patch, the JSON document looks like this: {
"credentials": {
"password": {
"hashed_password": "<hash>",
}
}
} Which is not valid, but I am not sure what would happen if you send the request. So a test for that case would be good. Again, I think that is a very common scenario that will happen easily, and we should do our best to prevent it. |
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.
this line of code is still broken and doesn't do what the comment says. pls fix 🙏
Line 932 in e57e201
patchedIdentity.Credentials = credentials |
Ideally, for both
Restrictions:
|
I opened #4279 for a proper fix. In the meantime, reverting the forbidden paths is not more wrong / broken than what we currently have, so I'd rather have this merged right now to unblock customers.
I opened #4279 for a proper fix. In the meantime, reverting the forbidden paths is not more wrong / broken than what we currently have, so I'd rather have this merged right now to unblock customers. |
Related issue(s)
Checklist
introduces a new feature.
contributing code guidelines.
vulnerability. If this pull request addresses a security vulnerability, I
confirm that I got the approval (please contact
[email protected]) from the maintainers to push
the changes.
works.
Further Comments