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

fix: check password max length in checkPasswordStrength #1659

Merged
merged 2 commits into from
Jul 18, 2024

Conversation

kangmingtay
Copy link
Member

What kind of change does this PR introduce?

  • Check if password exceeds max length in checkPasswordStrength

What is the current behavior?

Please link any relevant issues here.

What is the new behavior?

Feel free to include screenshots if it includes visual changes.

Additional context

Add any other context or screenshots.

@kangmingtay kangmingtay requested a review from a team as a code owner July 12, 2024 21:20
@kangmingtay kangmingtay force-pushed the km/fix-max-password-length-error branch from 3a680df to 57a90ab Compare July 12, 2024 21:23
@coveralls
Copy link

coveralls commented Jul 12, 2024

Pull Request Test Coverage Report for Build 9986796684

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 3 of 6 (50.0%) changed or added relevant lines in 2 files are covered.
  • 145 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.03%) to 58.0%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/api/admin.go 0 3 0.0%
Files with Coverage Reduction New Missed Lines %
internal/api/token.go 63 72.79%
internal/models/user.go 82 76.25%
Totals Coverage Status
Change from base Build 9911056994: -0.03%
Covered Lines: 8816
Relevant Lines: 15200

💛 - Coveralls

Copy link
Contributor

@J0 J0 left a comment

Choose a reason for hiding this comment

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

I think one concern in the past was that adminCreateUser doesn't do a password check

I think it relies on models.NewUser to call GenerateFromPassword which then performs the check.

Let's ensure the validation check on password length for adminUserCreate is preserved before moving forward.

Otherwise looks good to me

@J0
Copy link
Contributor

J0 commented Jul 17, 2024

Ah my bad - tested and I realize bcrypt will still throw an error on this line
even if Auth does not explicitly throw an error. So it should be fine

@kangmingtay
Copy link
Member Author

@J0 that's a good point, the admin create user error will return an error if the password length exceeds the max length but the error won't be obvious and is returned as a 500

i've updated the PR to wrap the error and return a bad request error instead

@kangmingtay kangmingtay merged commit 1858c93 into master Jul 18, 2024
2 checks passed
@kangmingtay kangmingtay deleted the km/fix-max-password-length-error branch July 18, 2024 08:15
kangmingtay pushed a commit that referenced this pull request Jul 19, 2024
🤖 I have created a release *beep* *boop*
---


##
[2.155.5](v2.155.4...v2.155.5)
(2024-07-19)


### Bug Fixes

* check password max length in checkPasswordStrength
([#1659](#1659))
([1858c93](1858c93))
* don't update attribute mapping if nil
([#1665](#1665))
([7e67f3e](7e67f3e))
* refactor mfa models and add observability to loadFactor
([#1669](#1669))
([822fb93](822fb93))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
uxodb pushed a commit to uxodb/auth that referenced this pull request Nov 13, 2024
## What kind of change does this PR introduce?
* Check if password exceeds max length in `checkPasswordStrength`

## What is the current behavior?

Please link any relevant issues here.

## What is the new behavior?

Feel free to include screenshots if it includes visual changes.

## Additional context

Add any other context or screenshots.
uxodb pushed a commit to uxodb/auth that referenced this pull request Nov 13, 2024
🤖 I have created a release *beep* *boop*
---


##
[2.155.5](supabase/auth@v2.155.4...v2.155.5)
(2024-07-19)


### Bug Fixes

* check password max length in checkPasswordStrength
([supabase#1659](supabase#1659))
([1858c93](supabase@1858c93))
* don't update attribute mapping if nil
([supabase#1665](supabase#1665))
([7e67f3e](supabase@7e67f3e))
* refactor mfa models and add observability to loadFactor
([supabase#1669](supabase#1669))
([822fb93](supabase@822fb93))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
LashaJini pushed a commit to LashaJini/auth that referenced this pull request Nov 13, 2024
## What kind of change does this PR introduce?
* Check if password exceeds max length in `checkPasswordStrength`

## What is the current behavior?

Please link any relevant issues here.

## What is the new behavior?

Feel free to include screenshots if it includes visual changes.

## Additional context

Add any other context or screenshots.
LashaJini pushed a commit to LashaJini/auth that referenced this pull request Nov 13, 2024
🤖 I have created a release *beep* *boop*
---


##
[2.155.5](supabase/auth@v2.155.4...v2.155.5)
(2024-07-19)


### Bug Fixes

* check password max length in checkPasswordStrength
([supabase#1659](supabase#1659))
([1858c93](supabase@1858c93))
* don't update attribute mapping if nil
([supabase#1665](supabase#1665))
([7e67f3e](supabase@7e67f3e))
* refactor mfa models and add observability to loadFactor
([supabase#1669](supabase#1669))
([822fb93](supabase@822fb93))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
LashaJini pushed a commit to LashaJini/auth that referenced this pull request Nov 15, 2024
## What kind of change does this PR introduce?
* Check if password exceeds max length in `checkPasswordStrength`

## What is the current behavior?

Please link any relevant issues here.

## What is the new behavior?

Feel free to include screenshots if it includes visual changes.

## Additional context

Add any other context or screenshots.
LashaJini pushed a commit to LashaJini/auth that referenced this pull request Nov 15, 2024
🤖 I have created a release *beep* *boop*
---


##
[2.155.5](supabase/auth@v2.155.4...v2.155.5)
(2024-07-19)


### Bug Fixes

* check password max length in checkPasswordStrength
([supabase#1659](supabase#1659))
([1858c93](supabase@1858c93))
* don't update attribute mapping if nil
([supabase#1665](supabase#1665))
([7e67f3e](supabase@7e67f3e))
* refactor mfa models and add observability to loadFactor
([supabase#1669](supabase#1669))
([822fb93](supabase@822fb93))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants