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

Refactor user_profile to use blueprints #2067

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mikesmit
Copy link
Collaborator

@mikesmit mikesmit commented Dec 23, 2024

fixes #1989, fixes #2059

This migrates the code for the user profile resource to use blueprints.

It also fixes an issue where the PUT operation allowed malicious injection attacks on our database.

@mikesmit mikesmit requested a review from anth-volk December 23, 2024 18:53
@mikesmit mikesmit force-pushed the 1989_user_profile_to_blueprint branch 2 times, most recently from c3cdf8e to 4ce2135 Compare December 23, 2024 18:59
@MaxGhenis MaxGhenis changed the title Refactor user_profile to use bluprints Refactor user_profile to use blueprints Dec 23, 2024
@mikesmit
Copy link
Collaborator Author

mikesmit commented Dec 23, 2024

Test is failing on build. I don't believe it failed on desktop. Investigating why...

@mikesmit
Copy link
Collaborator Author

Confirmed make debug-test passes locally.

@mikesmit mikesmit force-pushed the 1989_user_profile_to_blueprint branch from 4ce2135 to 7fcf974 Compare December 23, 2024 22:38
@anth-volk
Copy link
Collaborator

Is it possible you mean fixes #1989, not #1981?

@mikesmit mikesmit force-pushed the 1989_user_profile_to_blueprint branch from 7fcf974 to 8fd9c30 Compare December 23, 2024 22:58
fixes #1989, fixes #2059

This migrates the code for the user profile resource to use blueprints.

It also fixes an issue where the PUT operation allowed malicious
injection attacks on our database.
@mikesmit mikesmit force-pushed the 1989_user_profile_to_blueprint branch from 8fd9c30 to 5cae080 Compare December 23, 2024 22:59
@mikesmit
Copy link
Collaborator Author

The original issue was that MySQL does not like " around column names but SQLite is happy with them (thus the failure on deploy test instead of desktop test)

WRT the issue link: yeah that was wrong. I fixed it in the commit, but that didn't auto-update the PR. Thank you for fixing.

Now the test are failing on policy tests. Possibly related to MySQL as well, but less obvious.

Copy link
Collaborator

@anth-volk anth-volk left a comment

Choose a reason for hiding this comment

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

@mikesmit, thanks for these changes. They obviously solve a major issue within the existing API. I had one suggestion, but it's non-blocking. Otherwise, I'd love to see this merged once tests pass.

from werkzeug.exceptions import BadRequest, NotFound

user_profile_bp = Blueprint("user_profile", __name__)
user_service = UserService()
Copy link
Collaborator

Choose a reason for hiding this comment

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

suggestion, non-blocking: Rename this to UserProfileService (or something similar)

We also have a user_policy table that should have its own service in the future, and I wouldn't be surprised if we stored more user-related data in the future. I think it might be advantageous to make the service name more descriptive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants