hngprojects / hng_boilerplate_python_fastapi_web

Apache License 2.0
153 stars 136 forks source link

fix: Fixed password update endpoint #869

Closed johnson-oragui closed 2 months ago

johnson-oragui commented 2 months ago

This fix currently fixes the error the endpoint change from /api/v1/users/me/password to /api/v1/auth/change-password. The fix also allows users that signed up with socials to be able to set a password. ​

Description

This fix currently fixes the error the endpoint change from /api/v1/users/me/password to /api/v1/auth/change-password. The fix also allows users that signed up with socials to be able to set a password.

Users that signed up via socials usually do not have passwords set up, meaning they would always have to login using their social accounts, the fix here enables them set a password for their account at convenience, that way, they can then be ale to login with a password and email if they wished. The fix also improved on the allowed special characters for password and the exception of using null character or empty white space or non-printable characters as password.

Related Issue (Link to issue ticket)

Motivation and Context

This fix solves the need for users to be able to change their password with a wider availability of password-usable characters, and also allows users that sign up for the platform via socials to be able to set up a password. ​

How Has This Been Tested?

Screenshots (if any)

(user using old password as new password) password (user using old password as new password)

user with no password who signed up with social entered values in old password) password (user with no password who signed up with social entered values in old password)

user who signed up with social setting up password password (user who signed up with social setting up password)

Types of changes

Checklist:

Please let me know if there is any change i need to make. thank you.

gitguardian[bot] commented 2 months ago

⚠️ GitGuardian has uncovered 3 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard. Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.

🔎 Detected hardcoded secrets in your pull request
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | | | -------------- | ------------------ | ------------------------------ | ---------------- | --------------- | -------------------- | | [13348425](https://dashboard.gitguardian.com/workspace/575673/incidents/13348425) | Triggered | Generic Password | db355f01e1a7f55106067b6a696ad717b80ee3bb | tests/v1/superadmin/test_admincreate.py | [View secret](https://github.com/hngprojects/hng_boilerplate_python_fastapi_web/commit/db355f01e1a7f55106067b6a696ad717b80ee3bb#diff-17f353d501d73af03bc0dd9e002fb0fa1a9efa59d91e9dca303e2fc4e5aa2b59R29) | | [13348450](https://dashboard.gitguardian.com/workspace/575673/incidents/13348450) | Triggered | Generic Password | bef81dc512f2a634b0890e49471b7ec7294e2671 | tests/v1/user/change_user_password_test.py | [View secret](https://github.com/hngprojects/hng_boilerplate_python_fastapi_web/commit/bef81dc512f2a634b0890e49471b7ec7294e2671#diff-208f20a65c803ae517b26b9625525515a35276a0633438b473da6bf3f56e54c3R90) | | [13348450](https://dashboard.gitguardian.com/workspace/575673/incidents/13348450) | Triggered | Generic Password | db355f01e1a7f55106067b6a696ad717b80ee3bb | tests/v1/user/change_user_password_test.py | [View secret](https://github.com/hngprojects/hng_boilerplate_python_fastapi_web/commit/db355f01e1a7f55106067b6a696ad717b80ee3bb#diff-208f20a65c803ae517b26b9625525515a35276a0633438b473da6bf3f56e54c3R90) |
🛠 Guidelines to remediate hardcoded secrets
1. Understand the implications of revoking this secret by investigating where it is used in your code. 2. Replace and store your secrets safely. [Learn here](https://blog.gitguardian.com/secrets-api-management?utm_source=product&utm_medium=GitHub_checks&utm_campaign=check_run_comment) the best practices. 3. Revoke and [rotate these secrets](https://docs.gitguardian.com/secrets-detection/secrets-detection-engine/detectors/generics/generic_password#revoke-the-secret?utm_source=product&utm_medium=GitHub_checks&utm_campaign=check_run_comment). 4. If possible, [rewrite git history](https://blog.gitguardian.com/rewriting-git-history-cheatsheet?utm_source=product&utm_medium=GitHub_checks&utm_campaign=check_run_comment). Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data. To avoid such incidents in the future consider - following these [best practices](https://blog.gitguardian.com/secrets-api-management/?utm_source=product&utm_medium=GitHub_checks&utm_campaign=check_run_comment) for managing and storing secrets including API keys and other credentials - install [secret detection on pre-commit](https://docs.gitguardian.com/ggshield-docs/integrations/git-hooks/pre-commit?utm_source=product&utm_medium=GitHub_checks&utm_campaign=check_run_comment) to catch secret before it leaves your machine and ease remediation.

🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.