Skip to content
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

Sanitize user object in user plugin update method return value #6003

Merged
merged 4 commits into from May 25, 2020

Conversation

drewtownchi
Copy link
Contributor

Description of what you did:

Issue: fix #6000

This change sanitizes the user plugin's update method return object. There should be no reason to return the password hash and the reset token when updating a user object.

I verified locally that the admin workflow is not disrupted by this change because the UI goes from the user list->queries the user->performs PUT and doesn't seem to use the password hash field (or any data for that matter) returned from the PUT request.

Signed-off-by: Drew Town <drew.town+github@gmail.com>
@codecov
Copy link

codecov bot commented Apr 29, 2020

Codecov Report

Merging #6003 into master will increase coverage by 0.56%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6003      +/-   ##
==========================================
+ Coverage   19.28%   19.85%   +0.56%     
==========================================
  Files         863      856       -7     
  Lines       12044    12046       +2     
  Branches     1930     1950      +20     
==========================================
+ Hits         2323     2392      +69     
+ Misses       8148     8079      -69     
- Partials     1573     1575       +2     
Flag Coverage Δ
#front 14.64% <ø> (+0.07%) ⬆️
#unit 41.34% <ø> (+1.53%) ⬆️
Impacted Files Coverage Δ
packages/strapi-plugin-email/admin/src/pluginId.js 0.00% <0.00%> (-100.00%) ⬇️
packages/strapi-utils/lib/stringFormatting.js 50.00% <0.00%> (-50.00%) ⬇️
.../admin/src/components/LeftMenuLink/LeftMenuIcon.js 50.00% <0.00%> (-7.15%) ⬇️
...strapi-plugin-upload/config/functions/bootstrap.js 62.06% <0.00%> (-6.69%) ⬇️
...api-admin/admin/src/components/PluginCard/index.js 4.87% <0.00%> (-2.27%) ⬇️
...pload/admin/src/containers/SettingsPage/reducer.js 90.90% <0.00%> (-0.76%) ⬇️
packages/strapi-utils/lib/index.js 100.00% <0.00%> (ø)
packages/strapi-plugin-email/admin/src/index.js 0.00% <0.00%> (ø)
packages/strapi-provider-upload-local/lib/index.js 22.72% <0.00%> (ø)
...ackages/strapi/lib/load/check-reserved-filename.js 100.00% <0.00%> (ø)
... and 89 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e79daad...f26abb9. Read the comment docs.

@alexandrebodin alexandrebodin self-requested a review May 7, 2020 14:20
Copy link
Member

@alexandrebodin alexandrebodin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, Thank you for this change. I think we should apply this to the other methods too (create, delete) etc :) Can you add this ?

@alexandrebodin
Copy link
Member

Hey @drewtownchi seems like our CI is having trouble. Do you mind amending your last commit and doing a push force on your branche to trigger it again ?

Signed-off-by: Drew Town <drew.town+github@gmail.com>
@drewtownchi
Copy link
Contributor Author

@alexandrebodin I'm not sure why the DCO isn't working. I did what it said and nothing is happening.

@alexandrebodin alexandrebodin added issue: bug Issue reporting a bug source: plugin:users-permissions Source is plugin/users-permissions package labels May 25, 2020
@alexandrebodin alexandrebodin added this to the 3.0.0-rc.2 milestone May 25, 2020
@alexandrebodin alexandrebodin merged commit 549803a into strapi:master May 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Issue reporting a bug source: plugin:users-permissions Source is plugin/users-permissions package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update method in user plugin returns unsanitized user
2 participants