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

feat: make own validation for password #688

Merged
merged 3 commits into from
Nov 5, 2024
Merged

feat: make own validation for password #688

merged 3 commits into from
Nov 5, 2024

Conversation

spaenleh
Copy link
Member

@spaenleh spaenleh commented Nov 4, 2024

In this PR I propose to remove the dependency validator since we only use the password checking and email checking functions. It would be easy for us to include the code of these functions in our own codebase and remove the dependency on that package. This will also allow us to properly test these functions with the inputs that seem relevant to us.

Why we should try to remove our dependency on this module is best illustrated by an image:
Screenshot 2024-11-04 at 09 25 22
We see that in the production bundle of account, this package takes around 250Kb (rendered) of space. As we only use isStrongPassword and isEmail this seems a bit much.

Copy link

gitguardian bot commented Nov 4, 2024

⚠️ GitGuardian has uncovered 2 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.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
14408331 Triggered Generic Password 446007a src/validation/isPasswordStrong.test.ts View secret
14408331 Triggered Generic Password cbf8df9 src/validation/isPasswordStrong.test.ts View secret
🛠 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 the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. 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


🦉 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.

@spaenleh spaenleh requested a review from pyphilia November 4, 2024 08:23
@spaenleh spaenleh self-assigned this Nov 4, 2024
@spaenleh spaenleh requested a review from ReidyT November 4, 2024 08:23
@spaenleh spaenleh added the chore Generic task or chore label Nov 4, 2024
src/validation/isPasswordStrong.ts Show resolved Hide resolved
Copy link
Contributor

@ReidyT ReidyT left a comment

Choose a reason for hiding this comment

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

It's a very good idea to extract the necessary code in terms of saving space compared to the small complexity added to our project 👍

Sounds good to me, I'd just add a few more test cases to completely validate the isStrongPassword code.

src/validation/isPasswordStrong.test.ts Outdated Show resolved Hide resolved
@spaenleh spaenleh requested a review from ReidyT November 4, 2024 10:07
@spaenleh
Copy link
Member Author

spaenleh commented Nov 4, 2024

@ReidyT Thank you for the suggestion. I have implemented the additional tests and fixed the code smell issues detected by SonarCloud.

Copy link

sonarqubecloud bot commented Nov 4, 2024

Copy link
Contributor

@ReidyT ReidyT left a comment

Choose a reason for hiding this comment

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

Really nice! Thanks for this change 🦄

@spaenleh spaenleh added this pull request to the merge queue Nov 5, 2024
Merged via the queue into main with commit 2046f76 Nov 5, 2024
3 checks passed
@spaenleh spaenleh deleted the remove-validator branch November 11, 2024 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Generic task or chore v4.34.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants