-
Notifications
You must be signed in to change notification settings - Fork 460
prevent use of common password using the haveibeenpwned password api #958
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
Changes from 2 commits
c54b3fd
963b990
203592d
8c7723d
ccbb669
cc0348e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -283,6 +283,7 @@ export async function checkCommonPassword(password: string) { | |
| if (error instanceof Error && error.name === 'AbortError') { | ||
| console.warn('Password check timed out') | ||
| } | ||
| console.warn('unknow error during password check', error) | ||
| return false | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It may be a good idea to add a warning if any other kind of error is thrown so we at least have some visibility into whether things are working. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah completely forgot about it |
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,7 @@ | ||
| import { http, HttpResponse } from 'msw' | ||
AdityaKirad marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| export const pwnedPasswordApiHandler = http.get( | ||
| 'https://api.pwnedpasswords.com/range/:prefix', | ||
| () => { | ||
| export const pwnedPasswordApiHandlers = [ | ||
| http.get('https://api.pwnedpasswords.com/range/:prefix', () => { | ||
| return new HttpResponse('', { status: 200 }) | ||
| }, | ||
| ) | ||
| }), | ||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import closeWithGrace from 'close-with-grace' | ||
| import { setupServer } from 'msw/node' | ||
| import { pwnedPasswordApiHandler } from './common-password.ts' | ||
| import { pwnedPasswordApiHandlers } from './common-password.ts' | ||
|
||
| import { handlers as githubHandlers } from './github.ts' | ||
| import { handlers as resendHandlers } from './resend.ts' | ||
| import { handlers as tigrisHandlers } from './tigris.ts' | ||
|
|
@@ -9,7 +9,7 @@ export const server = setupServer( | |
| ...resendHandlers, | ||
| ...githubHandlers, | ||
| ...tigrisHandlers, | ||
| pwnedPasswordApiHandler, | ||
| ...pwnedPasswordApiHandlers, | ||
| ) | ||
|
|
||
| server.listen({ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.