Skip to content

🎨 web-api: patch userName at least 4 chars ⚠️ #7389

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

Merged
merged 8 commits into from
Mar 19, 2025

Conversation

pcrespov
Copy link
Member

@pcrespov pcrespov commented Mar 18, 2025

What do these changes do?

ReDoc

  • 🎨 web-api 0.61.1 β†’ 0.61.2: Enforces a minimum length of 4 characters for userName in the PATCH entrypoint, restricting front-end inputs to names longer than 3 characters.
  • ♻️ Refactors model tests: moves schema-related tests to models-library, while retaining tests covering domain-schema interactions in web-server.
  • 🎨 Users upon creation enforces also minimum lengh constraint: utils_user._generate_username_from_email

Related issue/s

How to test

cd packages/models-library
make install-dev
pytest tests/test_api_schemas_webserver_users.py

Dev-ops

@pcrespov pcrespov added a:webserver issue related to the webserver service a:api framework api, data schemas, a:models-library labels Mar 18, 2025
@pcrespov pcrespov added this to the The Awakening milestone Mar 18, 2025
@pcrespov pcrespov self-assigned this Mar 18, 2025
@pcrespov pcrespov marked this pull request as ready for review March 18, 2025 17:00
@pcrespov pcrespov enabled auto-merge (squash) March 18, 2025 17:00
@pcrespov pcrespov requested a review from odeimaiz March 18, 2025 17:01
Copy link

codecov bot commented Mar 18, 2025

Codecov Report

Attention: Patch coverage is 80.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 88.62%. Comparing base (45ffe4e) to head (dfda292).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7389      +/-   ##
==========================================
+ Coverage   85.65%   88.62%   +2.96%     
==========================================
  Files        1709     1473     -236     
  Lines       66355    58787    -7568     
  Branches     1124      615     -509     
==========================================
- Hits        56838    52098    -4740     
+ Misses       9195     6518    -2677     
+ Partials      322      171     -151     
Flag Coverage Ξ”
integrationtests 65.26% <0.00%> (-0.03%) ⬇️
unittests 87.70% <80.00%> (+3.09%) ⬆️
Components Coverage Ξ”
api βˆ… <ΓΈ> (βˆ…)
pkg_aws_library βˆ… <ΓΈ> (βˆ…)
pkg_dask_task_models_library βˆ… <ΓΈ> (βˆ…)
pkg_models_library 92.01% <100.00%> (+0.26%) ⬆️
pkg_notifications_library 84.57% <ΓΈ> (ΓΈ)
pkg_postgres_database 88.11% <100.00%> (+0.03%) ⬆️
pkg_service_integration 70.03% <ΓΈ> (ΓΈ)
pkg_service_library βˆ… <ΓΈ> (βˆ…)
pkg_settings_library βˆ… <ΓΈ> (βˆ…)
pkg_simcore_sdk 85.46% <ΓΈ> (ΓΈ)
agent 96.46% <ΓΈ> (ΓΈ)
api_server 90.68% <ΓΈ> (ΓΈ)
autoscaling 96.08% <ΓΈ> (ΓΈ)
catalog 92.14% <ΓΈ> (ΓΈ)
clusters_keeper 99.24% <ΓΈ> (ΓΈ)
dask_sidecar 91.25% <ΓΈ> (ΓΈ)
datcore_adapter 98.11% <ΓΈ> (ΓΈ)
director 76.59% <ΓΈ> (ΓΈ)
director_v2 91.30% <ΓΈ> (ΓΈ)
dynamic_scheduler 97.33% <ΓΈ> (ΓΈ)
dynamic_sidecar 90.11% <ΓΈ> (ΓΈ)
efs_guardian 89.79% <ΓΈ> (ΓΈ)
invitations 93.28% <ΓΈ> (ΓΈ)
payments 92.66% <ΓΈ> (ΓΈ)
resource_usage_tracker 89.12% <ΓΈ> (ΓΈ)
storage 84.18% <ΓΈ> (-0.36%) ⬇️
webclient βˆ… <ΓΈ> (βˆ…)
webserver 85.80% <0.00%> (+5.48%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data
Powered by Codecov. Last update 45ffe4e...dfda292. Read the comment docs.

πŸš€ New features to boost your workflow:
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@odeimaiz odeimaiz left a comment

Choose a reason for hiding this comment

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

thx_

@odeimaiz
Copy link
Member

There are a few existing usernames with only 2 or 3 characters, we might need to update them when we deploy this.

@pcrespov
Copy link
Member Author

There are a few existing usernames with only 2 or 3 characters, we might need to update them when we deploy this.

@odeimaiz we can do so but just FYI in principle this PR only constraints the patch API. i.e. having these username in the database is still allowed because the ProfileGet does not validate that

@pcrespov pcrespov changed the title 🎨 web-api: patch userName at least 4 chars 🎨 web-api: patch userName at least 4 chars 🚨 Mar 18, 2025
@pcrespov pcrespov changed the title 🎨 web-api: patch userName at least 4 chars 🚨 🎨 web-api: patch userName at least 4 chars ⚠️ Mar 18, 2025
@odeimaiz
Copy link
Member

There are a few existing usernames with only 2 or 3 characters, we might need to update them when we deploy this.

@odeimaiz we can do so but just FYI in principle this PR only constraints the patch API. i.e. having these username in the database is still allowed because the ProfileGet does not validate that

Sure, but as discussed, these users would never be searchable

@pcrespov pcrespov added the πŸ€–-automerge marks PR as ready to be merged for Mergify label Mar 18, 2025
@pcrespov pcrespov force-pushed the is33/limit-username-lenght branch from ba91a9a to dfda292 Compare March 18, 2025 20:10
@pcrespov pcrespov requested a review from GitHK March 19, 2025 08:23
@pcrespov pcrespov disabled auto-merge March 19, 2025 10:32
@pcrespov pcrespov merged commit 72ed036 into ITISFoundation:master Mar 19, 2025
192 of 198 checks passed
@pcrespov pcrespov deleted the is33/limit-username-lenght branch March 19, 2025 10:32
mrnicegyu11 pushed a commit to mrnicegyu11/osparc-simcore that referenced this pull request Mar 26, 2025
@matusdrobuliak66 matusdrobuliak66 mentioned this pull request Apr 15, 2025
56 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
πŸ€–-automerge marks PR as ready to be merged for Mergify a:api framework api, data schemas, a:models-library a:webserver issue related to the webserver service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants